Former President Barack Obama warned against nationalist and authoritarian movements during his speech in Canada, declaring he’s convinced that “the future does not belong to strongmen.”

Mr. Obama did not mention President Trump directly in his speech Tuesday, but took several veiled shots at his successor while addressing the Montreal Chamber of Commerce.

“In an age of instant 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,” Mr. Obama said.

“In some cases, that may lead people to search for certainty and control,” he continued. “And they can call for isolationism or nationalism or they can suggest rolling back the rights of others, or simply, they can try to retreat and suggest that we have no obligations beyond our borders.”

“Those instincts of retrenchment are understandable. They’re tempting during changing times,” he added.

Mr. Obama said the public’s cynicism and lack of trust in politicians can often turn people onto “populist alternatives” who “may not actually deliver, but are tempting.”

The former president took aim at Mr. Trump’s immigration policies, saying Western countries cannot “pull up a drawbridge” on immigrants and refugees in search of democracy.

“I believe we cannot unwind integration,” he said. “It’s important for us to establish processes to make sure that we reaffirm that we are nations of immigrants, that it creates dynamism in our economies, strengthens us rather than weakens us, and do so in a way that also upholds our tradition of lawfulness.”

Mr. Obama also lamented Mr. Trump’s decision last week to withdraw the United States from the 2016 Paris Agreement on addressing climate change.

The deal, “even with the temporary absence of American leadership, will still give our children a fighting chance,” he declared.

The former president urged the public to “push back on propaganda,” “cultivate independent journalism” and work on finding common ground with whom they disagree.

“If our citizens’ expectations are not met and they believe they have no control over the decisions that are made by distant bureaucrats or dysfunctional government, then they will try anything and they’ll turn to populist or nationalist or even authoritarian movements,” Mr. Obama said.

“The bottom line is democracy is hard,” he said. “And progress does not always move in a straight line. And its gains are often fragile if we as citizens are not tilling the soil and maintaining that democracy.

“But having said that, the good news is I am convinced the future does not belong to strongmen,” he said. “I believe deeply that the liberal international order is based not just on military power or national affiliations, but on principles, on rule of law, on human rights, on individual freedoms, on empathy, on understanding across cultures — that’s our only choice.”

After his rare post-presidency speech, Mr. Obama had dinner with Canadian Prime Minister and Liberal Party leader Justin Trudeau at the Liverpool House in Montreal’s Little Burgundy neighborhood.

How do we get young leaders to take action in their communities? Thanks @BarackObama for your visit & insights tonight in my hometown. pic.twitter.com/EwJXPEkN3w

— Justin Trudeau (@JustinTrudeau) June 7, 2017