US ambassador to Estonia James D Melville Jr. at a hand-over ceremony of the upgraded NATO military base in Tapa, Estonia, in December 2016.

The US ambassador to Estonia has resigned over frustrations with President Donald Trump’s comments about the European Union and his treatment of Washington’s European allies.

In a private Facebook message posted Friday, James D Melville wrote: “For the President to say EU was ‘set up to take advantage of the United States, to attack our piggy bank,’ or that ‘NATO is as bad as NAFTA’ is not only factually wrong, but proves to me that it’s time to go.”

Melville was referring to Trump’s recent comments at news conferences and on social media.

Melville stressed that a US foreign service officer’s “DNA is programmed to support policy and we’re schooled right from the start, that if there ever comes a point where one can no longer do so, particularly if one is in a position of leadership, the honorable course is to resign.”

Melville is a senior US career diplomat who has served as the American ambassador in the Baltic nation and NATO member of Estonia since 2015. He has served at US Embassies in Berlin, London and Moscow, among other postings.

“Having served under six presidents and 11 secretaries of state, I never really thought it would reach that point for me,” he wrote, referring to a career with the State Department that started in the mid-1980s.

The US Embassy in Tallinn confirmed to The Associated Press on Saturday that Melville “announced his intent to retire from the Foreign Service effective July 29 after 33 years of public service”. It did not elaborate.

Foreign Policy magazine said Melville is one of the many senior US diplomats who have resigned because of Trump’s policies.

The announcement of Melville’s departure was followed by that of Susan Thornton, Trump’s choice to be the nominee to be assistant secretary for East Asian affairs, later on Friday.

Melville and Thornton are the latest foreign service officer to leave in a department where the senior ranks have been deeply depleted and even rising stars have resigned rather than serve the President, reports CNN.

Last November, Elizabeth Shackelford, an award-winning US diplomat based in Nairobi, wrote to former Secretary of State Rex Tillerson a blistering resignation letter saying that the Trump administration had diminished the influence of State Department with its preference for military solutions.

This January, US Ambassador to Panama John Feeley resigned over differences with the Trump administration.

In March, US Ambassador to Mexico Roberta Jacobson, announced her decision to step down amid increased tensions between the US and Mexico.