Official White House Photo by Pete Souza(ATHENS, Greece) — President Barrack Obama lauded the importance of democracy in a speech in Athens Wednesday, and warned against the dangers of isolationist policies.

Over time “different views of power and governance often prevailed — the belief that might makes right or that unchecked power is passed through bloodlines; the belief that some are superior by virtue of race or faith or ethnicity, beliefs that so often justified conquest and war,” he said.

But the idea of democracy never died, he continued.

“Open, democratic societies can deliver more prosperity because when people are free to think for themselves and share ideas and discover and create — including on the internet — that’s when innovations are unleashed,” he said. “That’s when economies truly flourish.”

The president acknowledged that democracy can be messy but “citizens must be able to choose their own leaders, even if your candidate doesn’t always win.”

He added, “And as you may have noticed, the next American president and I could not be more different. We have very different points of view but American democracy is bigger than any one person … and why in the coming weeks my administration will do everything we can to support the smoothest transition possible because that’s how democracy has to work.”

On the campaign trail, President-elect Donald Trump attacked the nation’s trade policies, arguing that globalization has “made the financial elite who donate to politicians very, very wealthy … but it has left millions of our workers with nothing but poverty and heartache.”

Trump has threatened to pull out of NAFTA and kill the Trans-Pacific Partnership, which was negotiated by Obama.

On Wednesday, Obama recognized that people who are fearful of losing control instinctively push back. But he said, “We can’t look backwards for answers.”

“With our integrated economies, it’s simply not possible to cut ourselves off from one another — our supply chain is global; our growth comes through innovation,” he said. “The jobs of tomorrow will be different from the jobs of the past. So, what is the answer? We must not sever the connections that have enabled so much progress.”

Obama also emphasized that the U.S. will continue to stand with its NATO allies.

Trump has described NATO as “obsolete” and suggested that he may not honor the organization’s most sacred covenant of mutual defense in the face of outside aggression.

But during Obama’s and Trump’s meeting last week at the White House, Obama said Trump told him he would maintain a strong commitment to NATO.

“It’s why we stand together in NATO, an alliance of democracies. In recent years we’ve made historic investments in NATO, increased America’s presence in Europe. And today’s NATO, the world’s greatest alliance, is as strong and as ready as it’s ever been,” Obama said. “And I am confident that just as America’s commitment to the transatlantic alliance has endured for seven decades, whether it’s been under a Democratic [or a] Republican administration, that commitment will continue, including our pledge and our treaty obligation to defend every ally.”

Obama also pointed to democracy as a way to negotiate “peaceful resolution of disagreements.”

“It is my belief that democracies are more likely to try to resolve conflicts between nations in a way that does not result in war. That’s why with diplomacy we were able to shutdown Iran’s nuclear weapons program without firing a shot. With diplomacy the United States opened relations with Cuba. With diplomacy we joined Greece and nearly 200 nations in the most ambitious agreement ever to save our planet from climate change,” he said.

The president next heads to Germany, where he will meet with German Chancellor Angela Merkel and other European leaders. He will end his final overseas tour as president in Peru.