Prime Minister Benjamin Netanyahu and his main challenger Benny Gantz were neck and neck early Wednesday after a high-stakes Israeli election, exit polls showed, but the premier seemed better placed to form a coalition.
Both men claimed victory after the exit surveys were released by Israel's three main television stations following the closure of polling places at 1900 GMT.
The announcement of the exit polls brought a mixture of cheers and trepidation from their supporters gathered at post-election parties in Tel Aviv.
Exit polls have proven to be unreliable in past Israeli elections, and final official results were not expected until early Wednesday.
The exit polls put Netanyahu's Likud with between 33 and 36 seats in the 120-seat parliament, while Gantz's Blue and White had either 36 or 37.
A combination of Netanyahu's Likud and smaller right-wing parties allied to him had between 60 and 66 seats, according to the exit polls.
Gantz's Blue and White alliance along with other smaller parties had between 54 and 60 seats, the polls showed.
Addressing cheering supporters at an event hall in Tel Aviv, ex-military chief 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.
"I will be the prime minister for all, not only for our voters."
Netanyahu was due to speak later, but had already put out a statement saying "the right-wing bloc led by Likud won a clear victory."
"I thank the citizens of Israel for the trust. I will begin forming a right-wing government with our natural partners tonight."
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.
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 69-year-old premier who has built a reputation as guarantor of the country's security and economic growth, but whose populism and alleged corruption have 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-sought 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 Likud was at risk of losing over what he said was low turnout among supporters, claims widely seen as a bid to motivate right-wing voters.
At one point, he issued the warnings to beachgoers in the city of Netanya in sunny spring weather, with his party distributing the video.
By 8:00pm (1700 GMT), overall turnout was 61.3 percent compared to 62.4 percent at the same time in 2015 elections.
Gantz, a 59-year-old former paratrooper who has formed a centrist alliance, has invoked the corruption allegations against the premier to make his case that it is time for him to go.
He has called Netanyahu's annexation pledge an "irresponsible" bid for votes.
Gantz says he favours a "globally backed peace agreement" with Israel holding on to the large West Bank settlement blocs. He opposes unilateral moves.
He has sought to overcome Netanyahu's experience by allying with two other former military chiefs and ex-finance minister Yair Lapid to form his Blue and White alliance.
Should Netanyahu win, he will be on track to surpass founding father David Ben-Gurion as Israel's longest-serving prime minister later this year.
He has been premier for a total of more than 13 years.
If he does triumph, "King Bibi," as some have called him, also 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.
As for the Palestinians, they had not put much hope in the election, and senior official Saeb Erekat lamented that left-wing parties performed poorly in the exit polls, saying the country had said "no to peace."