The United States is considering withdrawing some of the US troops stationed in Germany, with Poland mooted as a possible new deployment, the US ambassador to Germany has said.

The threat of withdrawal comes amid ongoing differences between Berlin and Washington over Germany's contribution to NATO and a current spat caused by the German refusal to take part in a US-led naval mission in the Persian Gulf.

"It is actually offensive to assume that the US taxpayer must continue to pay to have 50,000-plus Americans in Germany, but the Germans get to spend their surplus on domestic programs," US Ambassador Richard Grenell told the DPA news agency, in comments carried widely by German media on Friday.

His remarks come after the US ambassador to Poland, Georgette Mosbacher, tweeted that her country would be happy for the American troops in Germany to move there instead.

US President Donald Trump had also mentioned the possibility of moving some American troops from Germany to Poland in talks with Polish President Andrzej Duda in Washington in June, something that was also mentioned by Grenell.

"President Trump is right and Georgette Mosbacher is right, " he said, saying that requests by "numerous presidents" for Germany to "pay for its own defense" had been ignored. Now was the time for Americans and the US president had to react, he said.

Read more: German Defense Ministry admits huge spending on consultants

Grenell has often irritated Berlin with his comments

Largest US deployment in Europe

Germany is the European country where most US troops are posted, with 35,000 soldiers deployed there along with 17,000 American civilians employed by the US military. Some 12,000 German civilians also work in jobs connected with the deployment.

Rumors that the US might be considering a partial pullout of troops from Germany have long been rife, with the US administration under Donald Trump often voicing anger that Berlin is not contributing enough to NATO.

Germany intends to spend 1.36% of GDP on defense this coming year, an amount that, while marking a strong increase, is still well under NATO's 2% goal for member states. Although the government says it wants to increase the current figure to 1.5% by 2024, the financial planning for 2023 envisages spending only 1.24% of GDP on the military.

Read more: Opinion: More money won't alone fix Germany's military woes

US soldiers have been posted in Germany since World War II

Trans-Atlantic differences

Grenell's comments come shortly after Germany sparked Washington's ire by refusing to take part in a US-led operation in the Strait of Hormuz to protect trading vessels from Iranian aggression and rejecting a US request to send ground troops to fight the extremist group "Islamic State."

They also come ahead of Trump's twin trips to Europe at the end of August — with neither trip including a visit to Germany.

The first will take Trump to the G7 summit in the French resort of Biarritz, where he will meet German Chancellor Angela Merkel.

The second, from August 31 to September 3, will see him visiting Denmark and Poland. Among other things, both these countries share Washington's opposition to the Nord Stream 2 gas pipeline that has been strongly promoted by Germany.

Read more: Landmark INF nuclear arms treaty is history: What now?