WASHINGTON — Republican presidential candidate Mitt Romney and other party leaders on Sunday sharply criticised President Barack Obama’s handling of the war in Afghanistan, accusing him of mismanaging the military campaign and relations with the country’s president, Hamid Karzai.

the attacks from the right came as the administration was struggling to contain the fallout from a massacre of 16 villagers, many of them women and children, by a US soldier who allegedly went on a rampage March 11 in southern Afghanistan.

The White House said Obama and the Afghan leader reaffirmed their commitment to the 2014 withdrawal plan in a phone call Friday.

But Karzai’s warning that he was “at the end of the rope” and public demands for an earlier pullback of US troops to their bases underscored the yawning divide between the allies at a time of sharply declining public support for the 10-year-old war in the United States.

US relations with Mr. Karzai are now badly strained.

Romney told Fox News Sunday that Obama undercut the war effort, and relations with Karzai, by publicly setting out timetables for when the US would scale back its combat role in Afghanistan and for when it will complete the withdrawal of most American forces.

“This is leading Mr. Karzai to take action that’s self-preservation in nature,” Romney said. Obama “needs to be more engaged and interacting with not only our commanders there but also with leadership in Afghanistan.”

Romney said that if he became president, he would work more closely with Karzai and consult with him “day to day,” in contrast with Obama, who has had more limited contact with the Afghan leader.

US officials say Mr. Karzai’s behaviour has, at times, been erratic and complain that he has been slow to combat corruption.

Romney hasn’t called for accelerating the drawdown of the nearly 90,000 US troops now in Afghanistan, in contrast to some of his Republican rivals for the White House.

“I think it’s very plain to see that the conditions there [in Afghanistan] are not going very well,” Mr. Romney told Fox. “And I lay part of the blame for that on the lack of leadership on the part of our president, both in terms of his interaction with Karzai, with leaders there, as well as his relative detachment from our military commanders there, and the fact that he published a specific date for our withdrawal.”

Republican Sen. John McCain of Arizona echoed Romney’s criticism of the president. He said the military campaign in Afghanistan was “succeeding” but what Mr. Obama “keeps talking about is how quick we’re going to withdraw.”

“So put yourself in President Karzai’s place,” McCain told NBC’s “Meet the Press.”

“President Karzai has ambitions to stay there. One of his predecessors ended up being hung from a lamppost in Kabul. So instead of saying we’re going to win this war … all we hear about is plans for withdrawal.”

Last week, Obama formally announced plans for the US and its allies to shift to a train, advise and assist mission in Afghanistan in 2013. Mr. Obama has brushed aside calls for accelerating the troop drawdown, scheduled to be completed by the end of 2014.

US officials have defended their investigation into last week’s shooting rampage and dispute charges by Karzai that Washington officials have thwarted an Afghan investigation.

US officials say they believe Karzai’s harsher-than-usual criticism of the US was directed at domestic audiences outraged by the conduct of US forces. They have played down the implications of the rift with Karzai on US war strategy.

Afghanistan’s ambassador to the US, Eklil Hakimi, told CNN’s “State of the Union” that Karzai attaches “great importance” to his partnership with the US and the international community.

“Our president is doing whatever any legitimate president would do: he is reflecting, somehow, whatever our people are saying. The situation there, especially with these very tragic incidents, is not that easy,” the ambassador said.”We do trust the US We do know how important this relationship is and we are working as a partner to resolve all the issues.”