JERUSALEM — Israel's Orthodox parties and Natan Sharansky's immigrant-rights list looked to be the only certain winners as Israel's election count for the next prime minister seesawed between Shimon Peres and Benjamin Netanyahu long after the polls closed.
Which man will become prime minister might not be known until the weekend if the gaps between them continue to be small.
But whoever wins, he will have to pull together a large number of parties in order to secure a viable majority in the Knesset.
Both Labor and Likud lost a large number of the seats they held in the outgoing Knesset to the smaller parties.
It remains to be seen whether a government forged with the support of those smaller parties will be workable and stable over the longer term.
In Netanyahu's case, if he were to be the ultimate victor, his coalition would comprise all three Orthodox parties — the ultra-religious Sephardi Shas Party, the National Religious Party and the United Torah Front — as well as Yisrael Ba'Aliyah, the Third Way and possibly the ultra-rightist Moledet.
If Peres were to emerge the winner, his coalition would take in at least two Orthodox parties alongside the secularist Meretz and the Arab lists.
But Peres also could rest assured that many of the other parties will be crowding at his doorstep as soon as the official results are available.
Among these parties is Yisrael Ba'Aliyah, which is predicted to have won seven seats.
Another coalition prospect is the Third Way, under Avigdor Kahalani, with three seats predicted.
As the television predictions wavered between the two prime ministerial candidates, politicians on both sides were heard questioning the efficacy of the new electoral system.
The system — by permitting Israelis to split their vote for the first time in separate ballots for prime minister and the Knesset — has clearly produced a proliferation of middle-sized parties while whittling down the strength of the two major parties.
Some saw this as a step toward the disappearance of the two- party system as Israel has known it and the evolution instead of an Italian-style multiparty structure with all its inherent instability.
With a third of the votes counted, the Shas Party was proving to be the major success of the election.
Shas looked like it would end with nine or 10 seats, compared to six in the outgoing Knesset.
The National Religious Party also appeared to have increased its share of the vote, from six seats in the outgoing Knesset to nine seats in the new one.
The third Orthodox party, United Torah Front, retained its four seats.
If those preliminary counts were to hold up, the overall Orthodox representation in the Knesset would go from 16 to 22 seats.
It should be noted that Moledet is also a largely Orthodox-supported party: Its No. 2 man is Rabbi Benny Elon, a prominent settler leader and yeshiva head.
One of the most significant aspects of the preliminary results, in the view of political observers, is the severe trouncing that was meted out to the Likud and its rightist allies.
Likud went from 40 to 31 seats — and the current party includes within it the Tsomet Party of Rafael Eitan, which in 1992 scored eight seats of its own.
In the outgoing Knesset, Likud, Tsomet and Moledet together held 51 seats. The National Religious Party, with another six, firmly allied itself to the right.
In the new Knesset, Likud-Tsomet and Moledet account for merely 34 seats — and the NRP has made it clear it is open to offers from Peres.
Meanwhile, a sense of gloom and doom had deepened in the Labor Party camp as the week progressed.
The opinion polls published daily in the runup to the vote showed a steady and ominous shrinkage of the 4 percent to 6 percent lead that Peres had held over Netanyahu during April and much of May.
The turning point in the campaign seemed to be Sunday, when Peres came off worse in a televised debate than the debonair and articulate Netanyahu.
Peres looked haggard and sounded vague in the debate, compared with the polished television performance turned in by his rival.
The following morning, Rabbi Eliezer Shach and a number of leading Chassidic rabbis endorsed Netanyahu.
That immediately sent thousands of ultra-religious yeshiva students into the streets, and many towns quickly took on an aspect of vigorous and high-profile campaigning for the Likud leader.
Increasingly as the week wore on, Peres seemed to slip in the public standing, with the gap steadily and ominously narrowing.
Lubavitch Chassidim mounted a vigorous campaign in the days immediately preceding Wednesday's voting, telling the electorate from thousands of billboards and hundreds of thousands of flyers that Netanyahu was "Good for the Jews."
Labor campaign managers hoped that the message, plainly directed against the Arab voters, would prove a boomerang.
But if, on the other hand, Netanyahu were to emerge the victor, he would rely on the support of the National Religious Party and the United Torah Front to cobble together a coalition of his own.
And he, too, may well be able to turn to Yisrael Ba'Aliyah and the Third Way for support.