US President Donald Trump cancelled a visit to Denmark after his idea to buy Greenland was rebuffed.

Danes voiced shock and disbelief on Wednesday at U.S. President Donald Trump's cancellation of a visit to Denmark after his idea to buy Greenland was rebuffed, although Prime Minister Mette Frederiksen said she believed relations would not be affected.

Trump's proposal at first elicited incredulity and humour from politicians in Denmark, a NATO ally of the United States, with former premier Lars Lokke Rasmussen saying: "It must be an April Fool's Day joke."

But the mood turned to bewilderment when Trump called off the Sept. 2-3 visit after Frederiksen called his idea of the United States purchasing Greenland, an autonomous Danish territory rich in natural resources, "absurd".

Frederiksen, a centre-left Social Democrat, said she learned of Trump's decision "with regret and surprise", given Denmark's strong relations with Washington, but repeated her opposition to any Greenland transaction.

She stressed that Greenland's premier Kim Kielsen had ruled out selling off the territory and "I obviously agree with him".

But Frederiksen said the United States remained one of Denmark's closest allies. "I don't think the cancelling of this state visit should affect any decisions we make whether it is on commercial cooperation or foreign and security policies."

Trump's decision elicited condemnation, outrage and mockery alike among Danish opposition leaders and the public.

"So (Trump) has cancelled his visit to Denmark because there was no interest in discussing selling Greenland. Is this some sort of joke? Deeply insulting to the people of Greenland and Denmark," tweeted former premier Helle Thorning Schmidt.

"Total chaos with @realDonaldTrump and cancellation of state visit to Denmark. It has gone from a big opportunity for strengthened dialogue between allies to a diplomatic crisis," said ex-foreign minister Kristian Jensen of the Liberal Party.

"NOT FOR SALE"

Greenland, which is gaining attention from world powers including China, Russia and the United States due to its strategic location and mineral wealth, is self-governing but underdeveloped and relies on Denmark for economic support.

"Everyone should know Greenland is not for sale," Jensen said of the world's largest island, where the United States has a military presence at the Thule Air Base under a U.S.-Danish treaty dating to 1951.

"(Trump's cancellation) is very, very shocking, when it is about a very close ally and a good friend," said Soren Espersen of the hard right Danish People's Party.

He said Trump had effectively snubbed Queen Margrethe, Denmark's head of state. Trump and U.S. First Lady Melania Trump were formally invited to Denmark by Queen Margrethe in July.

"It shows why we now more than ever should consider (fellow) European Union countries as our closest allies. The man is unpredictable," said Morten Ostergaard, leader of the Danish Social Liberal Party. "Reality surpasses imagination."

Trump, whose "America First" policies have resulted in strained relations with the EU over trade and other issues, said on Sunday a U.S. purchase of Greenland would be "a large real estate deal."

"Denmark is a very special country with incredible people, but based on Prime Minister Mette Frederiksen's comments, that she would have no interest in discussing the purchase of Greenland, I will be postponing our meeting scheduled in two weeks for another time," Trump tweeted on Tuesday.

Anders Fogh Rasmussen, a former NATO secretary general and Danish premier, said Trump's cancellation could work out for the best. "The Arctic's security and environmental challenges are too important to be considered alongside hopeless discussions like the sale of Greenland," he said on Twitter.