For 50 minutes on Tuesday, President Trump dazzled, and appalled, UN denizens in a speech that was the most detailed and reasoned defense to date of his “America First” ideology. The nationalism was still there, but any hint of isolationism was absent.

If “Rocket Man” Kim Jong-un refuses to end his missile and nuclear programs and keeps up his “suicide mission,” Trump said, and if countries fail to isolate him despite the UN’s own resolutions, America “will have no choice but to totally destroy North Korea.”

And he didn’t shy away from attacking several other sacred cows of Turtle Bay. He chastised the UN bureaucracy and hinted America won’t continue blindly pouring cash into it. He asked other countries to shoulder more responsibility in maintaining global peace and prosperity.

And then there was this: The nuclear deal with Iran is “one of the worst and most one-sided transactions the United States has ever entered into,” Trump said. “Frankly, that deal is an embarrassment to the United States, and I don’t think you’ve heard the last of it — believe me.”

The usual suspects were appalled. “It was the wrong speech, at the wrong time, to the wrong audience,” Swedish Foreign Minister Margot Wallstrom told the BBC.

In reality, it was a more-refined and a better-reasoned version of the worldview Trump’s been proclaiming since the campaign. It was a defense of the role national interests play in facilitating global cooperation.

He talked about three principles — “sovereignty, security and prosperity.” But the speech might as well have been titled “sovereignty, sovereignty and sovereignty.”

The word appeared in the speech 19 times. Trump also mentioned “patriotism” and, of course, he vowed, “As president of the United States, I will always put America first, just like you, as the leaders of your countries will always, and should always, put your countries first.”

Earlier, UN Secretary-General Antonio Guterres called on countries to embrace refugees and migrants, hinting, not so subtly, at Trump’s travel ban. “Safe migration cannot be limited to the global elite,” Guterres said.

Trump would have none of it. “Uncontrolled migration is deeply unfair to both the sending and the receiving countries,” he said.

“For the sending countries,” he explained, “it reduces domestic pressure to pursue needed political and economic reform and drains them of the human capital.” And for the receiving ones, “costs of uncontrolled migration are borne overwhelmingly by low-income citizens whose concerns are often ignored by both media and government.”

These weren’t exactly traditional applause lines at Turtle Bay. The most senior North Korean diplomat bolted before the speech, leaving only a note-taker behind. A Chinese diplomat told me the speech was “pigheaded.” But Asian allies in the hall applauded the same lines and themes that brought our foes such consternation.

Trump also brandished his gift for branding. Like other childish, though perfectly pitched, Trump taunts — Lyin’ Ted, Crooked Hillary — Kim of North Korea will forever be known from now on as “Rocket Man.” More important, Trump’s vow that “our military will soon be the strongest it has ever been” will — if brought to fruition — warm the hearts of Asian allies who have been less than assured of late about America’s commitment to global protection and defense agreements.

And as one Arab diplomat observed, Western Europeans, Chinese and Russians may be stunned by Trump’s style, but many Middle Easterners, especially those fearing Iran’s rise, will understand the appeal.

Like Israeli Prime Minister Benjamin Netanyahu, who is often criticized in public by world leaders but lauded in private by those very same leaders. He found a kindred spirit in Trump. “In over 30 years in my experience with the UN, I never heard a bolder or more courageous speech,” Bibi tweeted.

Some UN traditionalists heard in Trump’s “sovereignty” approach echoes of the world body’s early years, in the 1940s, when the global governing structure was young and concerns about trampling national boundaries were de rigueur. But Trump seems intent on bringing it back into fashion.

So if they want America as an ally, they better get used to it.

Twitter @bennyavni