TORONTO (AP) — As Canada’s Liberals celebrated election victory in a stunning turn of fortune, vote counting resumed Tuesday to determine whether Prime Minister Mark Carney’s party gains an outright majority or needs help in Parliament from a smaller party.

Carney’s rival, populist Conservative leader Pierre Poilievre, was in the lead until U.S. President Donald Trump took aim at Canada with a trade war and threats to annex it as the 51st state. Poilievre not only lost his bid for prime minister Monday but was voted out of the Parliament seat that he held for 20 years.

That capped a swift decline in fortunes for the firebrand Poilievre, who a few months ago appeared to be a shoo-in to become Canada’s next prime minister and shepherd the Conservatives back into power for the first time in a decade.

Poilievre, a career politician, campaigned with Trump-like bravado, taking a page from the “America First” president by adopting the slogan “Canada First.” But his similarities to Trump may have ultimately cost him and his party.

The Liberals were projected to win more of Parliament’s 343 seats than the Conservatives. It was not immediately clear if they would win an outright majority — at least 172 seats — or would need to rely on a smaller party to pass legislation.

The vote-counting agency Elections Canada said the counting of special ballots — cast by voters who are away from their districts during the election — has resumed. When the counting was paused early Tuesday, the Liberals were leading or elected in 168 seats, four short of a majority. Elections Canada estimated that uncounted votes could affect the result in about a dozen districts.

In a victory speech, Carney stressed unity in the face of Washington’s threats. He said the mutually beneficial relationship Canada and the U.S. had shared since World War II was gone.

“We are over the shock of the American betrayal, but we should never forget the lessons,” he said.

“As I’ve been warning for months, America wants our land, our resources, our water, our country,” Carney added. “These are not idle threats. President Trump is trying to break us so America can own us. That will never … ever happen. But we also must recognize the reality that our world has fundamentally changed.”

In a statement issued Tuesday, White House spokesperson Anna Kelly said the Canadian election “does not affect President Trump’s plan to make Canada America’s cherished 51st state.”

A defeat for the Conservatives

Poilievre hoped to make the election a referendum on former Prime Minister Justin Trudeau, whose popularity declined toward the end of his decade in power as food and housing prices rose.

But Trump attacked, Trudeau resigned and Carney, a two-time central banker, became the Liberal Party’s leader and prime minister.

In a concession speech before the race call on his own seat, Poilievre vowed to keep fighting for Canadians.

“We are cognizant of the fact that we didn’t get over the finish line yet,” Poilievre said. “We know that change is needed, but change is hard to come by. It takes time. It takes work. And that’s why we have to learn the lessons of tonight.”

McGill University political science professor Daniel Béland said nothing prevents Poilievre from remaining the Conservative leader without a seat but, if he decides to stay, he would need to run in another district — perhaps by asking a Conservative member of Parliament from a safe Conservative district to resign.

“Still, losing your seat when some people within your own party think you’re the main reason why it failed to win is a clear issue for Poilievre,” Béland said.

“Moreover, not having the leader of the official opposition in the House of Commons when Parliament sits again would obviously be a problem for the Conservatives, especially if we do end up with a minority Parliament.”

Even as Canadians mourned a deadly weekend attack at a Vancouver street festival, Trump was trolling them on election day, asserting that he was on their ballot and erroneously claiming that the U.S. subsidizes Canada. “It makes no sense unless Canada is a State!” he wrote.

Trump’s truculence has infuriated Canadians, leading many to cancel U.S. vacations, refuse to buy American goods and possibly even to vote early. A record 7.3 million Canadians cast ballots before election day.

Reid Warren, a Toronto resident, said he voted Liberal because Poilievre “sounds like mini-Trump to me.” He said Trump’s tariffs are a worry.

“Canadians coming together from, you know, all the shade being thrown from the States is great, but it’s definitely created some turmoil, that’s for sure,” he said.

Foreign policy hasn’t dominated a Canadian election this much since 1988, when free trade with the United States was the prevailing issue.

The Liberal way forward

Carney and the Liberals have daunting challenges ahead.

If they fail to win a majority in Parliament, the Liberals might need rely on a smaller party. Trudeau’s Liberals relied on the New Democrats to remain in power for years, but the progressive party fared poorly on Monday, and its leader, Jagmeet Singh, said he was stepping down after eight years in charge.

“It appears the Liberals will not attain a majority, but the (New Democrats) will prop them up as before. I do not expect any formal deal between the parties,” said Nelson Wiseman, professor emeritus at the University of Toronto.

The Bloc Québécois, which looked set to finish third, is a separatist party from French-speaking Quebec that seeks independence. Bloc Québécois leader Yves-François Blanchet said he would be open to working with the government for a year if it’s a minority.

“The last thing that the Quebec people and Canada people want is instability in the federal Parliament,” he said.

In addition to the trade war with the U.S. and frosty relationship with Trump, Canada is dealing with a cost-of-living crisis. And more than 75% of its exports go to the U.S., so Trump’s tariffs threat and his desire to get North American automakers to move Canada’s production south could severely damage the economy.

Carney has vowed that every dollar the government collects from counter-tariffs on U.S. goods will go toward Canadian workers who are adversely affected. He also said he plans to offer a middle-class tax cut, return immigration to sustainable levels and increase funding to Canada’s public broadcaster.

___

Associated Press journalist Mike Householder in Mississauga, Ontario, contributed to this report.