Outgoing US president Barack Obama warned of the rise of "crude nationalism and tribalism" in the wake of the Brexit vote and the election of Donald Trump in the US presidential election.

"We are going to have to guard against a rise of crude nationalism and tribalism being built around us," Obama said in Athens in his final foreign tour as president.

"The more aggressively and effectively we deal with economic dislocation and inequality, the less likely these fears will channel into counterproductive approaches that can pit people against each other."

It comes amid fears that Trump's victory could help right wing populist parties across the West seize power, and break apart international alliances which have been in place since World War II.

Obama said the UK's vote to leave the EU and the US vote showed that people generally were now "less certain of their national identities and place in the world"

"Sometimes people in situations of stress just opt for changes and feel as if they want to shake things up even if they are not confident what that will bring," Obama said in a joint new conference with Greek prime minister Alexis Tsipras.

He added: "The lesson I draw is that we have to deal with issues like inequality, economic dislocation, people's fears that their children will not do as well as they have."

Obama expressed scepticism over whether the solutions offered by Trump would "ultimately satisfy popular grievances".

He reaffirmed his belief in his vision in which "the future will be decided by what we have in common, rather than what leads us into conflict".

Among Trump's controversial campaign trail claims was his insistence that the US would pull back on its commitment to the Nato if other members "weren't paying their bills". Amid increasing Russian aggression, the claims have caused fear in Baltic Nato members.

Earlier, Obama said that there was no question of the US wavering in its Nato commitments.

"I think that's one of the most important functions I can serve at this stage, during this trip, that there is no weakening of resolve when it comes to America's commitment to maintaining a strong and robust Nato relationship," Obama said.