What future does security pact give Afghanistan?
Afghanistan's Loya Jirga - grand traditional assembly - of 2,500 delegates on Sunday endorsed a crucial security agreement with the US and urged President Hamid Karzai to sign it by the end of this year.
The bilateral security agreement between the US and Afghanistan is one of the most important decisions in Afghanistan's recent history with far-reaching implications not only for the national security and politics of Afghanistan but also for the geopolitics of the whole region.
According to the UN Security Council's mandate, the US-led international military force in Afghanistan is scheduled to hand over all security duties to Afghan forces before its full withdrawal by the end of 2014.
But a signed "Security and Defence Co-operation Agreement" means that around 10,000 US troops could stay in Afghanistan for another 10 years.
The main role of foreign forces will be to train and assist the Afghan military and police. But some US Special Forces will continue to hunt the al-Qaeda network and its affiliates as part of their "counter-terrorism operations".
Afghanistan has had "limited sovereignty" since the US-led invasion under a 2001 UN Security Council resolution.
With this agreement, which comes into force on 1 January 2015, Afghanistan will reclaim control and "full sovereignty" over its airspace, territory and waters.
The deal means that the US forces will be based in nine strategically important "facilities and areas" across Afghanistan including provinces that border Iran and Pakistan.
The two countries have been bargaining over this agreement for more than a year.
After approval by the Loya Jirga, the security pact will now be discussed in both houses of the country's parliament where it is also likely to receive overwhelming support.
Finally, President Karzai has to sign it into effect. But he is reluctant, saying he needs more time to see it is being implemented by the US.
This means he will continue negotiations with the US over the next few weeks and months before making a final decision.
Mr Karzai fears that the US might not keep its promises to respect Afghan sovereignty and not interfere in domestic issues, especially with presidential elections due in April next year.
He might also be hoping that the Jirga's decision will result in a last-minute change of heart by the Taliban to stop fighting and join the political process.
They and their backers were apparently hoping to have a free ride after the withdrawal of all foreign forces after 2014. But this agreement will prove them wrong.
Mr Karzai is also concerned about his legacy. He is asking for guarantees so as not to appear responsible for an agreement that might be seen in the future as selling out to foreign interests.
Although this was a "consultative" Loya Jirga whose decisions are not binding, its verdict will make it more difficult for the government to ignore its judgment and advice.
The US is also increasing pressure on Mr Karzai to sign the pact immediately.
The war in Afghanistan is becoming increasingly unpopular in the US, as the longest and costliest war in its history.
US officials insist the deal must be concluded by the end of 2013, saying any further delay will jeopardise the "financial and practical help" offered by the US and make the plan for its post-2014 presence "impossible".
The Obama administration has warned that it will pull out all of its forces as it did in Iraq unless the Afghan government signs the deal.
The Loya Jirga members say that the deal will contribute to the country's reconstruction.
They are worried that the exit of all foreign forces could put at risk the $8bn that has been pledged annually to fund Afghan security forces and developmental projects.
Western military officials say that the nearly 350,000-member Afghan National Security Forces are not yet ready to secure the country and fight the militants on their own.
Most Loya Jirga members say that Afghanistan's strategic location necessitated the country entering into a pact to protect itself against interference by neighbours.
According to the draft agreement, the US will help Afghanistan in countering "external aggression", taking "political, diplomatic, military and economic measures".
It gives the US full legal jurisdiction over troops and Defense Department civilians, despite deep divisions in Afghanistan over whether the Americans should have immunity from Afghan courts.
It also addresses the contentious issue of night raids, saying: "US forces can only enter Afghan homes in extraordinary circumstances when the life or limb of Americans is at stake.''
The agreement will "remain in force until the end of 2024 and beyond" unless terminated "by mutual written agreement or by either party upon two years' written notice".
The Taliban have rejected the Afghan-US security agreement from the outset, calling the presence of US forces in Afghanistan "the prime reason for instability", and threatened to continue armed resistance.
Their main condition for a ceasefire is the "full withdrawal" of foreign forces, which they consider an infringement of Afghan independence, and against Islam and Afghan culture.
According to a senior Taliban commander, the security agreement will endanger peace talks and diminish the possibility of any political settlement in Afghanistan.
The two countries that seem unhappy with this security pact are Iran and Pakistan - neighbours blamed for most of the interference in Afghanistan.
Iran has openly objected to both the pact and the presence of Western forces in Afghanistan, arguing that a foreign military presence will have a negative impact on Afghanistan as well as the region. Iran's main concerns are about possible interference by Western forces based in Afghanistan, and encirclement.
Although Pakistan has been seen as the main backer of the Afghan Taliban, Pakistani officials have generally blamed the presence of foreign forces in Afghanistan for rising militancy inside Pakistan.
It has concerns about the activities of US forces in Afghanistan and the possible presence of foreign forces hostile to Pakistan. It thinks that the US drone attacks on Pakistani territory will continue as long as US forces are in Afghanistan.
Pakistan also fears that the stability brought to Afghanistan by the continued presence of US forces will further increase the influence of its arch rival, India. In addition, many in the Pakistani security establishment also view the US presence next door as a threat to their nuclear arsenal.
But all other neighbours and regional players in Afghanistan - China, India, Russia and the Central Asian countries as well as Turkey, Saudi Arabia and the United Arab Emirates - all of whom either face or fear Islamic militancy, seem to be in favour of this deal.
None of these countries apparently wants the permanent presence of US forces in the region. But they have accepted the short-term presence of US forces in Afghanistan as a "lesser evil", hoping it will work as a stabilising force that could keep militancy confined within Afghan borders.