Afghanistan and US agree text of security deal
The US says it has agreed the text of a bilateral security agreement with Afghan officials.
The deal paving the way for some US troops to remain after 2014 will be discussed by delegates at a meeting known as the Loya Jirga on Thursday.
Late on Wednesday the Afghan foreign ministry published a draft deal that would give US troops remaining after 2014 immunity from Afghan courts.
The US had said all its troops would be withdrawn if no immunity was agreed.
"We have reached an agreement as to the final language of the bilateral security agreement that will be placed before the Loya Jirga tomorrow," US Secretary of State John Kerry said.
It was not immediately clear whether Mr Kerry was referring to the draft published by the Afghan foreign ministry.
Mr Kerry also contradicted earlier reports that Afghanistan had asked for an apology from the US for mistakes made during the 12-year war.
"Let me be clear. President [Hamid] Karzai didn't ask for an apology. There was no discussion of an apology,'' he said.
Mr Kerry said remaining US forces would have "a very limited role".
"It is entirely train, equip, and assist. There is no combat role for the United States forces," he said.
"It is very important for President Karzai to know that issues that he has raised with us for many years have been properly addressed. It is very important for us to know that issues we have raised with him over the years have been properly addressed.''
Both sides had been refusing to budge on certain issues.
The Afghans have long opposed US raids on Afghan homes, particularly night raids because they are perceived to violate the sanctity of women in the home.
And the US had insisted that any troops remaining in Afghanistan after 2014 receive immunity from prosecution.
The failure to resolve a similar legal issue in Iraq led to a total withdrawal of US forces.
Delegates at the Loya Jirga - a council of elders - had earlier expressed concern at how late the negotiations between the two governments had been going on.
"Whatever is happening with the security pact is very confusing for us," Abdul Hanan, a senator from eastern Paktia province who will attend the jirga, told Reuters before the text was agreed between the two governments.
"It will be very difficult to vote for which drafts [are] for our benefit, we are all confused."
Security has been tightened for the meeting after a suicide bomb attack outside the huge tent where it is to be held over the weekend.
US officials said during a meeting of Nato defence ministers in February that the alliance was considering keeping a residual force of 8,000 to 12,000 troops after 2014.
The Obama administration has been discussing keeping 3,000 to 9,000 US troops as part of this force.
Even if the Loya Jirga approves the bilateral security agreement, it will still have to be passed by the Afghan parliament.
The Taliban branded the meeting a US-designed plot, and vowed to pursue and punish its delegates as traitors if they approve it.