Eager to overcome a bout of bickering, U.S. Secretary of State John Kerry and Afghan President Hamid Karzai made a show of unusual unity between their two nations on Monday. The friendly display came as the U.S. military ceded control of its last detention facility in Afghanistan, ending a longstanding irritant in relations.

Mr. Kerry arrived in the Afghan capital of Kabul on an unannounced visit amid concerns that Mr. Karzai may be jeopardizing progress in the war against extremism with anti-American rhetoric. After a private meeting, Mr. Kerry said he and Mr. Karzai were “on the same page” on security and reconciliation issues and brushed aside suggestions that relations were in peril.

Mr. Karzai infuriated U.S. officials earlier this month by accusing Washington of colluding with Taliban insurgents to keep Afghanistan weak even as the Obama administration pressed ahead with plans to hand off security responsibility to Afghan forces and end NATO’s combat mission by the end of next year.

At a joint news conference after their talks, Mr. Karzai told reporters that his comments in a nationally televised speech had been misinterpreted by the media. Kerry demurred on that point but said people sometimes say things in public that reflect ideas they have heard from others but don’t necessarily agree with.

“I am confident the president (Karzai) does not believe the U.S. has any interest except to see the Taliban come to the table to make peace and that we are completely cooperative with the government of Afghanistan with respect to the protection of their efforts and their people,” Mr. Kerry said. He noted that he had specifically raised the comment in question with Mr. Karzai and was satisfied with the response.

“We’re on the same page,” Mr. Kerry said. “I don’t think there is any disagreement between us and I am very, very comfortable with the president’s explanation.”

For his part, Mr. Karzai said that he had been trying to make the point in his speech that if the Taliban really wanted foreign troops out of Afghanistan they should stop killing people.

In the March 9 speech, he berated the Taliban for deadly bombings in Kabul and the city of Khost that he said “showed that they are at the service of America and at the service of this phrase- 2014,” the withdrawal date set for most international forces.

Standing beside Mr. Kerry on Monday, Mr. Karzai said “today was a very good day,” citing the turnover of the detention facility at the U.S.-run Bagram military base north of Kabul. He also expressed gratitude for the sacrifices made for his country by Americans.

At the same time, he defended allegations he has made about American troops or their local contractors abusing Afghan civilians. He said his complaints and criticism were not meant to “offend” anyone but rather to protect his people.

“When I say something publicly, it is not meant to offend our allies but to correct the situation,” he said. “I am responsible for the protection of the Afghan people. I am the president of this country. It is my job to provide all the protection I can to the people of this country.”

Mr. Karzai has ordered U.S. special operations forces out of Wardak province, just outside Kabul, because of allegations that Afghans working with the commandos were involved in abusive behaviour.

Mr. Kerry and Mr. Karzai’s news conference came near the beginning of Kerry’s 24-hour visit to the country his sixth since President Barack Obama took office but his first as Obama’s secretary of state.

More In: World | International | News