Former US President Barack Obama voiced his support on Wednesday for Canadian Prime Minister Justin Trudeau, who faces a tough battle for re-election next week.
"I was proud to work with Justin Trudeau as President," Obama said in a tweet. "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 two progressive leaders formed a close friendship that has remained a popular topic on social media since Obama, a Democrat, left the White House in January 2017. They were spotted having dinner together at an Ottawa restaurant earlier this year.
"Thanks my friend," Trudeau responded on Twitter. "We're working hard to keep our progress going."
Trudeau was the first Canadian prime minister the United States honored with a state dinner in almost two decades when Obama invited him and his wife to Washington in March 2016 after Trudeau won power the previous October.
Trudeau has had a rockier relationship with Obama's Republican successor, Donald Trump.
Opinion polls strongly suggest Trudeau will lose his parliamentary majority in Monday's election.
It is not the first time Obama has endorsed a foreign leader. He tweeted his support for Emmanuel Macron ahead of France's 2017 presidential election.
The US Embassy in Ottawa declined to comment on the endorsement on the grounds that Obama is a private citizen.
The Conservatives and left-leaning New Democrats - the two main opposition parties contesting the election - did not immediately respond to requests for comment.
Elections Canada, the country's nonpartisan elections administrator, said Obama's tweet did not contravene regulations on foreign interference.
"It's free speech. The only issue would be if Mr. Obama started to spend money on Mr. Trudeau's campaign," spokesman Pierre Cadieux said by phone.
"A foreign citizen tweeting, or speaking at an event organized in Canada, does not by itself constitute an instance of undue foreign influence," he later clarified by email.
"Whether expenses were incurred, who incurred them and for what reason would be among the factors that need to be considered before determining if undue foreign influence has taken place."