Canadians voted Monday in what pundits called one of the country's closest elections ever, leaving the future of Prime Minister Justin Trudeau in doubt.

Leader of the Liberal Party of Canada, Prime Minister Justin Trudeau, is on the brink of an election that could see him removed from power Leader of the Liberal Party of Canada, Prime Minister Justin Trudeau, is on the brink of an election that could see him removed from power Photo: AFP / Don MacKinnon

Surveys predicted Trudeau's Liberal Party could return with a minority government or lose its grip on power entirely.

The Liberals and the Conservatives, led by Andrew Scheer, were set for a near dead heat.

Leader of the Conservative Party of Canada Andrew Scheer has pledged to roll-back environmental protections Leader of the Conservative Party of Canada Andrew Scheer has pledged to roll-back environmental protections Photo: GETTY IMAGES NORTH AMERICA / Cole Burston

Polls opened at 1100 GMT in the Atlantic province of Newfoundland, the first of the country's six time zones. About 27.4 million Canadians are eligible to elect 338 members of parliament.

Former US president Barack Obama (R) has endorsed Canadian Prime Minister Justin Trudeau (L) for another term -- the pair are seen in Ottawa in June 2016 Former US president Barack Obama (R) has endorsed Canadian Prime Minister Justin Trudeau (L) for another term -- the pair are seen in Ottawa in June 2016 Photo: AFP / Chris Roussakis

The first results are expected starting at 2300 GMT, a few hours before voting wraps up in westernmost British Columbia.

After 40 days of campaigning, neither of the two parties that have led Canada since Confederation in 1867 was expected to secure an absolute majority of seats.

Canada's Prime Minister and Liberal leader Justin Trudeau (L) and Conservative leader Andrew Scheer take part in an election debate on October 10, 2019 Canada's Prime Minister and Liberal leader Justin Trudeau (L) and Conservative leader Andrew Scheer take part in an election debate on October 10, 2019 Photo: POOL / Adrian Wyld

Faded golden boy

At final campaign stops in British Columbia on Sunday, former golden boy Trudeau made an emotional appeal for voters to let him build on his first-term achievements.

Canadian party leaders pose for pictures before an election debate on October 10, 2019 Canadian party leaders pose for pictures before an election debate on October 10, 2019 Photo: POOL / Adrian Wyld

He warned against Scheer's pledged rollback of environmental protections, including a federal carbon tax that discourages the use of large amounts of fossil fuels.

"We need a strong, progressive government that will unite Canadians and fight climate change -- not a progressive opposition," Trudeau told a rally in suburban Vancouver.

Photo: AFPTV / Katie SCHUBAUER

"We need to unite as citizens. We need to unite as a planet."

Political makeup of Canada's outgoing parliament Political makeup of Canada's outgoing parliament Photo: AFP / Jonathan WALTER

Trudeau's star has dimmed since winning a 2015 landslide that echoed the wave of support which in 1968 carried to power his flamboyant late father Pierre, who is considered the father of modern Canada.

The younger Trudeau's image has been tainted by ethics lapses in the handling of the bribery prosecution of engineering firm SNC-Lavalin, while the emergence of old photographs of him in blackface makeup rocked his campaign.

Photo: AFPTV / Julien BESSET

Surging social democrats and resuscitated Quebec separatists have also chipped away at Liberal support.

Leader of the Liberal Party of Canada, Prime Minister Justin Trudeau, votes with his family in Montreal, Quebec, after an election campaign described as one of the country's nastiest ever Leader of the Liberal Party of Canada, Prime Minister Justin Trudeau, votes with his family in Montreal, Quebec, after an election campaign described as one of the country's nastiest ever Photo: AFP / Sebastien ST-JEAN

Trudeau, accompanied by his wife and children, voted in the morning in Montreal while Scheer, also with his family, cast a ballot in Regina, Saskatchewan in the late afternoon.

Minivan-driving dad

If Trudeau hangs on, it will be because Scheer has struggled to win over Canadians with his bland minivan-driving dad persona and a throwback to the thrifty policies of past Tory administrations.

Conservative Party leader Andrew Scheer, speaking at a rally in Richmond, British Columbia, has struggled to win over Canadians partly because of his bland minivan-driving dad persona Conservative Party leader Andrew Scheer, speaking at a rally in Richmond, British Columbia, has struggled to win over Canadians partly because of his bland minivan-driving dad persona Photo: AFP / Don MacKinnon

Canadians "cannot afford" a Liberal government propped up by the third-place New Democratic Party (NDP), Scheer said at the end of a marathon final push from the Atlantic to Pacific oceans.

"We can only imagine what the NDP's price would be to keep Justin Trudeau in power," he said.

Main socio-economic indicators for Canada. Main socio-economic indicators for Canada. Photo: AFP / Anne-Sophie THILL

"Whatever it is, we know Trudeau would pay any price to stay in power and he'd use your money to do it."

NDP leader Jagmeet Singh, a leftist former criminal defense lawyer, is the first non-white leader of a national political party, and could emerge as possible kingmaker.

The campaign has been described as one of the nastiest ever. Attack ads included false accusations that Liberals would legalize hard drugs and that the Tories would allow the proliferation of assault weapons.

At one rally, Trudeau was forced to wear a bulletproof vest.

Along the bruising way, Trudeau and Scheer traded barbs.

Trudeau evoked the bogeymen of past and current Tory parties fostering "politics of fear and division" while Scheer called the prime minister a "compulsive liar," "a phony and a fraud."

Outside polling stations, Canadians told AFP they had wished for a more positive campaign focused on issues.

"I deplored the cheap shots during the campaign. I think we're better than that," said Andree Legault in Montreal.

"What Trudeau's done the last four years, I think it's got most of us a little angry," said Jade Schultz in Regina, "so I just think we need someone new in there."

Trudeau defends record

Trudeau defended his record: a strong economy and low unemployment, legal cannabis, the resettlement of 60,000 Syrian refugees, doctor-assisted deaths, a public inquiry into missing and murdered indigenous women, and free trade deals.

Former US president Barack Obama endorsed Trudeau, calling him an "effective leader who takes on big issues like climate change."

"The world needs his progressive leadership now," Obama tweeted.

The Conservatives have stood alone among all of the parties in pledging austerity measures to return to a balanced budget within five years.

The party has situated itself to the right of the Conservatives and could draw votes away.

On the left, the Bloc Quebecois has come back from a ruinous 2015 election result, tapping into lingering Quebec nationalism.

The Bloc and NDP have said they would not prop up the Tories if they secure a minority.