President Obama urged Canadians and Americans on Wednesday to resist the politics of fear and isolationism behind the Brexit vote and Donald Trump's nomination, which he said threaten inclusion, equality and tolerance.

Without naming Donald Trump, Obama attacked his policy prescriptions in an address to the Canadian Parliament, arguing that scapegoating immigrants is just an attempt for nostalgic Americans fed up with their situation "to regain control" of their lives.

Restricting trade and "giving in to protectionism," he argued, will not work because the global economy already exists and there is no way to reverse it.

"Even if we wanted to, we can't seal ourselves off from the rest of the world," he said. He noted that the day after the Brexit vote, "people looked around and said, 'Oh, how is this going to work?'"

It's a false choice, he said, to say that the U.S. and other advanced countries can't have economic inclusion to help lift others out of extreme poverty, and also have economic growth.

"Wealthy countries like ours cannot reach our true potential while others remain mired in poverty," he said.

On immigration, he said Canada and the U.S. share a common history of beginning as a nation of immigrants. "We must continue to welcome people from around the world … this is not just a matter of economics," he said.

Obama also encouraged more countries to accept refugees, including those from Syria. "We certainly can't label as possible terrorists vulnerable people who are fleeing terrorism," he said.

Instead of fanning fears against Muslims, the U.S. and Canadian authorities need to be working for greater collaboration with the Muslim community to defeat terrorism.

"They can and must be our partners," he said to a standing ovation, one of several during the speech.

He specifically thanked Canada for hosting secret talks between U.S. and Cuban officials that led the effort to normalize diplomatic relations and initiate commerce between the two countries.

Obama's address was a campaign-style speech that stressed the shared ties that bind the U.S. and Canada, and called on citizens of both countries to build on its common set of values, what he said was a belief in "pluralism, tolerance, rule of law, global engagement and commerce."

As president, Obama said he has deepened the ties between Canada and the United States and the two countries are more "closely aligned than every before" and are united by the longest border of peace on earth.

While Canada and the U.S. have helped build international order, he said that order is increasingly strained and "we meet at a pivotal moment for our nations and the globe."

The world is less violent, more prosperous and connected than every before, but alongside globalization and technological advances, he said the world has seen a rise in "inequality and wage stagnation across" advanced economies leaving "too many workers and communities fearful of diminishing prospects."

If Democracies around the world fail to assure "broad-based growth and opportunity for everyone," then "people will push back out of anger and fear and politicians, some sincere and some entirely cynical will tap that anger and fear harkening back to bygone days of order and predictability and national glory, arguing that we must rebuild walls and disengage from a chaotic world."