ATHENS — President Obama warned against what he's called a "crude nationalism" in a speech to the Greek people Wednesday, saying tensions caused by globalization and income inequality threaten to divide Western nations along ethnic, religious and class lines.

In a speech seemingly addressed as much to domestic politics as foreign affairs, Obama argued that technology and global connections have resulted in unprecedented prosperity, but too often at the expense of income inequality and disruption. And he called for a "course correction" of the global economy to make sure everyone sees its benefits.

"If people feel that they’re losing control of their future, they will push back. We have seen it here in Greece. We’ve seen it across Europe. We’ve seen it in the United States. We saw it in the vote in Britain to leave the EU," Obama said. "Governing institutions, whether in Athens, Brussels, London, Washington, have to be responsive to the concerns of citizens."

The speech came as Obama prepares to hand over power to President-elect Donald Trump, whose upset victory was fueled in part by anxieties about immigration, globalization and trade.

"As you may have noticed, the next American president and I could not be more different," he told the audience at an Athens theater, to laughter and applause. "We have very different points of view, but American democracy is bigger than any one person."

"In a multi-ethnic, multiracial, multicultural society, like the United States, democracy can be especially complicated," he said. "Believe me, I know."

Obama promised the "smoothest transition possible."

In delivering the speech in the birthplace of democracy, Obama also emphasized that Trump's brand of populism is not a uniquely American phenomenon. And he said technology was helpoing to create "a volatile politics" by exposing differences within and between countries.

"In our globalized world, with the migration of people and the rapid movement of ideas and cultures and traditions, we see increasingly this blend of forces mixing together in ways that often enrich our societies but also cause tensions," he said. "Faced with this new reality where cultures clash, it's inevitable that some will seek a comfort in nationalism or tribe or ethnicity or sect."

And that, in turn, has created distrust between people and their governments, Obama said. "There's a growing suspicion — or even disdain — for elites and institutions that seem remote from the daily lives of ordinary people. What an irony it is, at a time when we can reach out to people in the most remote corners of the planet, so many citizens feel disconnected from their own governments," he said.

It's no coincidence that Obama gave the speech in Greece, which has borne the brunt of many of the economic and social forces roiling Europe. But it also has the longest tradition of self-governance. "it was here, 25 centuries ago, in the rocky hills of this city, that a new idea emerged: Demokratia," he said. "The notion that we are citizens — not servants, but stewards of our society."

Underscoring the symbolism of the venue, Obama took an hour before his speech to tour the Acropolis, the home of the iconic hilltop Athens ruins that have become an enduring symbol of Western civilization itself. As a tour guide showed him around, the Acropolis was totally empty, except for Obama, his entourage and a few stray cats.

Obama also used his speech to thank the Greek people for their compassion to the Middle Eastern migrants arriving on their shores. "The Greek people’s generosity towards refugees arriving on your shores has inspired the world. That doesn’t mean that you should be left on your own, and only a truly collective response by Europe and the world can ensure that these desperate people receive the support that they need."

And he pledged support for Greece's attempts to reform its economy — and to seek debt relief — in response to the economic crisis there. "I will continue to urge creditors to take the steps needed to put Greece on a path towards sustained economic recovery," he said. "It is important because if reforms here are going to be sustained, people need to see hope, and they need to see progress."

Obama then flew to Berlin, where he'll meet with German Chancellor Angela Merkel and other European leaders, whose banks are some of Greece's biggest creditors.