London CNN  — 

Britain’s ambassador to the United States, Kim Darroch, has resigned after a series of leaked diplomatic cables revealed he had told 10 Downing Street that the Trump administration was “inept” and “clumsy.”

The resignation, announced by the UK Foreign Office on Wednesday, came after US President Donald Trump said Monday that the White House would no longer deal with Darroch.

The ambassador made his decision to step down after seeing that Boris Johnson, the current frontrunner to replace Theresa May as British Prime Minister, had refused to support him during Tuesday night’s leadership debate, a British government official confirmed to CNN.

CNN has reached out to sources close to Darroch for comment, but has not had a response.

Foreign Office minister Alan Duncan told the BBC on Wednesday that Johnson had thrown the former ambassador “under the bus” by refusing to back him.

Boris Johnson and Jeremy Hunt participated in a Conservative Leadership televised debate on Wednesday night.

In a letter to Simon McDonald, the permanent under secretary at the Foreign and Commonwealth Office, Darroch said he wanted to “put an end to speculation” about his position and the remainder of his term as ambassador.

“The current situation is making it impossible for me to carry out my role as I would like,” he wrote. “Although my posting is not due to end until the end of this year, I believe in the current circumstances the responsible course is to allow the appointment of a new ambassador.”

In the cables, leaked to the Daily Mail newspaper, Darroch warned the UK government that Trump’s “career could end in disgrace,” and described conflicts within the White House as “knife fights.”

Darroch’s resignation accepted with ‘regret’

UK Prime Minister Theresa May said Wednesday it was a “matter of great regret” that Darroch had felt it necessary to resign and that the government owed him an “enormous debt of gratitude.”

“Good government depends on public servants being able to give full and frank advice,” May told the House of Commons during Prime Minister’s Questions.

“I want all our public servants to have the confidence to be able to do that. And I hope the house will reflect on the importance of defending our values and principles — particularly when they are under pressure.”

In response to Darroch’s letter, McDonald said he accepted the ambassador’s resignation “with deep personal regret.”

“Over the last few difficult days you have behaved as you have always behaved over a long and distinguished career, with dignity, professionalism and class,” McDonald wrote. “The Prime Minister, Foreign Secretary and whole of the public service have stood with you: you were the target of a malicious leak; you were simply doing your job.”

British officials spent the weekend in damage control mode after the messages were leaked, as their White House counterparts downplayed Darroch’s comments.

Speaking after Darroch’s resignation, Johnson said he hoped whoever had leaked the cables “is run down, caught and eviscerated.”

“It is not right that advice to ministers – that civil servants must be able to make in a spirit of freedom – should be leaked,” Johnson told Sky News.

Meanwhile shadow Foreign Secretary Emily Thornberry from the UK’s main opposition party said Trump’s “tantrums” and Johnson’s “pathetic lick-spittle response,” is something that “shames our country.”

“It makes a laughing stock out of our government and tells everyone of Britain’s brilliant representatives abroad that the next Tory prime minister will not stand up for them, even when they are simply telling the truth and doing their job,” Thornberry said in a Labour Party statement Wednesday, which was shared with CNN.

“Sir Kim Darroch should hold his head high for the wonderful job he has done representing our country, while Boris Johnson should go and hang his head in shame,” she added.

Trump’s Twitter attack on Darroch

In a series of tweets on Tuesday, Trump branded Darroch a “wacky” and “very stupid guy.”

“The wacky Ambassador that the U.K. foisted upon the United States is not someone we are thrilled with, a very stupid guy,” the President wrote. He also took aim at May, describing the Prime Minister’s handling of Brexit as “a disaster!”

Following the leak, Darroch was dis-invited from a dinner with Trump, the Emir of Qatar and Treasury Secretary Steven Mnuchin on Monday night. The ambassador also pulled out of a meeting between Ivanka Trump and UK International Trade Secretary Liam Fox on Tuesday.

UK Foreign Secretary Jeremy Hunt, who is standing against Boris Johnson for the leadership of the Conservative party, tweeted Wednesday that he “profoundly” regretted how an “outrageous leak” had caused Darroch’s resignation.

On Tuesday Hunt called Trump’s comments hypocritical and said he would keep Darroch in his post if he became Britain’s leader.

“Friends speak frankly so I will: these comments are disrespectful and wrong to our Prime Minister and my country. Your diplomats give their private opinions to [Secretary of State Mike Pompeo] and so do ours!” Hunt tweeted.

CNN’s Luke McGee, Flo Davey-Attlee, Duarte Mendonca, Zahid Mahmood, Steve Forrest and Sarah Dean contributed reporting.