TORONTO - The shape of the next Ontario government could all come down to what Dalton McGuinty is willing to do to remain in power.

All signs are pointing to a minority government, something that hasn't happened in 26 years, and several scenarios are possible after Thursday's vote, including McGuinty remaining premier without winning the election.

The magic number for a majority is 54 -- out of 107 -- seats, but polls are suggesting the Liberals and Progressive Conservatives are neck and neck, which could mean no one will emerge with a majority.

Under that scenario, the current government gets the first shot at trying to form a new government, said McMaster University political science professor Peter Graefe.

That means even if the Tories end up with 41 seats and the Liberals with 38, McGuinty still gets the first crack at governing. But that entails gaining the confidence of the house, which would essentially mean going hat in hand to the NDP.

It's a scenario, however, that McGuinty appears to have ruled out.

McGuinty said Sunday he would not form a coalition with Tim Hudak's Tories or Andrea Horwath's NDP, and went even further when later pressed on whether he might work with the NDP in some capacity to form a minority Liberal government.

"No coalition, no accord, no agreement, formal or informal, or any other linkage of any kind," McGuinty said.

But politicians tend to leave themselves some wiggle room, said Graefe.

"There's coalitions and there's coalitions, right?" he said.

If the Liberals have the second highest amount of seats but are not close to the winning party, McGuinty likely wouldn't try to govern because it will truly feel like a loss, Graefe said.

In 1985 the Liberals had four fewer seats than the PCs but ended up with a higher share of the popular vote. The Liberals and the NDP struck an agreement whereby the New Democrats propped up David Peterson's government for two years in exchange for the passage of some legislation.

Sean Conway, a Liberal cabinet minister under Peterson, said that accord was brought about during a particular moment in time, and he doesn't see that being replicated now.

The question, he said, that leaders and parties must weigh if there is a minority after the results come in is: who can command a working majority?

"Whatever you do it has to meet the test of legitimacy," Conway said. "That's always a judgment call and that's where the fun and the skills of politics and political judgment comes in."

What Ontario could also see happen after the election is a minority government scenario like the previous two governments under Prime Minister Stephen Harper. If the Conservatives or the Liberals win the most seats on Thursday they could try to govern by agreeing to some compromises with either of the other two parties on a bill-by-bill basis in order to get legislation passed.

"When you get into a minority parliament, everybody's got to put some water in their wine or you're going to have an election ... a lot sooner than you might like," Conway said.

Voters in the province will have seen elections at all three levels of government in the span of one year, and none of the parties will be eager to send people back to the polls again.

Graefe suggested that will hold especially true for the NDP.

"I suspect the NDP will be broke after this election and will need a bit of time to rebuild their finances," he said.

"(Plus), the experience of looking at what Stephen Harper was able to do in Ottawa may make it harder for Horwath to not explore some kind of option of supporting McGuinty, if only because her followers are going to say, 'How can you let Hudak come into power?"'