After failing to secure a clear election victory for the second time this year, Israeli Prime Minister Benjamin Netanyahu must wait days — or more likely weeks — to learn if he can stay in office, or whether he must step aside.
With Israeli media reporting more than 90 percent of votes counted in Tuesday's election, the bloc led by Netanyahu's right-wing Likud Party was almost neck and neck with the centrist grouping led by his chief rival, the former general Benny Gantz.
Netanyahu's bloc looked poised to control 55 of parliament's 120 seats, with 56 going to Gantz's Blue and White Party, and his natural partners. Both fall short of a majority government of 61 lawmakers. No single Israeli party has ever won an outright majority, and that is not going to change in a year of unprecedented electoral instability which has already seen two elections — on April 9 and September 17.
Many things hinge on the outcome: chiefly whether it is the beginning of the end of the Netanyahu era, or if the man known to his supporters as "the magician" can conjure up a record fifth premiership, and claim a public mandate to help fight off corruption allegations.
Just over 4 million Israelis voted in 11,000 polling stations. It takes a long time to count the votes because they are cast on paper ballots.
One day after the election, tellers had manually counted nearly two-thirds of the votes and, so far, the centrist Blue and White party of former general Benny Gantz - Netanyahu's main rival - was fractionally ahead of Netanyahu's right-wing Likud Party, both with just over 1 million votes.
Translated into seats, that put Gantz on about 32 seats, and Netanyahu 31 - but the final tally could be different. Without an unequivocal majority, neither of the leaders has a clear path to power.
The far-right settler Avigdor Lieberman, a former defense minister, seems to be the central figure in negotiations.
Lieberman, head of the Yisrael Beitenu party, is fiercely secular and hawkish on issues relating to security and the Israeli-Palestinian conflict.
He has said the only option he would support is a "national unity government" that would include both his party, Likud and Blue and White. According to preliminary results, Lieberman's party is set to almost double its current number of five parliamentary seats. However, Lieberman is something of a wild card and has made unpredictable moves in the past.
Israel's president will consult with all party leaders about their preference for prime minister, and will then choose the one he thinks has the best chance of putting together a coalition.
The nominee, who does not necessarily have to be the head of the largest party, has up to 42 days to form a government. If he or she fails — as Netanyahu did in the previous election held in April — the president can ask another politician to try.
It could take weeks. Past coalition negotiations have often dragged on until the very last minute. Whoever is asked to form the next government will have to accommodate numerous parties. However, it could prove quicker if Netanyahu and Gantz choose to join forces and form a unity government, with or without the help of Lieberman.
There are often surprises and unpredictable alliances.
A Netanyahu-led unity government would be complicated to build: Gantz has ruled out participating in an administration with Netanyahu, if the Israeli leader is indicted on looming corruption charges.
Lieberman has said he would not join an alliance that included Israel's ultra-Orthodox parties — Netanyahu's traditional partners.
Netanyahu's own party could even oust him to avoid instability and pave the way for a governing coalition between some other Likud politician and Gantz's Blue and White, leaving Netanyahu in the political wilderness.
Netanyahu has said he expects U.S. President Donald Trump to release his long-delayed plan for Israeli-Palestinian peace soon after the election.
But Trump may want to wait and see what government is formed before unveiling the plan. Netanyahu would certainly have a hard time getting far-right allies to sign on to any peace plan involving concessions to the Palestinians.
Netanyahu had announced his intention to annex the Jordan Valley in the occupied West Bank, where the Palestinians seek statehood. But without a clear majority of right-wing backers, such a move appears unlikely.
A cabinet with Gantz in it would likely be more open to negotiations with the Palestinians.
Netanyahu's political troubles could greatly affect his legal predicament. Israel's attorney-general, who has announced his intention to indict Netanyahu in three corruption investigations, is expected to decide whether to formally charge him by the end of 2019.
But there is a pre-trial hearing in October, during which Netanyahu can argue against indictment. He denies all wrongdoing.
Netanyahu's right-wing and religious allies had signaled support for the idea of granting Netanyahu parliamentary immunity. But that scenario is likely to cause a public outcry, and now appears remote.
If Netanyahu does become prime minister he would not have to step down, under the law. Right-wing and religious allies are not expected to pressure him to resign, even if he is charged. But if he is forced into a unity government with Gantz he could face far more political and public pressure to leave office.
Some analysts have suggested a deal may be broached in which Netanyahu steps down from public office for good in return for reduced charges.