UNITED NATIONS (CBSNewYork/AP) — President Barack Obama warned Tuesday that the forces of globalization have exposed “deep fault lines” across the globe, calling for a “course correction” to ensure that nations and their peoples don’t retreat into a more sharply divided world.

Obama, in his final speech to the U.N. General Assembly, lamented that the world has become safer and more prosperous at the same time that nations are struggling with a devastating refugee crisis, terrorism and a breakdown in basic order in the Middle East.

READ MORE: NYC Mourning NYPD Officers Wilbert Mora, Jason Rivera After Deadly Ambush In Harlem

More: Getting Around The U.N. General Assembly

He said governing had become more difficult as people lose faith in public institutions and tensions among nations spiral out of control more rapidly.

“This is the paradox that defines the world today,” Obama said. “We must go forward, and not backward.”

Obama sought to use his last appearance before the global body to define how his leadership had put the world on a better trajectory over the last eight years. At the heart of that approach, Obama said, is the notion that the biggest conflicts are best solved when nations cooperate rather than tackle them individually.

In a less-than-subtle jab at Donald Trump, the Republican running to replace him, Obama said, “A nation ringed by walls would only imprison itself.”

Obama’s parting words to the global body contained a grim assessment of the challenges he’s leaving behind: a devastating refugee crisis, terrorism, financial inequality and a tendency to make immigrants and Muslims scapegoats. Across the Middle East, he said, “basic security, basic order has broken down.”

READ MORE: President Biden To Meet With Mayor Adams In New York City About Gun Violence Prevention

It’s a theme that Democrat Hillary Clinton has put at the forefront of her campaign for president, casting herself as the natural continuation of Obama’s legacy. In a subtle reference to her opponent, Donald Trump, Obama bemoaned how terrorist networks had spread their ideology on social media, spurring anger toward “innocent immigrants and Muslims.”

The president cited his administration’s outreach to former adversaries Cuba and Myanmar as key examples of progress, along with global cooperation to cut emissions blamed for global warming.

At the same time, he said he sought not to “whitewash” challenges across the globe, some of which he attributed to deepening anxieties about the profound shifts inflicted by technology and growing international interdependence.

“In order to move forward though, we do have to acknowledge that the existing path to global integration requires a course correction,” Obama said.

Hanging over the U.N. gathering was the weekend bombing in Chelsea that Mayor Bill de Blasio has declared an act of terror. Security in Manhattan, already high in light of the U.N. summit, was further tightened.

On Monday, suspect Ahmad Khan Rahami, who authorities believe is also behind a bombing in Seaside Park, New Jersey, was captured following a shootout with police after he was found sleeping in a doorway of a bar in Linden, New Jersey.

MORE NEWS: First Alert Snowstorm Forecast: Nor'easter Could Bring Heavy Snowfall, Powerful Winds This Weekend

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)