Barack Obama is urging Canadians to reelect Justin Trudeau, the prime minister, in an apparently unprecedented endorsement of a candidate in a Canadian election by a former American president.

Mr Obama tweeted on Wednesday he was proud to work with Mr Trudeau and described him as a hard-working, effective leader who takes on big issues like climate change.

“The world needs his progressive leadership now, and I hope our neighbours to the north support him for another term,” he wrote.

The Canadian prime minister later responded with his own tweet: “Thanks my friend, we’re working hard to keep our progress going.”

Mr Trudeau is in a tough reelection fight ahead of Monday’s parliamentary elections.

A Sneak Peak At Justin Trudeau's Marvel Debut Show all 4 1 /4 A Sneak Peak At Justin Trudeau's Marvel Debut A Sneak Peak At Justin Trudeau's Marvel Debut Marvel A Sneak Peak At Justin Trudeau's Marvel Debut Marvel A Sneak Peak At Justin Trudeau's Marvel Debut Marvel A Sneak Peak At Justin Trudeau's Marvel Debut Marvel

Robert Bothwell, a professor of Canadian history and international relations at the University of Toronto, said that might have something to do with Mr Obama’s intervention.

“Trudeau is in real danger,” he said. “If I were a Liberal (Party) campaigner I would quietly point with pride to Obama’s endorsement. I don’t know if I’d run around toting it as a major political issue.”

Mr Bothwell said you would have to go back more than 100 years to find an American president intervening in a Canadian federal election.

He said the former US president Theodore Roosevelt, who was president from 1901 to 1909, visited Toronto in 1917 when Canada was having an election about conscription and spoke in favour of it. But Mr Bothwell said he didn’t know how explicit he was.

Nelson Wiseman, a political science professor at the University of Toronto, called Mr Obama’s endorsement rare and said it possibly has not happened before but he does not think it will move the polls.

“In fact, some people may feel this is an unwarranted foreign intrusion in Canada’s election,” he said.

Support free-thinking journalism and attend Independent events

The former president also endorsed Emmanuel Macron for president in France’s 2017 election, and he warned British voters against backing leaving the European Union.

Mr Trudeau formed a close relationship with Mr Obama when he was president and the two were pictured having dinner in Ottawa earlier this year.

The former president has long been popular with many Canadians. Mr Trudeau’s Liberal Party posted Mr Obama’s message into a party fundraising pitch that was emailed directly to potential donors

The Canadian prime minister’s rival, Conservative leader Andrew Scheer, said that he is “not very interested what former foreign leaders are saying”.

He said he would let Canadians judge whether Mr Obama’s endorsement is appropriate.