Jerusalem: Prime Minister Benjamin Netanyahu was projected to win a fifth term in office on Wednesday after nearly complete results from Israel's general election put him in position to form a rightwing coalition, media reports said.
The victory, despite corruption allegations against the 69-year-old premier, puts him on a path 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.
But with 97 percent of the vote counted, results showed Likud and other rightwing parties allied to him with some 65 seats in the 120-seat parliament, media reports said.
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 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 before dramatically wiping lipstick from his face.
"It will be a rightwing 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 an "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.
"Things can change, but in any case the rightwing bloc won," Meshi Sivani, 52 and wearing a Likud t-shirt, said at Netanyahu's post-election party.
Shushan Levi, 61, called Gantz's performance an "enormous victory for an alliance so new." "Once he announced he was entering politics, I followed him," he said at Blue and White's party.
"He was my commander in the army 40 years ago." 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 rightwing voters.
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, 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. (AFP)