Prime Minister Justin Trudeau appeared set to win a second term in Canada's national elections on Monday.

Trudeau's Liberal party was projected to win the most seats in the 338-seat Parliament, giving it the best chance to form the next government.

However, the Canadian Broadcasting Corporation said it would be a minority government, forced to rely on an opposition party to stay in power.

The election season was marked by several scandals, including Trudeau's interference with a federal investigation into a Quebec company, as well as photos that surfaced showing Trudeau in blackface.

Visit Business Insider's homepage for more stories.

TORONTO (AP) — Prime Minister Justin Trudeau appeared set to win a second term in Canada's national elections Monday, seemingly fending off a challenge from rival Conservatives despite having been weakened by a series of scandals.

Trudeau's Liberal party was projected to win the most seats in the 338-seat Parliament, giving it the best chance to form the next government. However, the Canadian Broadcasting Corporation said it would be a minority government, forced to rely on an opposition party to stay in power.

"Trudeau is going to have to command a caucus that will not be as grateful than it was in 2015. A lot of them will say 'Look we won but not because of you,'" said Robert Bothwell, a professor of Canadian history and international relations at the University of Toronto.

The Canadian vote came down to what was essentially a choice between the handsome and charismatic Trudeau and the Conservatives' unassuming leader, Andrew Scheer, who was seen as the perfect antidote to Trudeau's flash and celebrity.

Trudeau reasserted liberalism in 2015 after almost 10 years of Conservative Party government in Canada, but a combination of scandals and high expectations damaged his prospects.

Perhaps sensing Trudeau was in trouble, Barack Obama made an unprecedented endorsement by a former American president in urging Canadians to re-elect Trudeau and saying the world needs his progressive leadership now.

Trudeau, son of the liberal icon and late Prime Minister Pierre Trudeau, is one of the few remaining progressive leaders in the world. He has been viewed as a beacon for liberals in the Trump era, even appearing on the cover of Rolling Stone magazine under the headline "Why Can't He Be Our President?"

A campaign marked by scandal

This photo of Justin Trudeau in blackface was published in the West Point Grey Academy newsletter in April 2001. Wayback Machine/West Point Grey Academy

But old photos of Trudeau in blackface and brownface surfaced last month, casting doubt on his judgment.

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.

Read more: Canadian Prime Minister Justin Trudeau wore brownface and a turban during an 'Arabian Nights'-themed party in 2001

Trudeau also was hurt by a scandal that erupted 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 stay in power.

"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."

Wiseman said he expected the New Democrats would largely support Trudeau, and other parties won't be pushing for an election in the short term.

The Conservatives are deeply disappointed, Wiseman said.

"They had an opportunity here to win," he said.

Scheer had promised to end a national carbon tax and cut government spending, including foreign aid, by 25%. "That money belongs to you, not to them," Scheer said.

Trudeau's legacy energized voters

Liberal leader Justin Trudeau holds a rally in Milton, Ontario, Canada, on Saturday, Oct. 19, 2019. National elections are scheduled for Monday. (Sean Kilpatrick/The Canadian Press via AP) Associated Press

Trudeau embraced immigration at a time when the U.S. 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 U.S. and Mexico amid threats by U.S. President Donald Trump to scrap it.

Pat Gill, a Vancouver retiree, said she voted for Trudeau.

"I think people know he's made some mistakes," said Gill, who is 74. "I'm hoping he's learned in the last four years. I still think he's our best bet."

Associated Press writer Jim Morris in Vancouver, British Columbia, contributed to this report.