US secretary of state John Kerry said a partial agreement has been reached with Afghanistan on a security accord but the potentially deal-breaking issue of jurisdiction for American forces remains unresolved.
Kerry told a news conference that if there is no deal on the issue there will not be an agreement to allow American troops to remain in the country after the Nato-led military mission ends next year.
President Hamid Karzai said that he will let a national council of elders and then parliament decide on the issue of who has jurisdiction for any crimes committed by US forces in Afghanistan after 2014.
Mr Kerry said jurisdiction is not an issue of immunity and the US will prosecute any wrongdoing by American forces.
"We have reached an agreement on the respect of national sovereignty, preventing civilian casualties, a definition for aggression and also the prevention of unilateral acts by foreign forces. We reached an agreement on that, but the issue of jurisdiction for foreign forces is above the authority of the Afghan government and that is up to the Afghan people and the Loya Jirga," Mr Karzai said.
Mr Kerry responded that any decision made by the Loya Jirga and parliament would be respected, but if the jurisdiction issue was not resolved there would be no agreement.
In Iraq, a similar deal fell apart after US officials were unable to reach an agreement with the Iraqis on the same issue that would have allowed a small training and counter-terrorism force to remain there. The United States completely pulled out of Iraq after the deal collapsed.
The jurisdiction issue came to the fore after an American soldier, Staff Sgt Robert Bales, killed 16 people in two villages in southern Afghanistan last year. He was convicted in August by a military court and sentenced to life in prison with no chance of release.
Mr Kerry explained that the issue should not be equated with immunity, as it is perceived by many Afghans. He said the United States would prosecute any wrongdoing and that similar agreements existed with many countries, like Japan and South Korea.
Mr Kerry began negotiations with Mr Karzai in the morning, the second day of talks. He left shortly after the last meeting, headed for Europe and the United States.
Discussions had repeatedly stalled in recent weeks over Mr Karzai's demand for American guarantees against future foreign intervention from countries like Pakistan, and US demands for any post-2014 residual force to be able to conduct counter-terrorism and counter-insurgency operations.
The situation deteriorated in the past week following a series of angry comments from Mr Karzai that the United States and Nato were repeatedly violating Afghanistan's sovereignty and inflicting suffering on its people.
Mr Karzai has been reticent to sign a deal, worried about his legacy and possibly because of a lingering bitterness over what he considered as foreign meddling in the 2009 presidential vote that almost cost him the election. Having completed a second term, he is not eligible to run in the April 5 presidential elections.
He is keenly aware that previous leaders of his country historically have been punished for selling out to foreign interests and wants to make sure that any US-Afghan agreement is not seen in that light.
There currently are an estimated 87,000 international troops in Afghanistan, including about 52,000 Americans. That number will be halved by February and all foreign combat troops will be gone by the end of next year.
The US wants to keep as many as 10,000 troops in the country to go after the remnants of al Qaida, but if no agreement is signed, all US troops would have to leave by December 31 2014.