The diplomat announced his departure, saying his job had become “impossible” after his savaging by the US president.
But it is understood he made the decision while watching Tuesday night’s Tory leadership debate, in which Mr Johnson – the man widely expected to win and become PM – repeatedly declined to rule out replacing him.
Politicians also turned on Mr Johnson’s role in the resignation, Alan Duncan – a junior foreign office minister – describing his behaviour as “contemptible”.
“Boris Johnson has basically thrown our ambassador under a bus,” he told the BBC.
Patrick McLoughlin, a former Tory chair and supporter of Jeremy Hunt, turned on his rival, saying: “It is unedifying to see someone who wants to be PM failing to stand up for hard-working civil servants, who have done nothing wrong, under attack from foreign governments. Leadership involves standing up for your team.”
Asked about his failure to support Sir Kim during a campaign visit to a pub in London today, Mr Johnson said: “On the contrary, my view is it’s wrong to drag civil servants into the political arena.”
And Tom Tugendhat, the Tory chair of the Commons Foreign Affairs Committee, said: “Leaders stand up for their men. They encourage them to try and defend them when they fail.
“If the UK can’t protect diplomatic communications and that costs people their careers when all they’ve done is to execute the wishes of the government we will degrade the quality of our envoys, diminish our influence and weaken our country,” he said.
A spokesperson for Labour leader Jeremy Corbyn said it appeared that Mr Johnson’s failure to offer the ambassador his support was “the final straw” which pushed him to resign.
“If that’s the case, I think it is clear that Boris Johnson is effectively behaving as Donald Trump’s patsy and he is doing that because he is banking on a sweetheart trade deal and is putting himself in hock to the US president,” said the Labour spokesperson.
“It is clear that he is not prepared to stand up to Donald Trump and won’t stand up for Britain and that is clearly the result of a policy on Brexit that is putting the country at risk of a no-deal exit from the EU and forcing us into a race to the bottom.”
The shadow foreign secretary Emily Thornberry said: “The fact that Sir Kim has been bullied out of his job, because of Donald Trump’s tantrums and Boris Johnson’s pathetic lick-spittle response, is something that shames our country. It makes a laughing-stock out of our government, and tells every one 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.
“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. He 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.”
Sir Alan Duncan called on Theresa May to appoint the next US ambassador, to take the decision out of Mr Johnson’s hands, saying it should be made “the sooner the better”.
And Anthony Gardner, a former UK ambassador to the EU, attacked Brexiteers who mad plunged Britain into “living during a religious war”.
“The real news about the Kim Darroch saga is not even the unacceptable comments from Trump but the effort of insiders to remove a senior civil servant who favours Remain,” he tweeted.
“We are truly living during a religious war. Decency goes out the window and there is no sense of outrage.”
However, Mr Johnson, speaking on a visit to a London pub, blamed the leaker for the resignation, saying he hoped he was “run down, caught and eviscerated”.
“Whoever leaked his diptels [diplomatic telegrams] has done a grave disservice to our civil servants,” he said, adding Sir Kim is a “superb diplomat”.
Sir Kim said in a statement announcing his departure: “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.”
The prime minister’s spokesman declined to say whether she had tried to persuade Sir Kim to stay, or whether the ambassador had mentioned Mr Johnson’s comments in last night’s TV debate, saying it was a “private conversation”.
He was unable to set out the timetable for the appointment of a successor, or say whether it would be completed by the time Ms May leaves office on 24 July.
Downing Street said “initial discussions” had taken place with the police regarding the Whitehall investigation into the source of the leak.
“If there was concern about criminal activity, the police would become involved more formally at that point,” a No 10 spokeswoman said.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies