Watch: President Obama Delivers His Final Speech At United Nations Today

President Barack Obama in his final speech to the United Nations on Tuesday made an impassioned plea on behalf of a liberal world order that he admitted was under growing pressure from wars in the Middle East and rising nationalism at home and in Europe.

Speaking to the United Nations General Assembly, for the eighth and last time as president, Obama sought to rise above the conflicts of the moment and outline a vision for coming decades by stressing the importance of liberal institutions built after World War II, including the United Nations.

“The world is by many measures less violent and more prosperous than ever before,” Obama said. But he acknowledged a growing global unease, fueled by terrorism and fear, which has led some western politicians, including Republican nominee Donald Trump, to call for blocking immigrants and restrictions on trade.

The answer to such challenges was a “course correction,” the president said, that recognized the shortcomings of recent decades that have fueled economic inequality, intolerance and frustration.

The president lamented the “deep fault lines in the existing international order” and historic flows of refugees fleeing brutal conflicts and overwhelming some parts of Europe.

“Across vast swaths of the Middle East basic security, basic order has broken down,” Obama said. Speaking more broadly, he said: “Our societies are filled with uncertainty and unease and strife.”

Obama rejected the strongman, top-down model pushed by many of his international rivals, including Russian President Vladimir Putin and Chinese President Xi Jinping, and in the same breath he dismissed those who push religious fundamentalism, aggressive nationalism and, a “crude populism” that promises to return citizens to a “better and simpler age free of outside contamination” – a not-so veiled reference to Trump’s campaign promise to “Make American Great Again.”

“We cannot dismiss these visions,” Obama said. “They are powerful.”

Throughout his presidency Obama has stressed the importance of diplomacy and international organizations, such as the United Nations, and from his earliest days as a candidate he has preached the need to reach out to long-standing enemies.

He used his speech Tuesday to try to cement his legacy, pointing to the gains achieved through his approach. He described smashing terrorist havens and his administration’s efforts to halt the proliferation of nuclear weapons. He described the breakthroughs of restoring U.S. relations with Cuba and Burma, and he held up the historic talks with Iran that led to its rolling back of its nuclear weapons program as a model for the world.

But Obama’s tenure in office has been dominated by terrorism, the collapse of order in the Middle East and massive flows of refugees that have unnerved Europe. In the days leading up to his speech, war, terrorism and refuges once again dominated his agenda.

The president’s remarks came one day after a massive manhunt led to the capture of a suspect linked to bombings in New York and New Jersey and hours after a tenuous ceasefire in Syria seemed to have collapsed. There were reports that Syrian or Russian aircraft had struck an aid convoy near Aleppo, just days after planes from the U.S.-led alliance mistakenly struck Syrian military troops.

Obama steered completely clear of these topics in his speech, which focused on the changes needed to realize his vision of a more peaceful and interconnected world.

The president spoke of the economic unease caused by globalization, which has manifested itself during the presidential race in widespread opposition to international trade deals. Such agreements, Obama said, could ensure that profits of the global economy are more evenly distributed.

“A world in which 1 percent of humanity controls as much wealth as the other 99 percent will never be stable,” Obama said.

He called for more vigilance to eliminate tax havens, fight climate change and curb the “excesses of capitalism.”

“A society that asks less of oligarchs than ordinary citizens will rot from within,” he said.

At times Obama’s remarks were directed at world leaders. He called for more work to resolve the Israel-Palestinian conflict, an unfulfilled goal of his presidency, and for more diplomacy to try to halt the bloodshed in Syria. He insisted China’s buildup in the South China Sea – which he dismissed as the “militarization of a few rocks”– could not provide a lasting solution to the territorial disputes there.

In other moments, Obama seemed to be addressing the American electorate and the deep fissures that have been revealed by the presidential election. He rejected the idea that a border wall could block the spread of disease, in the form of the Zika virus, or religious extremism or terrorism.

“The world is too small for us to be able to build a wall and prevent it from affecting our own societies,” Obama said.

Near the end of his remarks, Obama also challenged his fellow leaders to do more to help the growing diaspora of refugees across the globe. The White House announced ahead of the speech that the president had secured $650 million in pledges of financial aid from the private sector.

But Obama implored his audience to “do more to open our hearts to help refugees who are desperate for a home.” He emphasized that those fleeing war-torn homelands are victims of tragic circumstances for which they are not responsible, and he added that the rest of the world must “have empathy to see ourselves, have to imagine what it would be like for our family, for our children, if the unspeakable happened to us.”

The president was scheduled to lead a special summit on refugees Tuesday afternoon. “We have to follow through even when the politics are hard,” Obama cautioned world leaders.

The president concluded by returning, as he often did in the earliest days of his presidency, to his remarkable personal story. “My own family is made up of the flesh and blood and traditions and cultures and faiths from a lot of different parts of the world,” Obama said.

Obama cited his family story as evidence of the existence of universal ideals and principles that are increasingly under assault in a globalizing world.

Such ideals, he said, strengthen his patriotism and make his country stronger.

“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,” Obama said.