Donald Trump’s high-profile speech to the United Nations General Assembly on Tuesday didn’t sound like the words of a typical American president. It sounded like what candidate Trump spent more than a year saying on the campaign trail.

Personal attacks on other world leaders? Check. Tough talk implicitly threatening war against countries that don’t do what he says? Check. Jarring use of profanity? Check. Harsh criticism of the Iran nuclear deal? Check. Attacks on free trade, vowing to better protect the US border, and making clear that he didn’t want to take in foreign refugees? Check, check, and check.

Here was Trump on North Korea: “The United States has great strength and patience, but if it is forced to defend itself or its allies, we will have no choice but to totally destroy North Korea. Rocket man is on a suicide mission for himself and for his regime.”

On the Obama administration’s landmark nuclear pact with Iran: “The Iran deal was one of the worst and most one-sided transactions the United States has ever entered into. Frankly, that deal is an embarrassment to the United States.”

And on the geopolitical situation around the world: “Major portions of the world are in conflict, and some, in fact, are going to hell.”

For good measure, Trump even took a subtle shot at a senior member of his own staff. National Security Adviser H.R. McMaster has begged Trump not to use the phrase “radical Islamic terrorism,” which the three-star Army general worries will alienate broad swaths of the Muslim world. Trump had avoided it for weeks. On Tuesday, speaking to the leaders of 193 nations, Trump made a point of using it (and had an aide flag it on Twitter).

“We will stop radical Islamic terrorism,” Trump said, “because we cannot allow it to tear up our nation and, indeed, to tear up the entire world.”

Taken as a whole, Trump’s speech was like no UN address I’ve ever heard from an American president of either party. It paid lip service to protecting human rights in places like Syria and Venezuela, but made clear that the US wasn’t particularly interested in promoting democracy or other Western values there or in any other country.

Instead, Trump returned again and again to the importance of national sovereignty and his belief that the US and other countries should put their own interests first rather than deferring to outside organizations like, say, the UN.

That led to the deep contradiction at the heart of the speech, which was written by hardline Trump aide (and Steve Bannon ally) Stephen Miller.

Trump simultaneously argued that individual nations should do what’s best for them, and that they should join him in isolating — and potentially going to war against — North Korea. The problem with this is that China, the country with the greatest influence over Pyongyang, doesn’t want to see North Korea fall or the Kim regime collapse. By Trump’s own logic, Beijing is making the correct choice and doing what’s best for itself when it ignores Trump’s request to put more pressure on North Korea.

It’s not clear Trump or his aides recognize that. For that matter, it’s not clear that the president and those around him recognize that speeches like this UN address carry real weight: that other nations listen to what Trump says and then set their own policies accordingly. Candidate Trump could get away with lobbing rhetorical grenades and not thinking too much about their real-world impact. President Trump doesn’t have that luxury.

The world expected President Trump. Candidate Trump showed up instead.

In the runup to Tuesday’s speech, it wasn’t clear whether the Trump who took the stage in New York would be the America First ideologue of the campaign trail or the slightly more moderate version who has reaffirmed Washington’s commitment to international organizations like NATO and hinted that he was open to remaining in the Paris climate accords.

That uncertainty disappeared just minutes into the speech.

“The United States will forever be a great friend to the world and especially to its allies,” Trump said. “But we can no longer be taken advantage of or enter into a one-sided deal where the United States gets nothing in return.”

That set the stage for the remainder of Trump’s remarks, which for the most part sounded more like Bannon, who was fired in mid-August, than either McMaster or Trump’s well-regarded UN ambassador, Nikki Haley. It was an America First speech offered at the most globalized of institutions.

In Trump’s telling, the US — despite its status as the world’s sole superpower — has no moral obligation to take in refugees fleeing the wars in Yemen, Syria, Iraq, or Afghanistan. Instead, the president said that America, “out of the goodness of our hearts,” was sending financial assistance to countries closer to the war zones that are struggling to house and feed the millions who have fled the fighting.

Those nations are in desperate need of help, and more US money would go a long way, but the key takeaway is that Trump believes the refugees should stay overseas rather than come to the US.

It was an America First speech offered at the most globalized of institutions

The bulk of Trump’s speech, and the part that will be remembered the longest, was his tough talk toward both North Korea and Iran.

If the overall situation weren’t so terrifying, there’d be something almost amusing about an American president publicly calling Kim Jong Un “rocket man.” Trump has used the phrase on Twitter, so it’s possible he sees it as an effective way of belittling Kim, a young leader who seems desperate to be taken seriously on the world stage.

But it’s hard to know whether Trump or his aides grasped the dangers of including the line about how America could “totally destroy North Korea” in case of a conflict, or the line later in the speech when Trump hinted that he was prepared to rip up the nuclear deal with Iran. (Trump has to certify Iran’s compliance with the deal on October 15; in the UN speech, he called it an “embarrassment” and said, “I don’t think you’ve heard the last of it.”)

That’s the kind of rhetoric that plays well on Fox News, but using it in this kind of serious international venue (as opposed to riffing on Twitter) is a different story altogether. It could provoke North Korea into further accelerating its nuclear weapons and missile programs to deter what Pyongyang would rightly see as the increasingly bellicose rhetoric of the Trump administration.

Put a different way, Trump’s own words could make North Korea feel like it has no choice but to continue to defy Washington and pursue missiles capable of hitting the mainland US. The president could be making the situation more dangerous and difficult to resolve, not less so.

As Richard Haass, the president of the Council on Foreign Relations, put it on Twitter, “Threats vs N Korea, ridiculing its leader more likely to persuade NK to increase its nuclear weapons & missiles than limit them/give them up.”

Ditto with Iran. The nations that spent years working with Washington to enforce harsh economic sanctions on Tehran have been looking to sign lucrative, multibillion-dollar trade deals with Iran since the nuclear pact took effect in 2015. There is no chance they’d abandon those deals and reimpose sanctions on Iran if Trump chose to withdraw from the agreement despite no evidence that Iran has violated its terms.

Instead, Tehran would find itself free to resume its nuclear program without the threat of hard-hitting international sanctions. Here, again, Trump’s words and deeds would accomplish the opposite of what he intended.

All of which leads to a question: Why make these kinds of empty, scary, and almost certainly counterproductive threats in the first place?

Trump was speaking to the UN, but his real audience was here at home

Trump has had a rough few weeks, even by his own historically unpopular standards. He’s warring with Senate Majority Leader Mitch McConnell and House Speaker Paul Ryan, watching helplessly as special counsel Robert Mueller’s probe into possible collusion with Russia heats up, and coming under fire from even some of his most devoted followers for talking with Democrats about a deal to save undocumented immigrants brought into the US as children from being deported. (Breitbart derided him as “Amnesty Don” after news of the possible pact circulated earlier this month.)

But polls show that Trump’s base still gives him high marks for his handling of foreign policy, particularly when it comes to his tough talk toward North Korea and willingness to use force in Syria. That means Trump may have seen the UN speech not as a chance to sell his policies to a skeptical audience of world leaders, but as a way of reminding wary voters why they liked him in the first place.

That may prove to have been a good political calculation, though it’s unlikely that a single UN speech will really move the needle. But that’s what it is: a political calculation, of the sort candidates make every day. It’s not the actions of a president.