KABUL, Afghanistan – Afghan officials said Tuesday that President Hamid Karzai would clear the way for a long-term security pact with the United States after receiving assurances that President Obama would issue a contrite letter acknowledging U.S. military mistakes in Afghanistan and vowing not to repeat them.

Karzai’s spokesman, Aimal Faizi, said that, in return for the letter, the Afghan leader would change course and accept wording allowing U.S.-led raids on Afghan homes under “extraordinary circumstances” to save the lives of U.S. soldiers. Just two days earlier, Afghan officials had said that the issue had effectively stalemated talks over a broader bilateral security agreement, which would establish a framework for the continued presence of U.S. troops in Afghanistan after the current 2014 deadline for Western troop withdrawal.

The Afghans said that the breakthrough had come during a phone call by U.S. Secretary of State John F. Kerry to Karzai on Tuesday. Kerry initially offered to write the letter, and Karzai said he would compromise if Obama sent it instead – a stipulation to which Kerry agreed, according to Faizi.

A spokesman for the U.S. Embassy, Robert Hilton, would not comment on details of the negotiations. And the White House spokesman, Jay Carney, would not comment on whether Obama had agreed to such terms.

Even if both sides agree on a final wording for the security deal, the Afghans have made their final approval contingent on a vote this week by a loya jirga – a grand council of Afghan elders. Any wording allowing raids on Afghan homes is likely to be met negatively at the meeting, given the deep outrage such missions have caused for years. But Faizi said that such a letter from Obama would help win critics over.

Carney nodded to the council’s potential deal-breaker role in his comments Tuesday. “There are ongoing negotiations,” he said. “I would simply say this agreement is not reached until it goes through the loya jirga.”

U.S. commanders have insisted that home raids are critical to the fight against al-Qaida and similar extremists hiding in Afghanistan. But such raids are deeply offensive to the Afghan public, and Karzai has long insisted that only Afghan forces be allowed to conduct them.

Faizi made it clear that the Afghans had a very detailed understanding of what they expected a letter from Obama to say, and that without this, there would be no deal.

The letter would clarify exactly what was meant by “extraordinary circumstances” justifying home raids, and go beyond that, as well. “The idea was to indeed mention that there were mistakes made in the conduct of military operations in the past, in the conduct of military operations by United States forces in the last decade, and that Afghans have suffered, and that we understand the pain and therefore we give assurances and make sure those mistakes are not repeated,” Faizi said, summarizing what Karzai expected Obama to say in the letter.

While Faizi declined to characterize that as a letter of apology, many would likely view it that way, and it was unclear how far Obama would be willing to go to provide a letter that would satisy Karzai’s demands.