Former U.S. president Barack Obama made a point of highlighting his admiration for Justin Trudeau on Wednesday, saying the prime minister's approach to politics is close to his own.

Obama, who endorsed Trudeau toward the end of the recent federal election campaign, made the remarks during a one-hour question-and-answer session before a sold-out crowd of 9,000 at the Scotiabank Centre in Halifax.

The 58-year-old former president mentioned Trudeau and former prime minister Stephen Harper when he was asked to talk about the greatest challenges facing Canada-U.S. relations.

After a dramatic pause, which left the crowd nervously chuckling, Obama said he wasn't too worried about Canada.

"Of all the things I stress about, U.S.-Canada relations are not high on that list," he said. "Which is not to say there aren't significant bilateral issues."

Obama, dressed in a dark blazer and white dress shirt, noted that his two-term presidency — from 2009 until 2017 — overlapped with the Conservative government led by Harper and the Liberal government led by Trudeau, who first assumed power in 2015.

"Very different politics ... and although my own politics are obviously much closer to Justin's, we were able to do good work with Stephen Harper's government on a range of issues, and on some we disagreed — and it was fine."

Obama argued that U.S. and Canadian values are strongly aligned.

"Let's face it," he said. "When you guys show up in the U.S., we can't tell you're Canadian half the time. You're kind of infiltrating us, and we don't know it."

Obama made headlines across Canada on Oct. 16 — five days before election day — when he tweeted his support for Trudeau, saying he was proud to work with the prime minister when he was president.

"He's a hard-working, effective leader who takes on big issues like climate change," the tweet said. "The world needs his progressive leadership now, and I hope our neighbours to the north support him for another term."

The tweet energized the Trudeau campaign, but it also raised questions about political interference in the campaign.

Obama's Halifax event took place against the backdrop of an historic day in Washington, D.C., where the first public hearing was held in the impeachment inquiry for U.S. President Donald Trump.

The House Intelligence Committee is looking into allegations the president planned to withhold military aid to Ukraine unless the new leadership agreed to investigate the son of Trump's Democratic rival Joe Biden.

Obama never mentioned Trump by name in Halifax, but he made a point of talking about polarization in politics and the dangerous internal trends that can develop into conflict.

"There were times where I felt as if the polarization we're seeing, not just in the United States but in a lot of democracies around the world, has taken a dangerous turn. But what I've continued to insist on is that we have more in common than what separates us."

He said there are two competing narratives about how societies organize themselves, the oldest of which is a tribal system in which "might makes right" and racial differences are viewed with suspicion and fear.

While this system inevitably leads to conflict, the more recent narrative preaches inclusiveness, caring for the weak and respect for women and those with different sexual orientations.

"The danger for Canada, for the United States and Western Europe is: how do you strengthen that second story?" he said. "If a nation is built around an idea of 'us and them' and it's a zero-sum game based on power and ethnicity ... sooner or later there's a war."

Reclining in a wing chair, his legs crossed and his collar open, Obama appeared relaxed as he offered his views about climate change, globalization, China, democracy and family life in the White House.

And he had plenty of good things to say about Canada.

"There is a spirit in Canada that is unique and worth feeling very good about," he said. "The people here are still modeling the kind of civility and tolerance and thoughtfulness that is required for a democracy, and I hope that continues."

Asked how he dealt with the stress of leading a superpower, Obama said: "I was pretty good at working out."

He said he also believes he was good at making decisions about complex problems, but admitted that his darkest day in the Oval Office was Dec. 14, 2012, when a gunman used a semi-automatic rifle to kill 26 people — including 20 children — at Sandy Hook Elementary School in Newtown, Conn.

"I had to speak at a memorial just two days later with the parents," he said, later referring to the "drumbeat of mass shootings" that occurred during his term in office.

"One of my biggest frustrations during my tenure as president was the inability for me to get Congress to respond in any meaningful way to that tragedy."

Obama, the 44th president of the United States and the first African-American to hold the office, is on a speaking tour that started in St. John's, N.L., on Tuesday and was to move on to Montreal on Thursday.

This report by The Canadian Press was first published Nov. 13, 2019.