Former president Barack Obama has tweeted an endorsement of Liberal Leader Justin Trudeau and says he hopes Canadians give Trudeau "another term" in office.

"I was proud to work with Justin Trudeau as President," Obama wrote on Wednesday afternoon. "He's a hard-working, effective leader who takes on big issues like climate change. The world needs his progressive leadership now, and I hope our neighbors to the north support him for another term."

The endorsement of a former American president is a rare — and possibly unprecedented — event in Canadian politics. But this is the second time Obama has spoken up to endorse an international leader since he left office. In May of 2017, Obama recorded a video in which he endorsed Emmanuel Macron for the French presidency.

While it remains to be seen what impact, if any, Obama's endorsement might have on the Canadian electorate, the Liberal party has already touted his tweet to supporters in a fundraising appeal that was sent out on Wednesday afternoon.

At a campaign stop in Quebec Wednesday, Trudeau didn't answer a question about whether he or his team sought out the endorsement, saying only, "I appreciate the kind words and I'm working hard to keep our progress going."

Asked about the Obama tweet as he campaigned in Montreal, NDP Leader Jagmeet Singh said he had a lot of respect for Obama but said "in this respect he's wrong."

"Mr. Trudeau has really let down people and consistently chosen to help out the powerful and the wealthy over Canadians," Singh said, replying "no" when asked whether he thought Obama's move would hurt the NDP campaign.

Conservative Leader Andrew Scheer was also asked about the endorsement during a campaign stop in Ancaster, Ont.

"I've got millions of Canadians like the ones here tonight behind me. I'm not very interested in what former foreign leaders are saying," Scheer said. "I'm just focused on finishing this election strong and putting together and putting forward my plan to help Canadians get ahead."

Asked whether he thought Obama's tweet was appropriate, he said "I'll let Canadians be the judge of that," adding he wouldn't speculate on why Obama made the endorsement.

'Inducements by non-residents'

But Conservative Sen. Denise Batters took to Twitter on Wednesday to say that Liberal changes to election laws allowed for Obama to make this sort of endorsement without finding himself on the wrong side of Canadian law.

Guess this was Gerry Butts’ plan when the Trudeau government repealed section 331 of the Canada Elections Act last year with Bill <a href="https://twitter.com/hashtag/C76?src=hash&ref_src=twsrc%5Etfw">#C76</a>:<br>“No person who does not reside in Canada shall, during an election period, in any way induce electors to vote or refrain from voting...” 1/2 <a href="https://t.co/pGbPGHBe2K">https://t.co/pGbPGHBe2K</a> —@denisebatters

In the last Parliament, the government introduced Bill C-76, which amended the Canada Elections Act and the provisions that prohibited "inducements by non-residents" during a campaign.

In a previous version of the Elections Act, under section 331, it was forbidden for any non-Canadian citizen or permanent resident to "induce electors to vote or refrain from voting for a particular candidate."

The Liberal changes kept much of the same but allowed some exceptions.

The law became more sharply focused on foreigners who spend money to try to "unduly influence an elector."

The new act allows for foreigners to express an opinion "about the outcome or desired outcome of the election" or to make a statement supporting one registered political party over another — as long as they do not "knowingly incur any expense."

However, it is unlikely that Obama would have run afoul of the previous law in any case.

As was widely reported at the time, British comedian John Oliver made a show of trying to breach Section 331 during the 2015 election, prompting an Elections Canada spokesperson to tell The Canadian Press: "To induce there must be a tangible thing offered. A personal view is not inducement."

Close relationship between leaders

Obama and Trudeau developed a close relationship while Obama was president. He hosted Trudeau for a state dinner at the White House in March 2016.

During that visit, Obama also publicly linked his own politics and agenda with that of the prime minister.

"We've got a common outlook on what our nations can achieve together," Obama said. "He campaigned on a message of hope and of change. His positive and optimistic vision is inspiring young people. At home, he's governing with a commitment to inclusivity and equality. On the world stage, his country is leading on climate change and he cares deeply about development.

"So, from my perspective, what's not to like?"

Their last in-person meeting as president and prime minister occurred at the APEC summit in Peru in November 2016, shortly after Donald Trump won that year's American presidential election. Obama again publicly praised Trudeau before that meeting, but then privately told Trudeau that his leadership would be needed.

"Justin, your voice is going to be needed more," Obama said, according to an account first published in The World As It Is, a book by Ben Rhodes, a former foreign policy adviser to the president. "You're going to have to speak out when certain values are threatened."

During that same meeting, Obama told Trudeau to "hold the top of the hill" — apparently a reference to maintaining a foothold for progressive politics against the rise of populism and nationalism.

The personal association continued after Obama left office in January 2017.

Trudeau and Obama had dinner in Montreal in June 2017 and then met again in Ottawa in June 2019.