US Secretary of State John Kerry (L) and Afghanistan's President Hamid Karzai shake hands in Kabul, on March 25, 2013
US Secretary of State John Kerry made an unannounced visit to Kabul on Monday and vowed to stick by Afghanistan despite President Hamid Karzai's hostility to US-led military efforts in the country.
Kerry's visit came after Karzai launched a series of verbal assaults on US troops and their coalition partners who are withdrawing after more than a decade fighting alongside the Kabul government against Taliban militants.
Earlier this month, the Afghan president accused the US of working in concert with the Taliban and his spokesman described the coalition's war effort as "aimless and unwise", triggering fury from Afghanistan's foreign backers.
"The US is committed to an enduring partnership... The US supports a strong and united Afghanistan," Kerry said at a press conference in Kabul.
"We are committed to Afghanistan's sovereignty and we will not let Al-Qaeda or the Taliban shake this commitment."
Responding to the storm of protest over Karzai's collusion allegations, Kerry said he was confident Karzai "absolutely does not believe that the United States has any interest except to see the Taliban come to the table to make peace."
The drawn-out war is increasingly unpopular in the United States, and the latest outbursts from Karzai led many American commentators to call for Washington to take a tougher stance towards Kabul.
The Afghan leader in past weeks has also demanded US special forces leave the key province of Wardak and banned international troops from university campuses, both due to unproven harassment claims.
But Karzai appeared keen to repair damaged ties, denying he accused the US of colluding with the Taliban and welcoming Monday's handover of Bagram prison from the US to Afghan control -- one of the running sores in the relationship.
"I was interpreted as saying the US and Taliban are colluding, but I did not use this word," he told reporters.
"Today was a good day for Afghanistan. Bagram prison was handed over to the Afghan government... Finally after many years of effort we have reached a deal."
The United States was long concerned that a total handover to Afghanistan's weak and corruption-prone security forces would allow suspected Taliban and Al-Qaeda militants housed at Bagram to return to the battlefield.
But a final agreement was sealed on Saturday, and a handover ceremony was held at the jail hours before Kerry landed in Kabul.
In September the United States gave Afghan authorities control over more than 3,000 detainees at Bagram, once dubbed the Guantanamo Bay of Afghanistan because some inmates are detained without trial or knowledge of any charges.
But the Americans continued to guard 50 foreigners not covered by the agreement, as well as hundreds of Afghans arrested since a transfer deal was first signed in March 2012.
Their extended control sparked repeated angry complaints from Karzai and a warning from Afghanistan's top Islamic body that the US military was coming to be seen as an "occupation" force as it battled the Taliban insurgency.
"US control of Bagram was a rallying cry for the Taliban and an important issue for much of the Afghan public," said Kate Clark of the Afghanistan Analysts Network.
"This looks like a victory for Karzai as he has got what he wanted. Bagram was a huge stumbling block before they get onto a long list of other issues to sort out -- and time is of the essence."
Afghan troops and police are gradually taking on responsibility for battling the Taliban as most of the 100,000 foreign troops prepare to exit by the end of 2014.
Karzai is due to step down at elections next year, 13 years after he came to power with US backing when the hardline Taliban regime was ousted in the aftermath of the September 11 attacks of 2001.
The military and political calendars are lending added urgency to the search for a negotiated settlement to resolve Afghanistan's decades of conflict.
Karzai plans to visit Qatar shortly to discuss the proposed opening of a Taliban office in the Gulf emirate as a prelude to possible peace talks.
"We with the US have agreed for the office to open in Qatar," Karzai said on Monday. "Those who come on behalf of the Taliban can talk and they have the right to talk to all Afghans."
But the Taliban refuse to communicate directly to Karzai, who they view as a puppet of the United States.
"The Taliban will hopefully understand that peace and peace talks are the best way to resolve differences," Kerry said.
US Secretary of State John Kerry (L) and Afghanistan's President Hamid Karzai shake hands at the end of their press conference at the Presidential Palace in Kabul on March 25, 2013. Kerry made an unannounced visit to Kabul on Monday and vowed to stick by Afghanistan despite Karzai's hostility to US-led military efforts in the country.
US Secretary of State John Kerry (R) is greeted by Afghan Foreign Minister Zalmai Rassoul (L) on his arrival prior to a meeting with Afghan President Hamid Karzai at the Presidential Palace in Kabul on March 25, 2013.