Updated at 3:25 a.m. ET
Canada's Liberals appear to have won the most seats in Parliament — a result likely to hand Justin Trudeau a second term as prime minister despite a series of scandals that have rocked his government.
With all but two of the 338 seats called as of 3:25 a.m. ET, Trudeau's Liberal Party had secured 157 seats — a loss of 20 seats — compared to 121 for its main rival, the Conservatives. The regional Bloc Québécois won 32. The New Democrats, who stand to the left of the Liberals and are seen as likely coalition partners for Trudeau, won 24 seats.
Without a majority, the Liberals, who came into the race with a majority of 177 seats, will have to form a minority government, seeking support from one or more smaller rivals to govern.
Despite the loss of an absolute majority, Trudeau's acceptance speech sounded as though the outcome was a mandate.
"You did it, my friends. Congratulations," Trudeau told supporters in Montreal early Tuesday.
"To those who did not vote for us, know that we will work every single day for you. We will govern for everyone," he said.
Even so it was clear, as Jonathan Rose, a political science professor at Queen's University in Kingston, Ontario, told Reuters, that the Liberals "are going to need another party, that's for sure."
The election pitted Trudeau against Conservative leader Andrew Scheer, seen as a less flashy and no-nonsense opponent.
In his concession speech, Scheer warned: "Mr. Trudeau, when your government falls, Conservatives will be ready, and we will win."
During the campaign, the Conservatives pushed tax cuts and rejected substantive action on climate change. Although they fell short of enough seats to form a government, they did manage to rout Liberal members of Parliament in such places as Saskatchewan and Alberta, where the party won 70% of the vote, according to the CBC.
Trudeau, who swept to power in 2015 with a comfortable margin, brought a youthful style and liberal brand of politics into office. His friendship with former President Barack Obama, who endorsed him in Monday's election, is well known, as is his increasingly strained relationship with President Trump.
Trump congratulated Trudeau in a tweet: "I look forward to working with you toward the betterment of both our countries!"
Congratulations to @JustinTrudeau on a wonderful and hard fought victory. Canada is well served. I look forward to working with you toward the betterment of both of our countries!— Donald J. Trump (@realDonaldTrump) October 22, 2019
Among other things, Trudeau introduced Canada's first gender-balanced Cabinet and has worked toward reconciliation with the country's indigenous communities.
Last month, Trudeau, 47, acknowledged multiple occasions when he wore blackface and brownface as recently as 2001. The incidents, for which he has apologized and expressed regret, have called his judgement and his progressive credentials into question. In 2018, a 20-year-old accusation surfaced that he had groped a female journalist.
Trudeau has also taken heat for his decision to approve the building of the Rocky Mountain oil pipeline and has twice been found guilty of violating the country's ethics laws.
During the campaign, Scheer pounced on the scandal, calling Trudeau a phony for not being able to remember how many times he had worn blackface and calling him "unfit" for office.
But Scheer faced issues of his own, among them his dual U.S.-Canada citizenship. Earlier this year, he began the process of renouncing his U.S. citizenship, but the appearance of divided loyalties did not sit well with some voters.
In the weeks leading up to the election, Trudeau and Scheer seemed to be in a dead heat.
Robert Bothwell, a professor of Canadian history and international relations at the University of Toronto, told The Associated Press late Monday that he expected Scheer to resign following the vote.
"He's gone," Bothwell said. "He ran a really dirty campaign. There is nothing to be proud of on his side. He had the opportunity and blew it."
A previous version of this story incorrectly stated the number of seats lost by the Liberal Party as 30. The correct number is 20.