London: Britain's ambassador to the US, Kim Darroch, resigned on Wednesday amid an escalating diplomatic row over leaked emails in which he described President Donald Trump's administration as "clumsy" and "inept".

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

Trump had branded Darroch a "very stupid guy" after emails emerged where the ambassador had called his administration "clumsy and inept".

Darroch said he wanted to put an end to speculation and step down as the leak had made it "impossible" for him to do his job in Washington.

"Since the leak of official documents from this embassy there has given rise to a great deal of speculation surrounding my position and the duration of my remaining term as ambassador, I want to put an end to that speculation," he said in his resignation letter addressed to Simon McDonald, the senior-most official at the UK foreign office and head of the diplomatic service.

"The current situation is making it impossible for me to carry out my role as I would like," he said.

Following the leak, Darroch was dis-invited from a dinner with Trump, the Emir of Qatar on Monday. 

British Prime Minister Theresa May said Darroch's departure was "a matter of deep regret" after the ambassador said it was "impossible" for him to continue. May told MPs in the House of Commons that the ambassador had the full backing of the Cabinet and had given a "lifetime of service" to the UK, for which he was owed an "enormous debt of gratitude''.

"Good government depends on public servants being able to give full and frank advice", she said.

May, the outgoing Prime Minister, spoke of the importance of "defending our values and principles, particularly when they are under pressure".

The ambassador's resignation comes after a series of diplomatic messages sent by him were leaked recently.

In his reply, McDonald said Darroch had been the target of "a malicious leak" and expressed gratitude for his work. "You are the best of us," he said.

The outgoing diplomat, who was set to retire at the end of the year, also received the backing of foreign secretary Jeremy Hunt, currently in the midst of a leadership contest with Boris Johnson to replace May.

Hunt said he was "deeply saddened" by Darroch's decision to resign after serving the UK with the “utmost dedication and distinction”.

"He brought dispassionate insight and directness to his reporting to ministers in London. Whenever I visited Washington as foreign secretary, I was struck by Sir Kim's professionalism and intellect. I am outraged that a selection of his reports should have been leaked," said Hunt, who had earlier taken to Twitter to admonish Trump over his very personal attacks on Theresa May and Darroch in the wake of the email leak row.

"@realDonaldTrump friends speak frankly so I will: these comments are disrespectful and wrong to our Prime Minister and my country," Hunt tweeted on Tuesday, reacting to Trump's attack on May for handling Brexit in a “foolish way”.

Darroch received widespread backing across party lines in the UK, with labour leader Jeremy Corbyn telling the Commons: "The comments made about him are beyond unfair and wrong. I think he has given honourable and good service and he should be thanked for it."

During a television hustings debate with Hunt on Tuesday night, Johnson appeared not to offer his full backing to the diplomat as he refused to say whether he would keep him in the post if he became Prime Minister.

Following the resignation, he expressed regret, describing Darroch as a "superb diplomat and I worked with him for many years".

The leaked emails, dating from 2017, said rumours of "infighting and chaos" in the White House were mostly true and that Trump presided over a “diplomatically clumsy” administration.

Trump reacted with a series of attacks on Twitter, branding Darroch a “very stupid man” and disinviting him from a White House event on Monday night.

He said, "The wacky ambassador that the UK foisted upon the United States is not someone we are thrilled with, a very stupid guy. He should speak to his country, and Prime Minister May, about their failed Brexit negotiation, and not be upset with my criticism of how badly it was handled.”