President Obama delivered his final speech to the United Nations yesterday and called on nations to work together and resist the urge to isolate, persecute, specifically mentioning violence against gays, and LGBT rights. He also warned against nations “ringed by walls” and thee dangers of nationalism, a clear statement against the policies pushed by Republican presidential nominee Donald Trump.

Said Obama:

“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. If our religion leads us to persecute those of another faith, if we jail or beat people who are gay, if our traditions lead us to prevent girls from going to school, if we discriminate on the basis of race or tribe or ethnicity, then the fragile bonds of civilization will fray. The world is too small, we are too packed together, for us to be able to resort to those old ways of thinking.”

Earlier in the speech he had called for dignity and respect for all people:

In remote corners of the world, citizens are demanding respect for the dignity of all people no matter their gender, or race, or religion, or disability, or sexual orientation, and those who deny others dignity are subject to public reproach. An explosion of social media has given ordinary people more ways to express themselves, and has raised people’s expectations for those of us in power. Indeed, our international order has been so successful that we take it as a given that great powers no longer fight world wars; that the end of the Cold War lifted the shadow of nuclear Armageddon; that the battlefields of Europe have been replaced by peaceful union; that China and India remain on a path of remarkable growth.

I say all this not to whitewash the challenges we face, or to suggest complacency. Rather, I believe that we need to acknowledge these achievements in order to summon the confidence to carry this progress forward and to make sure that we do not abandon those very things that have delivered this progress.

In order to move forward, though, we do have to acknowledge that the existing path to global integration requires a course correction. As too often, those trumpeting the benefits of globalization have ignored inequality within and among nations; have ignored the enduring appeal of ethnic and sectarian identities; have left international institutions ill-equipped, underfunded, under-resourced, in order to handle transnational challenges.

And as these real problems have been neglected, alternative visions of the world have pressed forward both in the wealthiest countries and in the poorest: Religious fundamentalism; the politics of ethnicity, or tribe, or sect; aggressive nationalism; a crude populism — sometimes from the far left, but more often from the far right — which seeks to restore what they believe was a better, simpler age free of outside contamination.

We cannot dismiss these visions. They are powerful. They reflect dissatisfaction among too many of our citizens. I do not believe those visions can deliver security or prosperity over the long term, but I do believe that these visions fail to recognize, at a very basic level, our common humanity. Moreover, I believe that the acceleration of travel and technology and telecommunications — together with a global economy that depends on a global supply chain — makes it self-defeating ultimately for those who seek to reverse this progress. Today, a nation ringed by walls would only imprison itself.

Watch the full speech: