The UK ambassador to the US whose abrasive criticisms of President Trump triggered a mini-diplomatic crisis right in the middle of the Tory leadership contest to decide the next PM has resigned.

In an emailed statement, Kim Darroch resigned, saying the "current situation is making it impossible for me to carry out my role as I would like."

Kim Darroch

Here's the full text of his resignation letter:

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. 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. 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. I am grateful to all those in the UK and the US, who have offered their support during this difficult few days. This has brought home to me the depth of friendship and close ties between our two countries. I have been deeply touched. I am also grateful to all those with whom I have worked over the last four decades, particularly my team here in the US. The professionalism and integrity of the British civil service is the envy of the world. I will leave it full of confidence that its values remain in safe hands.

In a response to Darroch's letter, the head of the UK diplomatic service praised Darroch for doing his job with great dignity "as you always have" and blamed a "malicious leak" for undermining him.

On behalf of the diplomatic service, I accept your 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. 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. I understand your wish to relieve the pressure on your family and your colleagues at the embassy; I admire the fact that you think more of others than yourself. You demonstrate the essence of the values of British public service. I want to stress my deep appreciation for all you have done over the last four decades. In a series of demanding roles - including national security adviser and permanent representative to the European Union - you have loyally served the government of the day without fear or favour. We have been lucky to have you as a friend and colleague. You are the best of us.

The editor of HuffPost UK reported that Darroch decided to resign last night after Boris Johnson, who will likely be the UK's next prime minister, refused to defend him.

Colleagues of Kim Darroch tell me he decided last night that he had to quit - after he saw @BorisJohnson fail to stand up for him on #ITVDebate. — Paul Waugh (@paulwaugh) July 10, 2019

Then again, this fact is hardly surprising. According to Craig Murray, who shared his experiences with Darroch in an essay that we published last night, the now-former ambassador was notorious for his 'rude' and 'aggressive' mannerisms. Per Murray, Darroch's comments about Trump were hardly out of character.

Kim Darroch is a rude and aggressive person, who is not pleasant at all to his subordinates. He rose to prominence within the FCO under New Labour at a time when right wing, pro-Israel foreign policy views and support for the Iraq War were important assets to career progress, as was the adoption of a strange “laddish” culture led from No. 10 by Alastair Campbell, involving swearing, football shirts and pretending to be working class (Darroch was privately educated). Macho management was suddenly the thing. At a time when news management was the be all and end all for the Blair administration, Darroch was in charge of the FCO’s Media Department. I remember being astonished when, down the telephone, he called me “fucking stupid” for disagreeing with him on some minor policy matter. I had simply never come across that kind of aggression in the FCO before. People who worked directly for him had to put up with this kind of thing all the time.

PM Theresa May, who along with the UK diplomatic service backed Darroch during the controversy, said his resignation was "a matter of great regret" and added that public servants must be able to give "full, frank" advice.

Leaked cables from the embassy that were reported in the press revealed that Darroch had called Trump "inept" and "incompetent".

Trump tweeted after the leak that he would "no longer deal" with Darroch. Despite an apology, Trump ramped up his attacks on Darroch on Tuesday, calling him "wacky" and "incredibly stupid." Trump also seized the opportunity to take another shot at Theresa May and her Brexit deal which had been "a disaster!" according to Trump.

Now, will Johnson (assuming he does make it to No. 10 as expected) send Nigel Farage to replace Darroch, as Trump has requested?