OTTAWA — The party leaders are increasingly talking about how the standings in the House of Commons after the election could determine who gets to govern, forcing attention to the fine points of the Westminster system.
Here's how it might shake out under the rules used in Canada:
Liberals with the most seats
The Liberals get a first crack at forming government. They write a speech from the throne and attempt to maintain the confidence of the House of Commons.
"The prime minister is still the prime minister the next day. He continues to be the prime minister until he resigns or is dismissed," said Nelson Wiseman, a political science professor at the University of Toronto.
Without a majority, Trudeau will have to determine whether he needs a formal coalition with another party (which would typically mean accepting some of its MPs into the cabinet), or a deal to ensure their support so his party doesn't fall on a confidence vote. Trudeau could also avoid making any agreements and hope not enough opposition parties would vote to bring down the government so soon after the election.
Conservatives with the most seats
The Liberals still have the first chance at forming government, but the numerical results matter. If the Conservatives have a strong plurality of seats, and appear able to hold the confidence of the Commons, Trudeau could resign as prime minister, not form government and hand that opportunity to the Tories as custom—but not the Constitution—dictates.
If the margin is much closer, or Trudeau believes he can survive a confidence vote with the support of a third or fourth party, he could try to form a Liberal-led government and see how things play out.
Coalition or "confidence and supply"?
A coalition government is a more formal entity, and is in place in many democracies around the world. Usually, the leader of the largest party becomes prime minister and some members of the junior coalition partner serve in cabinet.
"I doubt there will be coalition talk," Wiseman said. "Canada at the federal level has no experience with coalition government, so people aren't used to it."
Another scenario is the party forming government gains support on confidence votes without formally pulling members of another party into the government.
Such a case is playing out in British Columbia right now. There, the provincial NDP won fewer seats than the Liberals, but defeated the minority government on a confidence vote and now survive thanks to a "confidence and supply" agreement with the Greens. The Greens are not formally part of the government, but the two parties have agreed to work together.
A similar agreement also exists in New Brunswick currently, and occurred in Ontario in 1985 when Bob Rae's NDP supported a Liberal government that held fewer seats than the Progressive Conservatives.
What happens if the government loses the confidence of the House of Commons?
The first confidence challenge to the government could come with the speech from the throne. MPs vote on the speech, to approve or reject the general direction laid out by the government, and governments require a majority of votes to survive.
When a prime minister loses a confidence challenge, he or she generally either resigns the office or asks the Governor General to dissolve Parliament and send Canadians back to the polls.
But if the loss of confidence comes soon after the Oct. 21 election, the Governor General might instead decide to invite the leader of the party with the second-most seats in the House to attempt to form government.
"I think she would want to be confident that the leader of the Opposition could assure her that he could command the confidence of the House," Wiseman said.
A request to dissolve Parliament has been refused before, in different circumstances in 1926, and more recently at the provincial level last year in B.C., when the lieutenant-governor declined Christy Clark's request.
When New Brunswick premier Brian Gallant couldn't get his throne speech through the legislature after the 2018 election there, though, he resigned and advised the lieutenant-governor to give now-Premier Blaine Higgs the opportunity to form government, rather than request another election.
If the Governor General allows the opposition party leader to try to form government and he or she also fails, a new election would almost certainly be called.
Red-Orange: Liberal and NDP
Talk of a possible Liberal-NDP deal in the event of a Liberal minority overshadowed Thanksgiving weekend, with Singh presenting his list of priorities but with both leaders eventually backing away from the topic.
But the combination might be the most likely of any partnership, with the NDP playing kingmaker and pushing forward priorities like health care, environment and income inequality.
Wiseman said it was unlikely such a partnership would come in the form of a formal coalition. Like Bob Rae's provincial NDP, he said, leader Jagmeet Singh might instead choose to lay out his policy demands and make a less formal agreement to keep the government stable.
Red-Orange-Green: Liberals, NDP and Greens
Again, depending how the results shake out, it might require more than two parties to reach a parliamentary majority. Singh has already laid out his priorities, while Green Leader Elizabeth May has said she would not support any minority that doesn't meet her standards on climate action. Given their stated climate policies, the Liberals, New Democrats and Greens seem the most likely to be able to make a three-way deal.
Blue-?: Conservatives in search of allies
It seems unlikely the Liberals would keep a Conservative minority alive, though it has happened before in 2008. The NDP have already said they would not prop up the Tories, while the Greens and Conservatives are far apart on the environment.
The Bloc has said it would not formally join any coalition but perhaps leader Yves-Francois Blanchet would support the Conservatives on confidence questions, with some common ground to be found on devolving federal authority to provincial governments.
This report by The Canadian Press was first published Oct. 17.