President Trump, mocked for wanting to buy Greenland last week, could well have been eyeing an emerging battle with China and Russia over control of the icy island.

Both countries have taken a keen interest in the region as a warming climate has led to newly open sea lanes and shipping routes.

“Trump’s approach may be wacky but it does send a serious message to Russia and China — don’t mess with us on Greenland,” Rear Admiral Nils Wang, a former head of the Danish navy, told London’s Sunday Times. “This is a complete game-changer.”

Russia has long dedicated considerable resources to the area, often using it for military research. As the ice has melted, the country has ramped up military drills, opened new radar stations and established military bases.

In April, Norwegian fisherman apprehended a mysterious beluga whale off the arctic coast — and it was equipped with Russian surveillance equipment, the Times reported.

China, too, has designs on Greenland, having purchased a fleet of commercial ice-breakers to help carve out new routes for its silk trade, according to the BBC.

“They’re looking for alternate routs of shipping in case they face future problems in the South China Sea or the Malacca Strait,” John Dotson, who edits the Jamestown Foundation’s China Brief, told The Post.

“The Chinese are certainly showing greater interest in the potential shipping lanes through the arctic region, particularly as the climate warms and the ice is melting and those northern sea lanes are becoming more open.”

One local was actually upbeat over all the attention to his country.

“Hopefully this whole Trump thing makes the Danes wake up and show Greenland some respect,” Hanna Jensen, 52, an English teacher in Nuuk, told the Times.

“A lot of Danes think everyone here is just a drunk Inuit. But now that America wants to buy us, maybe they can see there is much of value here,” Jensen added.

Since slamming the rejection of his proposal by the Danish prime minister as “nasty,” Trump has warmed to her.

Mette Frederiksen and Trump patched things up, he revealed Saturday.

“She called me, a wonderful woman, we had a great conversation, we have a very good relationship with Denmark, and we agreed to speak later,” he said of their conversation earlier this week.

“But she was very nice. She put a call in, and I appreciated it very much.”