Prime Minister Benjamin Netanyahu was on path for victory in Israel's elections on Wednesday after nearly complete results put him in position to form a right-wing coalition and further extend his long tenure in office.
The results from Tuesday's vote came despite corruption allegations against the 69-year-old premier and put him on track to become Israel's longest-serving prime minister later this year.
His Likud party looked set to finish with a similar number of seats in parliament to his main rival, ex-military chief Benny Gantz's centrist Blue and White alliance, Israeli media reported.
But with 97 percent of the vote counted, results showed the Likud and other right-wing parties allied to him with some 65 seats in the 120-seat parliament, the reports said.
The result would seem to leave President Reuven Rivlin, whose task it is to ask one of the candidates to form a government, with little choice but to pick Netanyahu.
Intensive coalition negotiations are likely to follow and could drag on for days or even weeks.
Final results were expected by Thursday afternoon, with ballots for soldiers and other special categories of voters yet to be counted.
The close race between the two main parties had led to uncertainty after polls closed on Tuesday night and exit surveys were released.
Both Netanyahu and Gantz claimed victory after the initial exit surveys that gave Blue and White the most seats.
But even then Netanyahu appeared best placed to form a coalition, with both parties in any case falling far short of an outright majority.
Netanyahu spoke in the early hours of Wednesday at the Likud's post-election party in Tel Aviv and called it a "magnificent victory."
As he walked onto the stage to chanting crowds, he planted a kiss on the lips of his wife Sara.
"It will be a right-wing government, but I will be prime minister for all," he said.
Earlier while addressing cheering supporters who waived Israeli flags at an event hall in Tel Aviv, Gantz called it a "historic day."
"The president must give us the task of forming the next government since we are the biggest party," he said after initial exit polls.
The vote had long been expected to be close and lead to frantic negotiations to form a coalition, even with Netanyahu facing potential corruption charges.
Fighting for his political life, Netanyahu spent the weeks ahead of the vote campaigning furiously to energise his right-wing base.
Things can change
Gantz, a newcomer to politics, mounted a strong challenge to the veteran prime minister by brandishing his security credentials while pledging to undo damage he says Netanyahu has inflicted on the country with divisive politics.
The election was in many ways a referendum on the premier who has built a reputation as guarantor of the country's security and economic growth, but whose populism and alleged corruption left many ready for change.
He engaged in populist rhetoric that critics said amounted to the demonisation of Arab Israelis and others.
Netanyahu faced further criticism on election day when members of his Likud party brought small cameras into polling stations in Arab areas.
Arab politicians called it an attempt at intimidation, while Netanyahu said cameras would prevent fraud.
True to form, Netanyahu issued a deeply controversial pledge only three days before the election, saying he planned to annex Jewish settlements in the occupied West Bank should he win.
Extending Israeli sovereignty on a large scale in the West Bank could be the death knell to already fading hopes for a two-state solution with the Palestinians.
It is a move long championed by Israel's far right.
Netanyahu sought to portray himself as Israel's essential statesman in the run-up to the vote and highlighted his bond with US President Donald Trump.
He spoke of Trump's recognition of Jerusalem as Israel's capital and of Israel's claim of sovereignty over the annexed Golan Heights.
He also used Trump-like tactics, calling the corruption investigations a "witch hunt" and denouncing journalists covering them.
On Tuesday, he continually warned the Likud was at risk of losing as a result of what he said was low turnout among supporters, claims widely seen as a bid to motivate right-wing voters.
Turnout was 67.9 percent compared to 71.8 percent in the last election in 2015.
Gantz, a 59-year-old former paratrooper, invoked the corruption allegations against the premier to make his case that it is time for him to go.
He called Netanyahu's annexation pledge an "irresponsible" bid for votes.
Gantz said he favoured a "globally backed peace agreement" with Israel holding on to the large West Bank settlement blocs, adding that he opposed unilateral moves.
He sought to overcome Netanyahu's experience by allying with two other former military chiefs and ex-finance minister Yair Lapid to form his alliance.
Netanyahu has been premier for a total of more than 13 years.
But "King Bibi," as some have called him, now faces the prospect of becoming the first sitting prime minister to be indicted.
The attorney general has announced he intends to indict Netanyahu for bribery, fraud and breach of trust pending an upcoming hearing.