In an apparent riposte to Afghanistan and India, Pakistan Army chief General Ashfaq Parvez Kayani on Saturday said Pakistan was fully capable of defeating any "external direct threat" despite the current focus of the security forces on internal security.
Without naming any country, Kayani said Pakistan had shown restraint while "very belligerent statements" were made against the country.
He was addressing a passing out parade at the Pakistan Military Academy at Kakul near Abbottabad.
"We have exercised restraint in the face of some very belligerent statements in recent months. Let it suffice to say that Pakistan is fully capable of responding effectively to any threat. Despite our current focus on internal security, we remain fully prepared to defeat an external direct threat," the powerful army chief told the gathering of senior serving and retired military officers and diplomats.
Ties between India and Pakistan had hit a low earlier this year after a string of violations of the ceasefire along the Line of Control.
After two Indian soldiers were killed along the LoC, including one who was beheaded, Indian Army chief General Bikram Singh said his force had the "right to retaliate at a time and place of our choosing".
In recent weeks, Pakistan and Afghanistan have also traded angry charges over several incidents of cross-border shelling and attacks.
In March, the Afghanistan Army cancelled a visit by its officers to Pakistan over shelling by Pakistani forces in border areas of Kunar province.
Afghan military officials too had threatened to retaliate against Pakistani shelling.
In his speech, Kayani described Pakistan as a "peace loving country" whose "quest for peace is essentially based on a genuine desire to improve our lot and that of our future generations".
He added, "Let no one see it as a weakness."
He said Pakistan had, during its short history, had "overcome many a challenges that would have overwhelmed lesser nations. I am sure we can do it again."
"We are going through difficult times but so has every other successful nation at some time in their history. The Pakistan Army is fully committed to the cause. I assure you that we will succeed if we remain committed to the basis for the creation of Pakistan and remain steadfast as a nation," Kayani said.
Kayani recalled that "Pakistan was created in the name of Islam and Islam can never ever be taken out of Pakistan. However, Islam should always remain a unifying force."
He congratulated the graduating cadets, including those from Palestine, Sudan and Turkmenistan.
"Let there be no doubt that with a strong Pakistan Army and the nation standing with it united, no harm can ever come to Pakistan," he said.