KABUL, Afghanistan -- After more than a week of hard-line posturing by Afghan and American officials, Secretary of State John Kerry and President Hamid Karzai defied expectations and agreed on key elements of a deal that, if completed, would keep American troops in Afghanistan beyond next year.
Making the announcement on Saturday evening after nearly 24 hours of talks and meetings, Mr. Kerry and Mr. Karzai said one major issue remained -- legal jurisdiction, or immunity from prosecution under Afghan law, for American troops who remain in Afghanistan after 2014.
Immunity is a deal-breaking issue for the United States. The Iraqi government's refusal to grant the same immunity was what forced American troops to withdraw from Iraq two years ago. Mr. Karzai suggested on Saturday that he, too, was uncomfortable with it, saying as he stood alongside Mr. Kerry that "we don't have a single view of judicial immunity for foreign forces."
The matter, though, was ultimately beyond the authority of the government to decide, he said, and instead must be decided by "the Afghan people." By that, he meant a loya jirga -- a traditional gathering of elders and other powerful people -- that the Afghan government is organizing in the coming weeks to approve the entire deal, known as a bilateral security agreement. It would then go before Parliament, Mr. Karzai said.
Those steps are not insignificant, and American officials carefully avoided saying that they had secured the deal or that it was now a matter of deciding how many troops would stay in Afghanistan after next year, not whether any would remain at all.
Rather, Mr. Kerry said at the joint news conference that it was now a matter of letting the Afghan political process play out.
Mr. Karzai also gave some American officials reason for pause. He said that he had not yet examined some of the "several small issues" in the security agreement, and that in the coming days he would "look at its small issues and technical points, too, which I did not look at."
As one American official put it, "If he wakes up feeling differently, we're going to have a big problem."
Saturday's marathon negotiating session in Kabul, which began around midmorning and continued until well after dark, was a dramatic turn in talks that only a day earlier had been deadlocked. Officials on both sides had been saying there was a distinct possibility of a complete American withdrawal when the NATO combat mission here concluded at the end of 2014.
When Mr. Kerry arrived in Kabul late Friday on a previously unannounced visit aimed at breaking the impasse, Western diplomats here put his odds of reaching a deal at 50-50, at best.
Their skepticism was not without reason. The Obama administration had set an Oct. 31 deadline for wrapping up the talks, which had been going on for nearly a year, and officials had begun threatening to start moving toward a complete withdrawal. The administration had also decided just over a week ago not to send Mr. Kerry to Kabul, believing his chances of success were slim.
But Mr. Kerry spoke to Mr. Karzai on Oct. 5, Afghan and American officials said, and at the end of the call he believed that he could revive the talks by coming to Kabul.
He arrived late Friday afternoon, and by Saturday night, senior Afghan and American officials were crediting him with turning the situation around. Many said it was Mr. Kerry's relatively warm relationship with Mr. Karzai, a rarity for any American official these days, that made the difference.
Mr. Karzai had been skeptical of American statements that the best offer the United States could make was on the table, according to a senior Afghan official. But Mr. Kerry's assurances that it truly was, and some apparent compromising on both sides, helped break the deadlock.
Neither Mr. Kerry nor Mr. Karzai provided details of what exactly had been agreed to, and it was not clear how they forged a compromise on an Afghan demand that the United States guarantee Afghanistan's security as it would if the country were a NATO ally. That could compel the United States to send troops on raids into Pakistan, an ally of Washington and a nuclear-armed power.
Afghan officials had said that demand was crucial to the country's sovereignty and must be met. The Obama administration had said it would not consider making any such guarantee.
On the other main sticking point, the outlines of a compromise seemed clearer. Mr. Karzai had refused to allow American forces to hunt for operatives of Al Qaeda here on their own. Instead, he wanted any intelligence gathered by the United States handed over to Afghan forces, who could then conduct the raids on their own.
On Saturday, Mr. Karzai said he had been assured that American forces would not conduct any unilateral operations in Afghanistan after next year, leaving open the possibility that raids against Al Qaeda would be conducted jointly with Afghan forces.
The issue of immunity, however, was one the White House thought had been resolved, so it was surprising to find it resurrected. Mr. Kerry stressed that what the United States sought was the same arrangement it had with every country in the world where its troops are stationed, including Japan and Germany. There would be no immunity for American soldiers who commit crimes, he said, and they would face justice in the United States.
Despite the warm words Mr. Kerry and Mr. Karzai had for each other, and for each other's countries, on Saturday, it was clear that many points of contention still existed in the relationship.
The most immediate one was the recent seizure by American forces of a senior Pakistani Taliban leader, Latif Mehsud, who is now believed to be in American custody at Bagram Air Base, north of Kabul.
Afghan officials said Mr. Mehsud was effectively a double agent for the Afghan intelligence services, feeding them information on insurgent activities. They said American forces had seized Mr. Mehsud at gunpoint from a convoy of Afghan intelligence agents who were taking him to meetings in Kabul.
Mr. Karzai said on Saturday that the seizure of Mr. Mehsud was a clear violation of Afghanistan's sovereignty, and that the deal he and Mr. Kerry had made would, ideally, prevent such episodes in the future.
American officials have said Mr. Mehsud was handed over at their request, and Mr. Kerry on Saturday called him a "dangerous terrorist" who had been involved in plots to attack the United States.
This article originally appeared in The New York Times. First Published October 12, 2013 2:01 PM