Kim Darroch. Photo: Riccardo Savi/Getty Images

Britain’s ambassador to Washington quit on Wednesday after days of stinging criticism from Donald Trump, leading to accusations that Boris Johnson, the favourite to be the next British prime minister, had “thrown him under the bus”.

Memos from Sir Kim Darroch describing the Trump administration as inept were leaked to a British newspaper, infuriating the US president, who launched a Twitter attack on both the envoy and outgoing prime minister Theresa May, who had given Darroch her full support.

As a spat between the two allies intensified, Trump said he would sever ties with the “very stupid” Darroch and called May “foolish”.

Darroch said his position had become untenable.

The BBC’s diplomatic correspondent said the ambassador had made the decision after Johnson declined to back him in a televised debate on Tuesday night. The former London mayor could become prime minister later this month if grassroots Conservatives elect him party leader.

“He has basically thrown this fantastic diplomat under the bus to serve his own personal interests,” said junior foreign minister Alan Duncan. “His sort of disregard for Sir Kim Darroch and his refusal to back him was, in my view, pretty contemptible.”

In confidential memos dating from 2017 to the present, Darroch, 65, had said reports of in-fighting in the White House were “mostly true”. Last month, he described confusion within the administration over Trump’s decision to call off a military strike on Iran.

“We don’t really believe this Administration is going to become substantially more normal; less dysfunctional; less unpredictable; less faction-riven; less diplomatically clumsy and inept,” Darroch wrote in one cable.

It led to a scathing tirade from the US president.

“The wacky Ambassador that the UK foisted upon the United States is not someone we are thrilled with, a very stupid guy,” he tweeted, describing Darroch as a “pompous fool”.

Darroch had been due to step down at the end of the year.

“Since the leak of official documents from this Embassy there has been a great deal of speculation surrounding my position,” he said. “The current situation is making it impossible for me to carry out my role as I would like.”

An inquiry is under way into who leaked the memos, and why.

Darroch, a career diplomat who was previously Britain’s envoy to the EU, had been accused by some Brexit supporters of being biased towards the bloc.

May said the government did not share Darroch’s views of the Trump administration, but that British ambassadors should have the freedom to give frank assessments, and that it was a matter of great regret that he had felt he had to quit.

During a campaign visit on Wednesday, Johnson, who was himself foreign minister until a year ago, called Darroch “a superb diplomat”, adding that whoever leaked the documents had “done a grave disservice to our civil servants”.

The main opposition Labour Party said Darroch had been bullied out by Trump and because of Johnson’s “pathetic lickspittle response”.

“It makes a laughing stock out of our government,” said Emily Thornberry, Labour’s foreign affairs spokeswoman. “(Johnson) claims to regard Winston Churchill as his hero. But just imagine Churchill allowing this humiliating, servile, sycophantic indulgence of the American president’s ego to go unchallenged.”