President Barack Obama is warning that advanced economies everywhere must stand guard against a rise of a “crude sort of nationalism” arising from voter discontent of the kind seen in the recent US presidential election and in Britain's vote to leave the European Union.

On a state visit to Greece, Mr Obama listed what he said were differences between Brexit and the US presidential race, which ended with the surprise election of Donald Trump. Americans choose their leaders in part depending on how campaigns are run and also by personalities, he said. But in the same breath, he acknowledged “common themes” in both events.

“Globalisation combined with technology, combined with social media and constant information, have disrupted people's lives sometimes in very concrete ways,” he said. “A manufacturing plant closes and suddenly an entire town no longer has what was the primary source of employment.” He said beyond economic disruptions, people are also affected 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 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, then obviously there's something there that's being tapped into – a suspicion of globalisation, a desire to rein in its excesses, a suspicion of elites and governing institutions that people feel may not be responsive to their immediate needs,” Mr Obama said.

Standing beside Alexis Tsipras, the Greek Prime Minister and his host at a joint news conference on Tuesday, Mr Obama defended his own world view, which he said was the “right one”, where the priority is unifying people not driving wedges between different constituencies.

Mr Obama's visit was marred by large protests against him on the streets of the Greek capital, leading to repeated clashes with police who repelled some of those marching with tear gas.

About 7,000 people, among them many hooded protesters and members of the Communist-affiliated group PAME, marched throughcentral Athens holding banners reading 'Unwanted', Reuters reported.

Loading....

“We have to guard against a rise in a crude sort of nationalism or ethnic identity or tribalism that is about an ‘us’ and a ‘them’,” he declared. “I will never apologise 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 divide us and ultimately lead us into conflict.”

He said he stood by that as his guiding philosophy during eight years as President and that his high approval rating suggested that he was still winning that argument. “Last I checked, a pretty healthy majority of the American people agree with my worldview on a bunch of things.”

His expression of confidence in his own approach begged the question as to how, if that was the case, his own candidate to succeed him, Hillary Clinton, had failed to capture enough votes last week. If the answer was that she had simply been a poor candidate, he wasn’t going to say it.

But he stressed voters’ desire for change, even if it can be inchoate. “History does not move in a straight line, it zigs and zags,” Mr Obama said. “At times of significant stress people begin to look for something and they don’t always know exactly what it is they are looking for. People are looking for change even if they are not entirely confident of what that change will bring.”

“Sometimes people just feel as if we want to try something and see if we can shake things up,” he said.

There was a slightly jarring moment in the press conference when an American television journalist asked him to comment on the ascendance in Europe of the British Prime Minister Theresa May and Marine Le Pen, the leader of the Front national in France. Mr Obama was quick to chide the reporter for lumping the two politicians together.

He then offered on his own thoughts on how leaders can counter voter unrest and reconnect with what is disturbing them.

“The lesson I draw ... the lesson that cuts across countries is we have to deal with issues like inequality, we have to deal with issues like economic dislocation, we have to deal with people’s fear that their children won’t do as well as they have. The more aggressively and effectively we deal with those issues the less those fears may channel themselves to counterproductive approaches that pit people against each other.”

“Frankly that has been my agenda for the last eight years,” Mr Obama added, listing investing in infrastructure, raising wages and widening access to education. As to why he hadn’t done a better job himself in those regards, which could have pre-empted the Trump victory, he said he could get the Republican-led Congress to pass some of his initiatives.