ISLAMABAD — Afghan and Pakistani leaders have agreed on closer defense and security cooperation, leading analysts to believe the neighbors are finally sharing a common view on achieving regional stability.

The leaders met on Tuesday for daylong delegation level talks in the Afghan capital of Kabul at the invitation of the Afghans.

Pakistani Prime Minister Nawaz Sharif led civilian political and security officials along with Pakistan's Chief of Army Staff Gen. Raheel Sharif, plus Lt. Gen. Rizwan Akhtar, the director-general of Inter Services Intelligence. They met (ISI) Lt. Gen. Rizwan Akhtar meeting their counterparts led by Afghan leaders President Ashraf Ghani and Chief Executive Dr Abdullah Abdullah.

The main focus aspect of this was the Pakistani prime minister's pledge of joint operations against terrorists.

"Coordinated operations will be planned and conducted on a mutually agreed basis to target militant hideouts along the border." He "underlined Pakistan's resolve to further deepen our defense and security partnership with Afghanistan through enhanced cooperation along the border and human resource development."

Claude Rakisits, nonresident senior fellow at the Atlantic Council's South Asia Center, said there is now genuine commitment from both parties to bring this about.

He highlights Pakistan's changed attitude toward the Afghan Taliban, and "that supporting the Afghan Taliban was no longer in Pakistan's long-term interest."

Similarly, former Australian defense attache to Islamabad Brian Cloughley said though it may be common to claim a new era in bilateral relations on such occasions, in this case it may be genuine.

"It appears that both countries' governments know what is good for them, and, especially, what's bad for them: cooperation good; terrorism bad. And without cooperation between them, the Taliban and all its offshoots are going to thrive."

Tension between the neighbors was never purely due to the Taliban, however, but also due to Pakistan's poor relationship with former Afghan President Hamid Karzai and fears of Indian encirclement.

Rakisits said Afghan President Ashraf Ghani understands former "President Karzai's confrontational approach toward Pakistan was counterproductive at best. Moreover, it was obvious that Karzai's chumminess toward the Indians was poor policy, and would not provide Afghanistan with additional security.

"On the contrary, Pakistan was hardly going to go out of its way to help Afghanistan fight the terrorists with Kabul getting cozy with Pakistan's arch enemy," he said.

Ghani's realization of the need to enter into an effective security relationship with Pakistan is "a relationship of convenience between a big country and a smaller one trying to get back on its feet after 35 years of war," he said.

However, the relationship can work if both parties honor their pledges, and that both China and the US also have an interest in making sure this happens and will "do all they can to see that it does."

India's involvement in Afghanistan has been a hot topic recently in Pakistan.

Last week, Gen. Sharif accused India's Research and Analysis Wing (RAW) intelligence agency of using Afghan territory to undermine Pakistani security. However, Tuesday also saw a commitment not to allow the territory of either state to be used to undermine the security of the other, which along with the other measures may now assure Pakistan in this regard.

Pakistan's military is also deeply involved in wider efforts to improve security and stability.

According to the Pakistan military's media affairs branch, Inter Services Public Relations (ISPR), the Pakistan Army's civil engineering arm, the Frontier Works Organisation (FWO) will commence construction of the Torkham-Jalalabad Dual Carriageway within a week.

The improved road will facilitate bilateral economic activity and hopefully help pacify the insurgency-prone areas along with joint military action, something Cloughley said was previously lacking.

He says there was very little joint cooperation between US forces in Afghanistan and the paramilitary Frontier Corps and Army in Pakistan, and that the Afghan National Army (ANA) "followed suit," though it has been obvious for many years "that there must be joint action against infiltrators."

However, he raises a potential obstacle.

"It looks as if this will happen, but the problem now is that the Afghan Army is professionally in very bad shape. There might be a modicum of Pakistani training, but that will make very little difference, because it takes time for results to show."

Previously Pakistan has offered to train and equip the Afghan Army. Gen. Sharif offered the Afghans the "full range of training courses and facilities in Pakistan's training institutions to Afghan security forces" during a trip to Kabul last November, according to an ISPR statement at the time.