TORONTO      -      Prime Minister Justin Trudeau won a second term in Canada’s national elections, losing the majority but saying Tuesday he was given a clear mandate despite an increasingly divided Parliament and nation. Trudeau’s Liberal Party took the most seats in Parliament. However Trudeau fell short of a majority, so the Liberals would have to rely on an opposition party to pass legislation

His early morning address to supporters came, unusually, as his Conservative rival, Andrew Scheer, had just begun speaking to his own supporters, forcing networks to tear away from Scheer’s speech. But the prime minister struck a conciliatory note: “To those who did not vote for us, know that we will work every single day for you, we will govern for everyone,” Trudeau said.

With results still trickling in early Tuesday, the Liberals had 157 seats — 13 short of the 170 needed for a majority in the 338-seat House of Commons — while the Conservatives had 121.

Still, Trudeau’s Liberal Party won fewer raw votes nationally than the Conservatives did, and his party failed to win a single seat in the western provinces of Alberta and Saskatchewan where the Conservatives dominated.

The prime minister showed up at a Montreal subway station on Tuesday morning to greet Canadians and take selfies. Trudeau said Canadians rejected division and negativity and elected a progressive agenda.

But in what was supposed to be a concession speech, the Conservative leader Scheer said the results showed Trudeau was much weakened since his 2015 election, when pundits had predicted the beginning of another Trudeau dynasty after a decade of Conservative government. “Conservatives have put Justin Trudeau on notice,” Scheer said. “And Mr. Trudeau, when your government falls, Conservatives will be ready and we will win.”

Trudeau delivered an unexpectedly strong result despite a series of scandals that tarnished his image as a liberal icon. “It’s not quite the same as 2015,” when Trudeau first took offce. “It’s not all owing to the leader,” said Robert Bothwell, a professor of Canadian history and international relations at the University of Toronto. “Trudeau is prime minister because the rest of the party was able to pull itself together and prevail. While Trudeau certainly deserves credit for what has happened he’s really going to have to demonstrate qualities that he hasn’t yet shown.”

Trudeau’s clean-cut image had taken a hit after old photos of him in blackface and brownface surfaced last month. “I’m surprised at how well Trudeau has done,” said Nelson Wiseman, a political science professor at the University of Toronto.

“I don’t think anybody expected Trudeau to get a majority, but they are not that far off.”

Perhaps sensing Trudeau was in trouble, Barack Obama made an unprecedented endorsement by a former American president in urging Canadians to re-elect Trudeau. The son of liberal icon and late Prime Minister Pierre Trudeau is one of the few remaining progressive world leaders in the Trump era.

The unassuming Scheer, 40, is a career politician who was seen as a possible antidote to Trudeau’s flash. But Bothwell said late Monday that he expected Scheer to resign. “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.”

Among other things, Scheer called Trudeau a phony who couldn’t even remember how many times he had worn blackface. Scheer suggested he would try to stay on as leader, saying that holding Trudeau to a minority was the first step toward restrong a Conservative government.

Trudeau also was hurt by a scandal this year when his former attorney general said he pressured her to halt the prosecution of a Quebec company. Trudeau has said he was standing up for jobs, but the damage gave a boost to the Conservative Party. Trudeau’s Liberals will likely rely on the New Democrats to form a new government and pass legislation. Opposition New Democrat leader Jagmeet Singh said early Tuesday he had congratulated Trudeau and vowed to play a constructive role in Parliament.

Trudeau embraced immigration at a time when the US and other countries are closing their doors, and he legalized cannabis nationwide. His efforts to strike a balance on the environment and the economy have been criticized by both the right and left. He brought in a carbon tax to fight climate change but rescued a stalled pipeline expansion project to get Alberta’s oil to international markets.

His also negotiated a new free trade deal for Canada with the US and Mexico amid threats by US President Donald Trump to scrap it. Trump, who has clashed with Trudeau over trade, tweeted his congratulations early Tuesday, saying, “Canada is well served.”