Standing in democracy's birthplace, President Barack Obama on Wednesday issued a parting plea to world leaders not to let the fear of globalization tugging at Europe and the U.S. pull them away from their core democratic values. He argued it wasn't too late for a course correction.

On his last foreign trip as president, Obama has repeatedly tried to draw lessons from Donald Trump's victory in the U.S. presidential election, hoping it can serve as wake-up call in the U.S. and abroad. Conceding that many feel left behind by globalization, Obama said there was an understandable impulse toward isolationism and that if people feel their futures are at risk, "they'll push back."

"People have to know that they're being heard," Obama said in a speech to the Greek people in Athens. But, he added, "We can't look backward for answers. We have to look forward."

While fewer people in the U.S. are looking to Obama for direction now that his successor has been chosen and his agenda largely rebuked, Obama has retained significant clout abroad. His message Wednesday appeared aimed at other world leaders facing pressures of nationalist movements and economic anxiety, exemplified by Britain's recent vote to leave the European Union.

From Greece, Obama took a short flight to Germany, which has emerged as one of the strongest voices for preserving a unified, inclusive Europe. Yet even German Chancellor Angela Merkel faces her own threat from a nationalist right-wing movement, fueled in part by anger over her generous policy toward resettling Syrian migrants pouring into Europe.

"We cannot sever the connections that have enabled so much progress," Obama said.

Obama's argument centered on the notion that economic inequality, while a growing problem, can be addressed without a full rejection of globalization. Rather, he said it demanded a "course correction."

"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."

Obama argued nations must strengthen alliances and expressed his confidence that the U.S. would remain loyal to NATO despite Trump's suggestions to the contrary during the 2016 presidential campaign.

He elicited nervous chuckles as he acknowledged that he and the president-elect "could not be more different." But in a message of reassurance, Obama argued that democracy is bigger than any one person.

"As long as we retain our faith in democracy, as long as we retain our faith in the people, as long as we don't waver from those central principles that ensure a lively, open debate, then our future will be ok," Obama said.

And to listeners at home fearful about Trump, he offered a path out of the wilderness, albeit a long and winding one.

"Any action by a president, or any result of an election, or any legislation that is proven flawed can be corrected through the process of democracy," Obama said.

Though Obama's trip to Greece was planned before the election results were known, the White House hoped the setting would form a powerful reminder of the basic tenets of democracy: fair elections, a free press and tolerance for ethnic, religious and sexual minorities.

Before his speech, Obama climbed up the Acropolis, the ancient citadel that serves as a monument to free thought and artistic expression. He strolled through the Propylaea, the complex's monumental gateway, and gazed up at the famed Parthenon temple dating to the 5th century B.C.

The entire site was closed to the public for Obama's visit, which has played out amid stringent security measures. Demonstrations were banned in parts of Athens, and road and subway stations were shut down for the first official visit of a sitting U.S. president since Bill Clinton came in 1999.

Obama said concepts like minority rights and equality under the law "grew out of this rocky soil" in a democratic project not yet complete. He said inequality, on more vivid display due to widespread technology, now posed one of the biggest threats to democratic nations, their stability and prosperity.

Even in Greece, there were parallels to the deep divisions now on display in America. Greek Prime Minister Alexis Tsipras won elections last year on what critics say was a populist platform, though one on the left of the spectrum. He pushed his formerly small party to the forefront by telling Greeks weary from six years of financial crisis that he would reject austerity measures imposed in return for bailouts.

But after the near-collapse of negotiations with Greece's creditors, Tsipras performed a political about-face: He signed up to a new bailout and more austerity to prevent his country being forced out of the euro.

Greece's government hoped Obama would help persuade some of Greece's more reluctant creditors to grant debt relief — a message they hoped he'd stress in Berlin — and also pressure other European countries to share more of the burden of the migrant crisis. Appearing receptive to Greece's woes, Obama repeated his belief that debt relief should be granted.