Afghanistan said on Tuesday it had agreed the framework of a security pact with the United States days ahead of a national gathering to debate the future of the U.S. military presence in the country.
But the U.S. State Department said some final issues still had to be settled before a final text was ready. "We are not there yet," a spokeswoman said
Thousands of Afghan tribal and political leaders are due to gather in Kabul on Thursday to decide whether to allow U.S. troops to stay after a 2014 drawdown of foreign military to help fledgling security forces fight a Taliban-led insurgency.
Without an accord on the so-called Bilateral Security Agreement (BSA), the United States says it could pull out all its troops at the end of 2014.
Two years ago, it ended its military mission in Iraq with a similar "zero option" outcome leading to the withdrawal of all of its troops after the failure of talks with Baghdad.
A spokesman for Afghan President Hamid Karzai said the two sides agreed on crucial provisions giving U.S. troops immunity from Afghan law and allowing them to enter Afghan homes in exceptional circumstances, removing the main stumbling blocks to the deal.
"Both sides agreed that Obama send a letter ... assuring the president and the people of Afghanistan that the right to enter into Afghan homes by U.S. forces and the extraordinary circumstances will not be misused," the spokesman, Aimal Faizi, told reporters in Kabul.
Faizi said the exact wording of the provision was discussed in a telephone call with Kerry and agreed upon.
"This will be finalized later this evening and hopefully by tomorrow morning our time the language will be finalized and we will have one version, one language in the document. In addition to that we will have a letter from the U.S. president."
Karzai has long objected to the provisions but the United States has said they are crucial for its forces to remain in the country beyond 2014.
Security was tight in Kabul ahead of the Loya Jirga, a traditional Afghan grand assembly convened to debate matters of national importance, following a suicide bomb attack outside the tent over the weekend.
"The Loya Jirga is crucial for the future of our country," said Farhad Sediqqi, a member of parliament who will attend the assembly. "Afghanistan needs to have a partnership and a pact with the United States."
The meeting comes at a critical juncture for Afghanistan ahead of a presidential election next year and growing anxiety about security as foreign troops prepare to leave.
Faizi Said Obama would write a letter to the Afghan people acknowledging mistakes made during the 12-year war.
With the agreement, a U.S. force of between 10,000 and 15,000 will remain in Afghanistan.
Karzai floated the idea of a grand council in order to muster popular support for a security deal opposed by many Afghan politicians and others.
In the city of Jalalabad, hundreds of students rallied against the pact on Tuesday chanting "Death to America, death to Karzai, long live the Islamic Emirates of the Taliban!"
The Taliban have been waging an insurgency against Karzai and his foreign backers, to force out foreign troops, since 2001 and some fear the Afghan security forces will struggle once most foreign troops leave next year.
The war has grown more deadly as international military bases have shut down. Over the past month, over 160 people have been killed and more than 300 more wounded in attacks by the Taliban, the Ministry of Interior said on Tuesday.
"Through this farce, the Karzai regime wishes to execute the Americans' demands and implement a treacherous deal which in our history will forever be known as national sedition and a criminal act against our nation," the Taliban said in a statement.
Delegates attending the grand assembly appear to be divided on the pact and much will rest on Karzai's opening speech on Thursday, with many likely to take their cue from him.
If the council votes in favor of the pact with the United States, it will still need the approval of both houses of parliament and the president's signature before it is ratified.
The United States appeared optimistic about the Afghan pact.
"We reached general agreement on the BSA when Secretary Kerry was in Kabul last month," said Laura Lucas Magnuson, a spokeswoman for the White House National Security Council.
"Since then discussions have been ongoing with the Afghans to finalize the text ahead of the Loya Jirga. We continue to believe the BSA is in the interests of both countries."