President Barack Obama railed against political “strongmen," nationalism and isolation in a farewell address to the United Nations General Assembly on Tuesday, taking his campaign battle with Donald Trump to the podium of the world’s foremost international institution.

Obama’s speech in New York was a defense of globalism and an attack on authoritarians, tribalists and populists in which he never mentioned the Republican vying to succeed him in office. But the subtext was impossible to miss, and could also be interpreted as a criticism of the U.K.’s decision this year to exit from the European Union.

After extolling the expansion of democracy across the globe and a reduction in extreme poverty, Obama warned of “a crude populism, sometimes from the far left but more often from the far right, which seeks to establish what they think was a better, simpler age free from outside contamination.”

“A country ringed by walls would only imprison itself," Obama said.

The remarks were the latest attack on Trump by an incumbent president who is extraordinarily invested in electing Democrat Hillary Clinton as his successor. He has frequently employed high-profile moments in the final months of his administration as opportunities to criticize Trump and assist Clinton, his former secretary of state. But Tuesday’s speech also revealed a president still grappling with an argument for a more interconnected world and robust international institutions at a time when many voters on both sides of the Atlantic reject that philosophy.

"This is the paradox that defines the world today," Obama said, adding that the world could not afford to "dismiss these visions."

“They are powerful," he said. "They reflect dissatisfaction among too many of our citizens.”

Trump’s Wall

Trump’s campaign slogan, “Make America Great Again,” harks back to an unspecified period in American history when the Republican believes the U.S. and its economy was stronger and more influential in the world. His core campaign promise is to build a wall on the southern border of the U.S. to stop undocumented immigrants from entering from Mexico.

Obama acknowledged that leaders in capitals across the world had not done enough to account for people who feel their welfare and their traditional cultures are menaced by globalism. He argued, though, that retreating from international engagement would offer no defense against extremism or other threats.

"The world is too small for us to simply be able to build a wall and prevent it from affecting our society," he said.

Seven years after he first appeared before world leaders at the UN to call for a “new era of engagement with the world,’’ Obama said that he had delivered on his pledge.

Last year’s Paris agreement to combat climate change will help to reverse a rise in global temperatures, and the U.S. deal with Iran to roll back the country’s nuclear program has reduced the threat of another Mideast war, Obama said. He touted a rapprochement with Cuba, a shift toward democracy in Myanmar, also known as Burma, and the stabilization of the global economy as evidence of U.S. leadership.

Trump has called for a drastic shift from what he has called Obama’s “weak’’ foreign policy, pledging to limit immigration to the U.S., torture terrorism suspects and reconsider U.S. alliances.

“Weakness invites aggression,’’ Trump said Monday at a rally in Florida. “We’re weak.’’

Bedeviled Presidency

Events in the days leading up to Obama’s speech shined a spotlight on the lengthy list of global problems that have bedeviled his presidency.

Bombings in New York and New Jersey and a stabbing attack in a Minnesota mall over the weekend showed the potential impact of lone-wolf terrorist attacks, many inspired by Islamic State extremists based in Syria and Iraq.

Obama conceded that "until basic questions are answered about how communities co-exist, the embers of extremism will continue to burn."

"Countless human beings will suffer," he said.

In Syria, a deal brokered by the U.S. and Russia to institute a cease-fire is unraveling just a week after it began with the promise of allowing humanitarian aid to reach besieged parts of the country. On Monday, a humanitarian aid convoy was bombed in the city of Aleppo, casting further doubt about whether the pact with Russia would survive. Almost six years into a civil war that has killed at least 280,000 Syrians and displaced millions, U.S.-led efforts to end the fighting have largely failed.

Obama did not address the impending collapse of the cease-fire in his remarks to the General Assembly, but he did offer a blunt criticism of Russian aggression.

‘Lost Glory’

"In a world that left the age of empire behind, we see Russia attempting to recover lost glory through force," Obama said. He said that while Russian actions might stoke nationalist support for the government of its president, Vladimir Putin, leaders there risked long-term damage to their nation’s stability and borders.

Obama also criticized China, both in a reference to "some countries which now recognize the power of free markets" yet "still reject the model of free societies" and in a more pointed jibe at the country’s attempt to settle territorial disputes in the South China Sea by force. In July, an international arbitration court at the Hague invalidated Chinese claims to a wide swath of the region, although China has refused to recognize the ruling.

"A peaceful resolution of disputes offered by law will mean far greater stability then the militarization of a few rocks and reefs," Obama said.

Keep up with the best of Bloomberg Politics.

Get our newsletter daily.

Business

Your guide to the most important business stories of the day, every day.

You will now receive the Business newsletter

Markets

The most important market news of the day. So you can sleep an extra five minutes.

You will now receive the Markets newsletter

Technology

Insights into what you'll be paying for, downloading and plugging in tomorrow and 10 years from now.

You will now receive the Technology newsletter

Pursuits

What to eat, drink, wear and drive – in real life and your dreams.

You will now receive the Pursuits newsletter

Game Plan

The school, work and life hacks you need to get ahead.

You will now receive the Game Plan newsletter

Obama later hosted a summit aimed at addressing the surge in global refugees. He has called on governments and companies to offer more assistance to the more than 21 million refugees fleeing violence in places like Syria and Afghanistan. On Tuesday, the White House announced it had recruited 51 companies to invest, donate, or raise $650 million in support of 6.3 million refugees across more than 20 nations.

"I believe history will judge us harshly if we do not rise to this moment," Obama said at the summit. "We all have to do more."

Obama praised Canadian Prime Minister Justin Trudeau and German Chancellor Angela Merkel for welcoming refugees to their countries despite political opposition. The U.S. will accept 110,000 refugees in the fiscal year that ends Sept. 30, 2017, Obama said, though his successor will decide whether the nation stands by that goal.