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

Memos from Kim Darroch in which he described the Trump administration as inept were leaked to a British Sunday newspaper, infuriating the U.S. president, who launched a Twitter attack on both the envoy and outgoing British Prime Minister Theresa May, who had given Darroch her full support.

As the spat between the two close allies intensified, Trump said he would no longer deal with the “very stupid” Darroch and called May “foolish”.

Darroch said his position had become untenable, but supporters blamed Johnson, the former London mayor who could take over from May later this month, for refusing to back him.

“Since the leak of official documents from this Embassy there has been a great deal of speculation surrounding my position and the duration of my remaining term as ambassador,” said Darroch, who was due to step down at the end of the year.

“I want to put an end to that speculation. The current situation is making it impossible for me to carry out my role as I would like.”

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

“CLUMSY AND INEPT”

“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 U.S. 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”.

Britain prides itself on its “special relationship” with its closest ally and Trump himself described it as “the greatest alliance the world has ever known” during a lavish state visit last month.

That relationship is of particular importance to London now, as it hopes to strike a major trade deal with Washington as one of the upsides of leaving the European Union, a departure currently scheduled for Oct. 31.

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

Trump himself had previously suggested that Nigel Farage, now leader of Britain’s Brexit Party, would be a good choice as ambassador, irritating British officials.

While May said the government did not share Darroch’s views of the Trump administration, she said British ambassadors should have the freedom to give frank assessments.

“I have told him it is a matter of great regret that he has felt it necessary to leave his position as ambassador to Washington,” she told parliament. “The whole cabinet rightly gave its full support to Sir Kim on Tuesday.”

FILE PHOTO - Britain's ambassador to the United States Kim Darroch (R) arrives as then White House Chief Strategist Steve Bannon greets guests prior to a joint news conference between U.S. President Donald Trump and British Prime Minister Theresa May at the White House in Washington, U.S., January 27, 2017. REUTERS/Carlos Barria

“CONTEMPTIBLE DISREGARD”

Foreign minister Jeremy Hunt, the other contender for May’s job, had said in a televised debate on Tuesday evening that Darroch should keep his job. But frontrunner Johnson, who has promised Britain will leave the EU with or without a deal by Halloween, pointedly declined to do so.

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”.

But there was anger among many British politicians that Darroch had been forced out, said junior foreign minister Alan Duncan, who blamed Johnson.

“He has basically thrown this fantastic diplomat under the bus to serve his own personal interests,” he told BBC TV.

“His sort of disregard for Sir Kim Darroch and his refusal to back him was, in my view, pretty contemptible, but also not in the interests of the country he is trying to lead.”

An inquiry is under way into who leaked the memos. The head of Britain’s diplomatic service, Simon McDonald, said it was the worst breach of trust he had seen in his career.

He said it was unprecedented for a head of state, friendly or hostile, to refuse to work with British ambassadors, and the last time there had been a problem with an envoy to the United States was in 1856.

“It appears that the British envoy to the United States has been removed according to the wishes of a foreign potentate,” Tom Tugendhat, chairman of parliament’s Foreign Affairs Committee, told Sky TV.