Image copyright Getty Images Image caption James D Melville is a career diplomat who has held senior posts in several European countries

The US ambassador to Estonia is resigning, reportedly in frustration at remarks made by President Donald Trump about America's European allies.

James D Melville said Mr Trump's comments on Nato and the EU had brought forward his decision to retire, Foreign Policy magazine reports.

The magazine was quoting from a private Facebook post by the envoy.

Mr Trump accuses Europeans of unfairly expecting America to shoulder the costs of the Nato alliance.

He has also imposed trade tariffs on some EU industries.

Other US diplomats left their posts early in recent months:

In January, US ambassador to Panama John Feeley resigned saying he was no longer able to serve under President Trump.

A month earlier, Elizabeth Shackelford resigned from her post in Nairobi where she had worked for the US mission to Somalia, saying she was quitting because the US had abandoned human rights as a priority, Foreign Policy reports

In the private Facebook post seen by Foreign Policy, Mr Melville reportedly told friends: "For the president to say the EU was 'set up to take advantage of the United States, to attack our piggy bank', or that 'Nato is as bad as Nafta [the North American Free Trade Agreement]' is not only factually wrong, but proves to me that it's time to go."

Mr Melville is a career diplomat and took up his position as ambassador in Estonia in 2015 after being nominated by then President Barack Obama.

He had previously held senior diplomatic posts in several European countries and speaks Russian, German and French, according to his biography on the US state department website.

Image copyright Getty Images Image caption Nato has stepped up exercises in the Baltic states in recent years

A state department spokesperson confirmed Mr Melville's intention to resign on 29 July.

President Trump reiterated his criticism of fellow Nato members on Friday while on a flight from Washington to his private golf club in New Jersey.

He told reporters on board Air Force One that countries including Germany, Spain and France had to increase their financial contributions to the bloc.

"It's not fair what they've done to the United States," he said. "The United States is paying much more disproportionately to anyone else."

His remarks come less than two weeks before a Nato summit in Brussels.