ATHENS — In an address aimed at a global audience as well as Americans at home, President Obama said Wednesday that “the current path of globalization needs a course correction,” even as he argued there was no turning back from an interconnected world.

“In the years and decades ahead, our countries have to make sure that the benefits of an integrated global economy are more broadly shared by more people, and that the negative impacts are squarely addressed,” he said.

The speech, given before a supportive crowd in the newly opened Stavros Niarchos Foundation Cultural Center, represented the third time in as many days that Obama has sought to grapple with the wave of political discontent that swept Donald Trump into the White House last week and has roiled politics in Europe as well as other regions of the world.

On Tuesday night, a few thousand globalization opponents sparred with police during protests in Athens.

Paying homage to Greece’s role as the birthplace of democracy, the president prompted a laugh when he said it was essential to defend ideals including freedom of speech, religion and “free and fair elections–because citizens must be able to choose their own leaders, even if your candidate doesn’t always win.”

Greece, he added, gave humanity “the most precious of gifts — the truth, the understanding that as individuals of free will, we have the right and the capacity to govern ourselves.”

Every country ” travels its own path, every country has its own traditions,” Obama said. “But what I also believe, after eight years, is that the basic longing to live with dignity, the fundamental desire to have control of our lives and our future, and to want to be a part of determining the course of our communities and our nations — these yearnings are universal.”

But he acknowledged the kind of “inclusive economies” and social tolerance he espouses have come under strain, as the glaring inequality between the world’s economic classes has become more evident and different cultures have come into closer proximity with each other.

“Democracy is simplest where everybody thinks alike, looks alike, eats the same food, worships the same God,” Obama said. “An inequality that was once tolerated because people didn’t know how unequal things were now won’t be tolerated because everybody has a cellphone and can see how unequal things are.”

“If people feel that they’re losing control of their future, they will push back,” he warned. “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.”

Obama rose to global prominence by addressing tens of thousands of supporters outside in Berlin, but his speech Wednesday — which may be his final formal address overseas — was a more subdued affair. An audience of several hundred invited guests sat inside a hall that resembled an opera house or old-fashioned theater, with rings of balconies marked by ruby-red upholstery. The crowd clapped approvingly at several points during Obama’s remarks, but appeared more focused on his approving references to Greece’s economic plan and willingness to host refugees than his broader remarks.

In an email last week, George Papandreou, who served as Greece’s prime minister from 2009 to 2011, said it was essential that Obama address the issue of how to “humanize” and “democratize” globalization in order to defuse the “divisive politics of fear” that has begun to gain currency around the world.