Speaking in Greece at a joint news conference with Greek Prime Minister Alexis Tsipras, President Obama warned against the sense of "tribalism" taking root in the populist movements around the world. (The Washington Post)

ATHENS — President Obama warned Tuesday that Americans and people around the world “are going to have to guard against a rise in a crude sort of nationalism, or ethnic identity, or tribalism” taking root amid the populist movements that are gaining currency around the world.

Speaking at a joint news conference with Greek Prime Minister Alexis Tsipras by his side, Obama refrained from criticizing President-elect Donald Trump directly as he discussed the impact of his electoral victory last week. But the president made it clear that he sees a dark side to the kind of populist movements Trump's campaign embodied — ideals that other conservative leaders are advocating in Europe and elsewhere.

“We are going to have to guard against a rise in a crude sort of nationalism, or ethnic identity or tribalism that is built around an us and a them, and I will never apologize for saying that the future of humanity and the future of the world is going to be defined by what we have in common, as opposed to those things that separate us and ultimately lead us into conflict,” Obama said.

“Take Europe,” he continued. “We know what happens when Europeans start dividing themselves up and emphasizing their differences and seeing a competition between various countries in a zero-sum way. The 20th century was a bloodbath.”

Obama, who made it clear during the course of the hour-long news conference that he did not view the recent U.S. election results as a referendum on his own tenure or world vision, suggested that targeting specific racial, religious ethnic groups could backfire.

“In the United States we know what happens when we start dividing ourselves along the lines of race or religion or ethnicity. It is dangerous. It is dangerous, not just for the minority groups that are subjected to that kind of discrimination, or in some cases in the past, violence, but because we then don’t realize our potential as a country when we are preventing blacks or Latinos or Asians or gays or women from fully participating in the project of building American life,” he said.

“So my vision is right on that issue, and it may not always win the day in the short term in any particularly political circumstance, but I am confident it will win the day in the long term,” Obama added. “Because societies which are able to unify ourselves around values and ideals and character, and how we treat each other, and cooperation and innovation, ultimately are going to be more successful than societies that don’t.”

The president suggested that a number of factors contributed to Trump's win.

“Presidential elections, they turn on personalities, they turn on how campaigns are run, they turn on natural desires for change if you’ve had an incumbent who’s been there for eight years; there’s a temptation to think, ‘Well, let’s maybe make a change,’ " he said. “I think there are a whole range of factors involved.”

The president said there was “a mismatch” between his own job approval rating, which stood at 56 percent just before Election Day, and Democrats' loss of the White House. “People seem to think I did a pretty good job,” he said.

But Obama acknowledged that there was a common theme in the recent U.S. presidential election, Britain's vote in June to leave the European Union, and other populist movements elsewhere.

“Globalization, combined with technology, combined with social media and constant information, have disrupted people’s lives, sometimes in very concrete ways,” he said. “But also psychologically, people are less certain of their national identities or their place in the world. It starts looking different and disorienting.”

“And there is no doubt that has produced populist movements, both from the left and the right, in many countries in Europe. When you see a Donald Trump and a Bernie Sanders, very unconventional candidates, have considerable success, obviously there’s something there that’s being tapped into,” he said. “I think at times of significant stress, people are going to be looking for something, and they don't always know exactly what it is that they're looking for, and they might opt for change, even if they’re not entirely confident what that change will bring.”

Obama had hoped that his visit to Europe would reassure America's allies as he prepared to leave office. But it has been dominated by questions about what a Trump presidency means for the long-standing transatlantic alliance.

Tsipras, for his part, thanked Obama for his support over the years and said he was hopeful the U.S.-Greece alliance would remain unchanged.

Echoing Obama’s recent remarks, Tsipras warned that it would be difficult for Trump to “radically change the foreign policy of a country such as the United States.” He urged his fellow European leaders to work with the new president, by building “bridges, not walls.”

Both Tsipras and Greek President Prokopis Pavlopoulos met with Obama on Tuesday, and they pressed him to lobby European Union officials to forgive some of Greece's debt as well as accept some of the refugees now stranded in the country.

“We strive to make all our partners understand that it is our duty to stay on the path of European integration, far from phobic syndromes and lack of solidarity, which can only undermine our common European future,” Pavlopoulos said.

During the news conference, Tsipras said his government was committed to making institutional reforms. Additional debt relief, he said, would make it more politically acceptable “because after seven years, people cannot take any more austerity.”

Jaffe contributed to this report from Washington.