A former Danish prime minister has lashed out at Donald Trump for his tweet about military spending, saying defence willingness is not just about the amount of money spent.

Lars Loekke Rasmussen’s comment is the latest in an escalating spat between the US and Denmark after Mr Trump scrapped a visit to the country, saying current PM Mette Frederiksen was “nasty” when she rejected his “absurd” idea of buying Greenland.

Mr Loekke Rasmussen, who led the country until June, tweeted to the US president: “We have had (proportionally) exactly the same numbers of casualties in Afghanistan as US. We always stands firm and ready.”

Mr Trump, who has urged Nato members to do more to meet the alliance’s goal of committing 2% of gross domestic product to defence, earlier tweeted that “Denmark is only at 1.35%”.

For the record, Denmark is only at 1.35% of GDP for NATO spending. They are a wealthy country and should be at 2%. We protect Europe and yet, only 8 of the 28 NATO countries are at the 2% mark. The United States is at a much, much higher level than that....

“We will not accept that our defense willingness is only about percentages,” Mr Loekke Rasmussen tweeted. “I told you at the NATO Summit in Brussels last year.”

In January, a coalition in the Danish parliament agreed to add 1.5 billion kroner (£180 million) to the already agreed defence budget for 2023, which would put spending at 1.5% of gross domestic product for that year. The US spends about 3.4% of its GDP on defence.

Mr Trump abruptly cancelled his planned September 2-3 visit to Denmark on Tuesday, after Ms Frederiksen called his idea to buy Greenland “an absurd discussion”.

He said her comment “was nasty. I thought it was an inappropriate statement. All she had to say was say, ‘No, we wouldn’t be interested'”.

Ms Frederiksen said the US remains one of Denmark’s close allies.

The dispute over the world’s largest island comes from its strategic location in the Arctic. Global warming is making Greenland more accessible to potential oil and mineral resources, and Russia, China, the US, Canada and others are racing to stake a claim, hoping they will yield future riches.

Ms Frederiksen has said Denmark does not own Greenland which belongs to its people. It is part of the Danish realm along with the Faeroe Islands, another semi-autonomous territory, and has its own government and parliament, the 31-seat Inatsisartut.

Mette Frederiksen (Mads Claus Rasmussen/Ritzau Scanpix/AP)

The sparsely populated island, which is four times zones behind Copenhagen, became a Danish colony in 1775 and remained that way until 1953, when Denmark revised its constitution and made the island a province.

In 1979, Greenland and its 56,000 residents who are mainly indigenous Inuits, got extensive home rule but Denmark still handles its foreign and defence policies, as well as currency issues.

On Wednesday, the US State Department said Secretary of State Mike Pompeo spoke with his Danish counterpart and “expressed appreciation for Denmark’s cooperation as one of the United States’ allies and Denmark’s contributions to address shared global security priorities”.