The U.S. ambassador to Estonia has resigned from his post over frustrations with President Donald Trump’s recent comments about the European Union and the treatment of European allies.

James D. Melville wrote in a private Facebook message on that he decided it was time to step down from his post after Trump’s comments on how the EU was “set up to take advantage of the United States, to attack our piggy bank” and that “NATO is as bad as NAFTA.”

In a statement Friday, the State Department confirmed Melville’s departure.

“Earlier today, the United States’ ambassador to Estonia, Jim Melville, announced his intent to retire from the Foreign Service effective July 29 after 33 years of public service,” the spokesperson said.

Trump’s “piggy bank” comments were made during a rally in North Dakota on Wednesday.

“We love the countries of the European Union. But the European Union, of course, was set up to take advantage of the United States,” he said. “And you know what, we can’t let that happen.”

The remarks are latest amid a continued escalation of a trade war between the U.S. and the rest of the world.

On Wednesday, the president doubled down on his claims that the EU is cheating the U.S. on trade, saying the U.S. lost $15 billion on trade with the EU last year.

“We had a trade deficit because they send the Mercedes in, they send the BMWs in, they send their products in, we send things to them and they say, ‘No thank you, we don’t take your product,’” he said. “That’s not the way it works and for all those free traders out there – that’s not free trade, that’s stupid trade. I said to them, if you treat us that way and you don’t take down your barriers, if you’re not going to treat us fairly then we are going to tax all those beautiful Mercedes-Benzes.”

Melville is a senior U.S. career diplomat who has served as the American ambassador in the Baltic nation and NATO member of Estonia since 2015. He has served the State Department for 33 years.

The U.S. Embassy in Tallinn did not immediately comment.

The Associated Press contributed to this report.