In a sweeping address that touched on the world's trouble spots — including the 5-year-old civil war in Syria, the refugee crisis stemming from that nation and elsewhere, and creeping authoritarianism in Russia and Eastern Europe — Obama suggested they all are related to each other, and to a drive toward isolationism.
That impulse is self-defeating, he argued.
"Today, a nation ringed by walls would only imprison itself," Obama said. "The answer cannot be a simple rejection of global integration. Instead, we must work together to make sure the benefits of such integration are broadly shared and that the disruptions — economic, political and cultural — that are caused by integration are squarely addressed."
The line also was one of several oblique references to Donald Trump, as a subtext of Obama's speech was an argument against the Republican presidential nominee's candidacy.
Each nation can choose to "reject those who appeal to our worst impulses," Obama also said, "and embrace those who appeal to our best."
Ahead of his eighth and final address at the U.N. General Assembly, aides looked back to Obama's first speech there in 2009, when he laid out a plan to fix the "skepticism and distrust" he believed had built up under President George W. Bush, fueling "reflexive anti-Americanism" that served as an excuse for collective inaction. The audience received him warmly that day, in contrast with the silent response that Bush often got at the U.N. gathering.
At the time, Obama listed his immediate accomplishments in his few months in office, including ordering closure of the detention center at Guantanamo Bay, Cuba, the phase-out of the war in Iraq and the naming of a special Middle East envoy working toward a two-state peace agreement between Israelis and Palestinians.
By contrast, Obama's speech Tuesday reflected a touch of humility in a president who has watched Congress thwart his proposals to close Guantanamo, seen chaos in the wake of the Iraq withdrawal and witnessed the collapse of peace talks.
In addition, the gathering of world leaders unfolded under the shadow of bombings over the weekend in New York and New Jersey that raised the specter of domestic terrorism and its international influences, as well as the end of a brief ceasefire in Syria's civil war. The cessation of hostilities had been wrangled by Secretary of State John F. Kerry and his Russian counterpart, Sergei Lavrov.
Though Obama asserted that the world is less violent than ever and that billions of people are better off thanks to the integration of the global economy, he argued that to keep moving forward, global integration needs a "course correction" to make sure that all share in prosperity and that justice is applied equally.
Integration also has brought about a collision of cultures, he said. Trade, migration and the Internet challenged people's identities.
"We see liberal societies express opposition when women choose to cover themselves," Obama said. "We see protests responding to Western newspaper cartoons, the caricature of the prophet Muhammad. In a world that left the age of empire behind, we see Russia attempting to recover lost glory through force.
"There's no easy answer for resolving all these social forces," he said. "But I do not believe progress is possible if our desire to preserve our identities gives way to an impulse to dehumanize or dominate another group."
U.S. standing in the world is an aberration, Obama noted.
"For most of human history, power has not been unipolar, and the end of the Cold War may have led too many to forget this truth," he said. "I've noticed as president, that at times, both America's adversaries and some of our allies believe that all problems were either caused by Washington or could be solved by Washington.
"And perhaps too many in Washington believe that, as well," he added, to laughter.
The president spoke with aides before the speech about Martin Luther King Jr.'s letter from jail in Birmingham, Ala., in which he wrote about how the actions of one person might inform the biggest decisions made during his time.
"Our identities … don't have to be defined in opposition to other, but rather by a belief in liberty and equality and justice, fairness," Obama said, going on to quote King. "My faith in those principles does force me to expand my moral imagination and to recognize that I can best serve my own people — I can best look after my own daughters —by making sure that my actions seek what is right for all people and all children and your daughters and your sons."
Follow @cparsons for news about the White House.
11:15 a.m.: This article was updated with more comments from Obama.