Former U.S. president Barack Obama delivered an extended, vicious coded critique of his successor Donald Trump on Tuesday in Canada, speaking to an audience of 6,000 fans at an event hosted by the Montreal Board of Trade.

He bashed the rise of 'extreme nationalism and xenophobia and the politics of "us-versus-them",' a clear slap at Trump in the preferred language of American liberals.

'In times of disruption we may go backward instead of forward,' he warned. 'We're going to have to replace fear with hope.'

Obama drew laughter with a thinly veiled kick at the Trump administration's famous embrace of 'alternative facts,' saying that America in the less than 20 weeks since he left office has suddenly devolved into a place 'where we don't just have disagreements based on our opinions, but now people are just disagreeing on facts.'

'And we're in an environment where we are only accepting information that fits our opinions, instead of basing our opinions on the facts that we receive. And evidence and reason and logic.

Former U.S. president Barack Obama delivered a veiled but lengthy slap at Donald Trump and his 'America first' philosophy on Tuesday in Canada

Trump, Obama warned without naming him, has led America down the path of 'extreme nationalism and xenophobia and the politics of "us-versus-them"'

In a seeming ad-lib, he cited the 18th-century European as one foundation of modern democracies, and said 'we should continue to promote those values.'

Obama claimed that in an age when some world leaders are willing to 'violate our principals because of fear and uncertainty,' progress – measured by the work of multinational coalitions and institutions' can't continue.

'We have to sustain our alliances. We have to help other countries with their own development,' he said, without explicitly mentioning Trump's 'America First' philosophy.

The alternative, Obama suggested, would see anti-democratic forces swooping in to fill the voids left by globalist cooperation.

He said the result could be 'intolerance and tribalism and organizing ourselves along ethnic lines.'

The former president defended the Paris climate accord, saying that 'even with the temporary absence of American leadership' – Trump pulled the U.S out of it last week – it 'will still give our children a fighting chance'

'The disruptions that are happening globally are going to continue to accelerate,' Obama warned. 'And what's more, in an age of instance information, where TV and Twitter can feed us a steady stream of bad news – and sometimes fake news – it can seem like the international order that we've created is being constantly tested, and that the center may not hold.'

'And in some cases that leads people to search for certainty and control, and they can call for isolationism or nationalism, or they can consider rolling back the rights of others, or simply they can try to retreat and suggest that we have no obligations beyond our borders, or beyond our communities, beyond our tribe.

'That what's good for me and my immediate people is all that matters. Everybody else is on their own.'

Obama had special praise for the Paris climate treaty, a largely voluntary 190-nation accord that President Donald Trump pulled the U.S. out of last week.

To the sound of applause, the former president pronounced it 'an agreement that, even with the temporary absence of American leadership, will still give our children a fighting chance.'

'We have shown that environmental sustainability and economic progress are not contradictory, but are complementary,' he claimed.

And he made a point of defending policies aimed at sheltering refugees – at a time when the Trump administration is fighting with federal courts to temporarily suspend America's entirely refugee program.

'That's who we are,' he said of putting a welcome mat out for refugees from war-torn regions like Syria.

Trump has argued, leaning on the statements of some terror groups, that refugee populations from the Middle East could be a 'Trojan horse' with embedded jihadis.

'We can do it in an orderly way,' he said, arguing for the continuation of a system that 'upholds our tradition of lawfulness.'

'If our people feel that immigration is disorderly, then we put at risk our ability to welcome immigrants because we see sometimes political backlash,' Obama allowed.