Why Pakistan fears foreign pullout from Afghanistan
Pakistan's role in the war in Afghanistan appears to have come full circle, with many quarters now hoping for a drawn-out, "phased" withdrawal of Western troops from the region instead of an immediate one.
This reflects a change of perception within the Pakistani establishment which has in the past blamed the presence of Western troops in Afghanistan for rising militancy in Pakistan.
One reason may be financial. Since October 2001 when US forces stormed Afghanistan, Pakistan has been the recipient of over $20bn (£12.4bn) in American aid, most of it in military assistance.
Islamabad's pivotal role in the war and its influence over Taliban militants have also given it considerable leverage and influence with the US and other centres of power in the West.
A decision by the Afghan Loya Jirga, the grand assembly of more than 2,000 elders, to reject the proposed bilateral security arrangement with the United States - which proposes permitting US forces to remain in the country well beyond next year - could potentially close these avenues for Pakistan.
An equally pressing reason is the rise of militant groups targeting Pakistan, and their ties to the Afghan Taliban who are perceived to be Pakistan's proxies.
The mutual inter-dependence of these groups and their increasingly common goals in the Af-Pak region has created a complex situation for Pakistan, turning it into a regular target of militant attacks.
"The tide of militancy that kept Afghanistan on the boil all these years is now flowing in reverse, into Pakistan," says Dr Hasan Askari Rizvi, a defence analyst based in Lahore.
"A resurgence of Taliban in Afghanistan would accentuate this situation, and could create grave problems here for both the government and the military."
This scenario could become a reality if the Afghans reject the proposed bilateral security arrangement with the US.
Walking a tightrope
During the 12 years of war, Pakistan has faced fluctuating fortunes.
It started out as a "frontline" state in the US-led "war on terror" in late 2001.
But by 2008, when the military government of General Pervez Musharraf made way for democracy, it was coming under increased criticism from both international and domestic audiences.
Internationally, Pakistan was accused of double-crossing the Western powers, and questions were raised over the vast sums given it by the US to deliver results in Afghanistan.
On the domestic front, right-wing political groups had started to question the wisdom of fighting what they called a "foreign" war.
This criticism was inevitable given the strategy Pakistan is understood to have pursued during the first six years of the war.
It shared intelligence with the US, opened its ground and air routes for use by Western troops fighting in Afghanistan, and even provided bases to the American forces on its territory.
But at the same time it lowered the traditional security barriers in its semi-autonomous tribal areas on the border with Afghanistan, allowing al-Qaeda and Taliban militants to cross over and set up safe havens there.
Analysts say the autonomous status of the tribal areas and its long and porous border with Afghanistan provided Pakistan with "plausible deniability" that it was wilfully muddying the waters in Afghanistan.
Pakistani concerns were simple: the presence of Americans next door was viewed by many as posing a threat to the country's nuclear arsenal. Many in the military establishment still feel nervous about it.
It also feared that if Afghanistan stabilised under the leadership of Hamid Karzai, Pakistan's arch-rival India would expand its influence there and at some point push Afghanistan to revive border disputes with Pakistan. This, too, remains a clear and present danger for the military leadership.
But analysts say some miscalculations about the nature of the militant networks have landed Pakistan in a catch-22 situation.
The assumption, according to analysts, was that militants affiliated with the Quetta Shura - the main decision-making body of the Afghan Taliban, based in the Pakistani city of Quetta - and the militant Haqqani network would force the US and its allies out of Afghanistan and capture the Kabul government.
Once that happened, they would easily "demobilise" the "Pakistani" Taliban - the tribal Pashtuns and the Punjabis - with the swipe of a hand.
"But by 2011 it became increasingly clear that while Taliban could create turmoil in Afghanistan, they were incapable of scoring an absolute victory," says Ismail Khan, the resident editor of Dawn newspaper in Peshawar.
"They also realised more recently that Pakistani and Afghan Taliban, as well as their al-Qaeda and Punjabi allies, were inseparable from each other, and a strike against one could upset the others."
Elements close to the Taliban say that while they depend on help from elements of the Pakistani regime, they also realise the extent to which Pakistan needs them in countering India in Afghanistan.
So there is a growing perception that the Taliban would be willing to keep Pakistan under pressure and thereby keep the country's tribal region under their permanent control once Nato forces have left.
The US-Afghanistan security arrangement comes against this backdrop.
Dr Askari says Pakistanis are still not very "clear-headed", given their apprehensions about India.
But in the short run, "they will not be averse to the idea of some American troops staying on in Afghanistan as a stabilising force".
This, he says, will give Pakistan time to come to grips with its internal security problems, and also keep vital Western financial assistance flowing.