It started as a headline seemingly straight out of The Onion. Then it unleashed a torrent of jokes on late-night television and social media. And finally it exploded into a serious diplomatic rupture between the United States and one of its longtime allies.

In the latest only-in-Trumpland episode skating precariously along the line between farce and tragedy, the president of the United States on Wednesday attacked the prime minister of Denmark because she will not sell him Greenland — and found the very notion “absurd.”

Never mind that much of the rest of the world thought it sounded absurd as well. Amid a global laughing fit, Mr. Trump got his back up and lashed out, as he is wont to do, and called the prime minister “nasty,” one of his favorite insults, particularly employed against women who offend him, like Hillary Clinton and Meghan Markle, the Duchess of Sussex.

All of which might be written off as just another odd moment in a presidency unlike any other. Except that attacking Denmark was not enough for the president. He decided to expand his target list to include NATO because, as he pointed out, Denmark is a member of the Atlantic alliance. And he chose to do this just two days before leaving Washington to travel to an international summit in France, which also happens to be a NATO member.