ATHENS, Greece Pushing back against the forces of isolationism, President Obama stood at the birthplace of democracy on Wednesday and declared it’s time for a “course correction” to ensure that the benefits of technology and globalization are more broadly shared.

Reducing inequality, he said, creates societies where people are “less likely to turn on each other, less likely to appeal to some of the darker forces” that tear people apart.

With the U.S. presidential election of Republican Donald Trump laying bare frustrations and dissatisfaction in America, Mr. Obama acknowledged the forces that would try to turn the clock back.

“[T]here are at times movements from both the left and the right to put a stop to integration, and to push back against technology, and to try to bring back jobs and industries that have been disappearing for decades,” Mr. Obama said in a speech to the Greek people at the end of the first leg of his farewell foreign tour as president. “So this impulse to pull back from a globalized world is understandable. If people feel that they’re losing control of their future, they will push back.”

But he had this message to leaders and people around the globe: “We can’t look backward for answers, we have to look forward.”

Get Breaking News Delivered to Your Inbox

The president said the path to more inclusive economies is known, but “we too often don’t have the political will or desire to get it done.” Workers, he said, must have “more leverage and better wages,” and he added that we have to invest more in our young people, encourage entrepreneurship and modernize our infrastructure.

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

Obama cited both last week’s election of Trump and the June vote by Britain to leave the European Union as evidence of the inclination to pull back.

“The current path of globalization demands a course correction,” he said. “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.”

“That’s how democracies can deliver the prosperity and hope that our people need,” Obama said.

Before Trump’s victory, Obama’s speech to the Greeks had been envisioned to be a capstone moment for his presidency, harking back to the origins of democracy as he expected to hand off to fellow Democrat Hillary Clinton. Instead, Obama’s legacy is in doubt as Trump prepares to take power and promises to undo much of the president’s agenda. Obama spoke out in defense of his agenda: the Iran-nuclear deal, a global climate change pact, establishing relations with Cuba and more.

“The next American president and I could not be more different,” Obama said. But, he said, “democracy is bigger than any one person.” He renewed his pledge to ensure a peaceful transition despite his differences with Trump.

Obama’s words are being watched closely by world leaders. They see parallels between Trump’s ascension and the rise of far-right and populist movements in their own countries amid continued economic anxiety.

Greek Prime Minister Alexis Tsipras won elections last year on what critics say was a populist platform, though one on the left of the political spectrum. He pushed his formerly small radical left party onto the forefront by telling Greeks weary from six years of financial crisis and falling living standards that he would reject austerity measures imposed in return for the country’s bailouts.

But after the near collapse of negotiations with Greece’s creditors - other European countries using the euro currency, and the International Monetary Fund - 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.

Before Obama’s speech, he toured Greece’s most famous ancient monument, the Acropolis citadel. Obama passed through the Propylaea, the monumental gateway that serves as an entrance to the site, and walked along the Parthenon temple, which is dedicated to the goddess Athena, considered the patron of Athens.

The U.S. president lingered at the base of the Parthenon, gazing at the columns and glancing around at the panoramic view of Athens as he chatted with his guide, Eleni Banou of the Culture Ministry’s antiquities division.

The 5th century B.C. temple is surrounded these days by scaffolding as part of a maintenance project. The entire site was closed to the public for the day for Obama’s visit, which has taken place 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.

Greece’s government hoped Obama would help persuade some of Greece’s more reluctant international creditors to grant debt relief, and pressure other European countries to share more of the burden of the continent’s refugee crisis.

Obama was receptive to Greece’s woes and repeated his belief that debt relief is necessary. He said Greece must continue putting in place painful reforms it signed up to in return for successive international bailouts. It is questionable how much of this stance will also be adopted by Trump.

Greece is struggling to deal with hundreds of thousands of refugees who have crossed Greece’s borders on their way to more prosperous European countries. A reluctance by many other EU countries to host refugees has left more than 60,000 people stranded in Greece. Many are living in poor conditions in massively overcrowded camps.

Obama said the Greeks cannot be expected to bear the bulk of the burden on their own. It demands “a truly collective response by Europe and the world,” he said.

Obama’s next stop on his final foreign tour is Germany, followed by Peru.