Prime Minister Justin Trudeau's Liberal Party held onto power in a nail-biter of a Canadian general election on Monday, but as a weakened minority government.
Television projections declared the Liberals winners or leading in 157 of the nation's 338 electoral districts, versus 121 for his main rival Andrew Scheer and the Conservatives, after polling stations across six time zones closed.
As early as Tuesday, Trudeau will have to form an alliance or formal coalition with one or more smaller parties in order to govern.
The first test of his future government will follow in the subsequent weeks with a speech to parliament outlining his legislative priorities and a confidence vote.
The 47-year-old former school teacher dominated Canadian politics over the four years of his first term, but faced a grilling during the 40-day election campaign, which was described as one of the nastiest in Canadian history.
His golden boy image has been damaged by ethics lapses in the handling of the bribery prosecution of engineering giant SNC-Lavalin, while the emergence of old photographs of him in blackface makeup rocked his campaign.
Scheer, meanwhile, only two years after winning the leadership of his party, struggled to win over Canadians with his bland minivan-driving dad persona and a throwback to the thrifty policies of past Tory administrations.
His Conservatives had stood alone among all of the parties in pledging austerity measures to return to a balanced budget within five years.
Surging social democrats and resuscitated Quebec separatists also appeared to have chipped away at Liberal support.
'Cheap shots' during campaign
The Bloc Quebecois came back from a ruinous 2015 election result, tapping into lingering Quebec nationalism to take 32 seats, while the New Democratic Party (NDP) won 25 seats, according to projections.
"Trudeau has really lost his halo. It's pretty tarnished," commented Lois Welsh, 77, in Regina, disappointed over the Liberal win.
Michel Mercer in Montreal said he voted for the Liberals, but only to keep the Tories at bay.
"I would have voted NDP but I didn't want to see the Conservatives in power," he told AFP.
Some 27.4 million Canadians were eligible to vote in the election, and a large turnout was expected but that won't be confirmed until Tuesday morning.
During the campaign, 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.
Trudeau had warned against Scheer's pledged rollback of environmental protections, including a federal carbon tax that discourages the use of large amounts of fossil fuels.
The pair exchanged barbs while attack ads and misinformation multiplied.
At one rally, the prime minister wore a bulletproof vest due to security fears.
Scheer had lamented that Canadians "cannot afford" a Liberal government propped up by the third-place New Democratic Party (NDP).
NDP leader Jagmeet Singh, a leftist former criminal defense lawyer, is the first non-white leader of a federal political party in Canada, and will likely emerge as kingmaker.
Late in the campaign, Scheer was shaken over revelations of his US dual citizenship and allegations that his party hired a communications firm to "destroy" the upstart People's Party, led by former Conservative foreign minister Maxime Bernier.
The Green Party, hopeful for a breakout, managed to add only one seat, bringing its tally to three.