KABUL, Afghanistan — Months of fraught negotiations and public posturing over how a long-term American military force could remain in Afghanistan have suddenly come down to a demand for a single personal gesture: a display of contrition by President Obama for military mistakes that have hurt Afghans.

Afghan officials said Tuesday that in return for such a letter from Mr. Obama, President Hamid Karzai would end his vehement opposition to American counterterrorism raids on private Afghan homes — one of the most contentious issues between allies over a costly dozen-year war — clearing the way for an agreement to keep a smaller American troop force in the country past the 2014 withdrawal deadline.

As described by Mr. Karzai’s spokesman, Aimal Faizi, the letter would be tantamount to an apology, though he did not use that word. But not even that would be enough to ensure the final passage of a security agreement the United States had pressed to have in hand before next year. The Afghans have made final approval subject to an Afghan grand council of elders, a loya jirga, that is to begin meeting on Thursday, and aspects of the security deal remain deeply unpopular with the public.

The White House spokesman, Jay Carney, would not confirm details on Tuesday, but he nodded to the potential deal-breaking potential of the meeting. “There are ongoing negotiations,” he said. “I would simply say this agreement is not reached until it goes through the loya jirga.”