KABUL — Secretary of State John Kerry and President Hamid Karzai of Afghanistan smoothed over one of the worst patches in the difficult relationship between the United States and Afghanistan with a compromise Monday that settles — for now — a bitter dispute over the fate of Taliban prisoners deemed a threat to US forces.
Earlier Monday, the US military ceded control of the Parwan detention center near the Bagram military base north of Kabul, a year after the two sides agreed to transfer all prisoners to Afghan government control.
The transfer of Parwan, the last US-controlled jail in the country, is symbolic of the larger tension as US forces depart from Afghanistan after 13 years. The departing troops will leave behind a fragile democracy with untested ability to defend itself or safeguard the political and economic gains underwritten by billions in US spending.
With a self-imposed deadline of December 2014 for American combat forces to leave Afghanistan, the Obama administration is trying to shape a less volatile relationship with Karzai while insisting on a clean election next year to replace him.
Kerry and Karzai said Monday they had helpful discussions about the prospect of reconciliation with the Taliban, but gave few specifics beyond saying that both the United States and Afghanistan have just one motive in talking with the militants: to bring them to the peace table.
Kerry put his long friendship with Karzai on full display Monday, praising him for courage and endurance while Karzai repeatedly thanked Kerry and other American officials for sticking by him.
‘‘You, I think, stand on the brink of a remarkable legacy for having brought Afghanistan through an amazingly difficult time,’’ Kerry told Karzai. ‘‘There are still difficulties ahead; there are still challenges.’’
Kerry knows the unpredictable Afghan leader well and was a frequent intermediary for President Obama while serving in the Senate before becoming secretary of state last month.
The two nations are trying to sort out difficult issues that often pit US goals for the security of its forces and American interests against Karzai’s keen sense of national sovereignty. The largest of these issues remains open: whether any US forces that remain in the country for training and counterterrorism operations after 2014 would be immune from prosecution under Afghan law.
US officials say that protection is essential for a long-term joint security agreement, but it will be a hard sell to Afghans. The same dispute sank a hoped-for security agreement that would have left a training and stability force in Iraq.
Washington says it would be foolish to think the process of separating US and Afghan control will be smooth, and some of Karzai’s recent statements are Exhibit A.
The new defense secretary, Chuck Hagel, canceled a news conference with Karzai earlier this month after Karzai was widely quoted accusing the Obama administration of colluding with the Taliban insurgency that has tried to overthrow him for a decade. The remark angered US officials and many in Congress.
Kerry and others have assured Karzai that direct talks between the United States and the Taliban remain on hold, and Karzai claimed Monday that his complaint had been misunderstood.
Karzai attempted to put into context some of his recent inflammatory remarks, particularly his accusation that US troops had tortured civilians outside Kabul.
‘‘When I say something to this effect, it’s not to offend our allies but to correct the offense,’’ Karzai said. ‘‘I am the president of this country. It’s my job to provide all the protection I can’’ for Afghans.
Kerry seemed ready to let the matter slide.
‘‘I am confident that the president absolutely does not believe the United States has any interest except to see the Taliban come to the table to make peace,’’ while helping Afghanistan defend itself, he said at their press conference.
Kerry focused largely on his appreciation of the US contribution in Afghanistan. With the handover of the Parwan detention center and the US announcement last week that troops would be gradually removed from Wardak province, it appears that Karzai’s most vehement demands have had an impact.
Details of the prison transfer deal were scant, such as whether the United States would maintain veto power over the release of 30 to 40 ‘‘enduring security threats,’’ who American officials say still pose a serious danger to US and Afghan troops.
‘‘It is important for the people of Afghanistan,’’ Karzai said of the prison, which has been a symbol of sometimes heavy-handed US military control.
It is unclear whether the US mechanism of ‘‘administrative detention,’’ under which some detainees remain in custody without trial, would be continued under Afghan control.