LONDON (AP) — Britain’s ambassador to the United States resigned Wednesday, just days after diplomatic cables criticizing President Donald Trump caused embarrassment to two countries that often celebrate having a “special relationship.”

The resignation of Kim Darroch came after Trump lashed out at him on Twitter, describing the ambassador as “wacky” and a “pompous fool.” The criticism came after leaked documents revealed the envoy’s dim view of Trump’s administration, which he described as dysfunctional, inept and chaotic.

“Since the leak of official documents … there has been a great deal of speculation surrounding my position and the duration of my remaining term as ambassador,” Darroch said in his resignation letter. “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.”

Prime Minister Theresa May said the resignation was “a matter of regret,” underlining that “good government depends on public servants being able to give full and frank advice.”

Darroch had been set to retire at the end of the year. It’s unclear whether May will have time to replace Darroch before she leaves office later this month. Appointing ambassadors usually involves a formal civil service process with advertisements, applications and interviews, though Simon McDonald, head of Britain’s diplomatic service, said the post of ambassador to the U.S. wasn’t always chosen that way.

“History shows that there are often bespoke procedures for filling the embassy in Washington, DC,” he said.

Though the matter had been brewing for days, Darroch made his decision the morning after a debate between the two contenders to replace May as party leader and prime minister, Boris Johnson and Jeremy Hunt.

Hunt, who is Britain’s foreign secretary, had vowed to keep Darroch in the post, but Johnson pointedly did not.

“I think it’s very important we should have a close partnership, a close friendship with the United States,” Johnson said.

Darroch’s forthright, unfiltered views on the U.S. administration — meant for a limited audience and discreet review — appeared in leaked diplomatic documents that were published in Britain’s Mail on Sunday newspaper.

In the leaked documents, he called the Trump administration’s policy toward Iran “incoherent,” said the president might be indebted to “dodgy Russians” and raised doubts about whether the White House “will ever look competent.”

“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,” one missive said.

Trump responded with a combined criticism of Darroch fused with a broadside at May, chiding the British leader for failing to get her Brexit deal with the European Union through Parliament.

“I told @theresa_may how to do that deal, but she went her own foolish way-was unable to get it done. A disaster!” Trump tweeted Tuesday. “I don’t know the Ambassador but have been told he is a pompous fool.”

British officials are hunting for the culprit behind the leak, which was both an embarrassment to May’s government and a major breach of diplomatic security.

“We will pursue the culprit with all the means at our disposal,” McDonald, the Foreign Office chief, told a committee of lawmakers.

He said it was “vitally important” that ambassadors were able to speak candidly in private.

McDonald said it was too soon to say what the fallout would be from the leak.

“Nothing like this has ever happened before. There must be consequences. What they are in detail I can’t tell you this afternoon,” he said.

But he said the trans-Atlantic relationship was “so deep and so wide that it will withstand any individual squall.”

He also said he feared there might be more leaks to come.

Darroch has served as Britain’s envoy to Washington since 2016, and the cables cover a period from 2017 to recent weeks. He was a prominent figure in Washington and popular among Trump White House officials, who were always over at the embassy for parties and events.

Trump’s tweets caused fury among many British politicians and officials, who found themselves insulted by the president’s decision to have the administration cut off contact their ambassador. It underscored that the close relationship between the two countries has become increasingly lopsided — a severe problem at a time the country is preparing to set out a new path with its departure from the European Union.

“It is shameful that Kim Darroch has effectively been forced out for doing the job that diplomats are appointed to do,” Scotland’s First Minister Nicola Sturgeon tweeted. “Boris Johnson’s failure last night to stand up for him — and stand up to the behaviour of Donald Trump — spoke volumes.”

But Trump supporter and Brexit Party leader Nigel Farage described the resignation as, “the right decision.”

He tweeted: “Time (to) put in a non-Remainer who wants a trade deal with America.”

More about: