By Paul Wood
BBC News, Tel Aviv
Three of Israel's parties celebrated victory of sorts as the polls closed
At both the Kadima and Likud election centres, the party workers had the same chant: "Here comes the next prime minister."
The Israeli electoral system has thrown up a most confusing "split" result.
Centre-left Kadima is projected to be in first place but the right-wing parties together get the biggest bloc of seats in the Knesset.
Tzipi Livni and Benjamin Netanyahu may both end up inviting each other to join governments they would respectively head. It would be comic if it were not so serious.
If the exit polls are right, the decision on who is the next Israeli prime minister now belongs to Avigdor Lieberman, leader of the ultra-nationalist Yisrael Beitenu party.
So the question is - what does Mr Leiberman want and who is prepared to give it to him?
He can now expect to be courted by both Livni and Netanyahu.
Which of the proffered hands he takes will determine who is first through the door of the Israeli president's official residence to start coalition building.
Kadima says that only Mrs Livni has the moral authority to try to form a government, having come top of the poll.
Many see right-wing leader Avigdor Lieberman as Israel's new kingmaker
Yoel Hasson, who sits in the Knesset for Kadima, said: "There is no doubt that Tzipi Livni will be the prime minister. It is inevitable. The question is the composition of the government."
He added: "The largest party has never been prevented from forming the government, regardless of the map of blocs."
Others could remember that the man who will be stewarding the negotiations, President Shimon Peres, was once asked - back in 1990 - to form a government while leading the second-largest party.
So it would be unusual but not unprecedented for Likud to be in this same position today.
Likud officials are confident they can buck the historical trend.
That is not least because, with 29 seats in the current Knesset, Tzipi Livni was unable to form her own coalition.
At Likud election centre, Benjamin Netanyahu took to the stage to tell a small but enthusiastic crowd of supporters: "With God's help, I stand before you as the man who will be Israel's next head of government."
Polls suggested Tzipi Livni's party performed well
Of the projected result, Likud's Dore Gold said: "This is somewhat of a murky outcome. The big picture is that the conservative side was strengthened in this election."
A Likud parliamentarian, Gilad Erdan, said: "The test is not which party gets the most votes, but which candidate has the best chance to form a coalition, and that person is Benjamin Netanyahu."
A note of caution: election night predictions have a very chequered history in Israeli politics. They have been wrong in the past.
Soldiers, whose votes could swing a couple of seats, were not counted in the exit polls. They could favour Mr Netanyahu.
But, assuming the predictions are correct, why was the race so close? After all, for weeks, Mr Netanyahu appeared comfortably ahead in the polls.
Political scientists and the campaigns themselves agree - they have never seen an Israeli election like this one.
A week before the vote, opinion polls were indicating that up to 30% of the electorate were still undecided, a measure of how fluid was the state of public opinion.
Part of this result can be explained by shifts in support within the left and right blocs rather than between them.
Labour lost votes to Kadima while Yisrael Beitenu appeared to siphon off support from Likud.
Despite being a member of the government, Tzipi Livni, appeared to benefit from the forceful sentiment in any election that "it's time for a change".
That is because both Mr Netanyahu and Ehud Barak have already held the office of prime minister - and failed to complete their full terms.
A major attraction to voters was that she was not either of these two.
Mr Netanyahu seemed to register over the past few days that he was in trouble.
He stepped up his slightly laconic campaign and started meeting party activists to try to energise his base.
Mr Netanyahu had stepped up a laconic campaign in recent weeks
On polling day itself, he went to the southern town of Beersheba to declare that, as prime minister, he would reply to any rockets attacks with "crushing force".
This was an attempt to reach out to his core vote: traditional strategy of all politicians who are in trouble in a tight race.
"Netanyahu felt the right-wing parties nipping at his heels and he shifted his own focus to the right to head that off, and thereby lost some votes in the centre," Mark Heller, of Tel Aviv University, told the Associated Press news agency.
He said of Tzipi Livni's surprise comeback: "It shows a lot of people were at the last minute frightened off by the idea of Netanyahu being prime minister."
Mr Netanyahu told the Likud gathering the electorate had sent "a sharp and clear message".
The voting, along with Israel's constitution, has in fact, opened the way to many possible combinations of a new Israeli governing coalition. Some of these are:
- A centre-left coalition of Kadima and Labour plus any combination of Shas, Yisrael Beitenu and Meretz. These parties have been in government together before - and it was not a happy experience for them
- A grand coalition or Kadima, Labour and Likud. This may be the outcome the electorate wanted but it is unlikely given the clashing egos of those involved. For the same reason, there probably will not be a "rotating government" with Kadima and Likud getting two years each to lead. Who would go first?
- A right-wing coalition of Likud, Yisrael Betainu and Shas, which does not include either Kadima or Labour. This may be the final outcome and it seems to be the one Mr Netanyahu is aiming for. He told the Likud gathering he would reach out to the national parties later in the day
There may well be weeks of tortuous negotiations ahead to form a coalition capable of governing. Let the horse-trading begin!