JERUSALEM — Benjamin Netanyahu, Israel’s conservative prime minister for the past decade, and his chief rival, Benny Gantz, a centrist former military chief, were locked in a tight race in Tuesday’s parliamentary election, according to partial returns and surveys of voters leaving the polls.
With about 65 percent of the ballots counted, Mr. Netanyahu’s Likud party appeared to have edged ahead of Mr. Gantz’s Blue and White, and a count of the broader blocs supporting each party gave Likud a clear advantage in being able to form a governing coalition.
Regardless of who becomes the next prime minister, the election appeared to be a grave scare for Mr. Netanyahu, 69, a dominant global player who has built a strong economy, kept the country safe and delivered a series of long-sought diplomatic victories, many of them thanks to President Trump.
Likewise, no matter who wins, Mr. Gantz’s strong performance was a remarkable achievement for a political newcomer and a brand-new party. Mr. Gantz, a career soldier who retired as chief of staff in 2015, entered politics last year for the first time, joining forces with two other former army chiefs in an effort to blunt Mr. Netanyahu’s claim that only he could keep Israel safe.
More than a million Israelis appeared to have voted for Mr. Gantz’s Blue and White party, placing it in the position of being the main alternative to Israel’s right wing, a spot once held by the Labor Party.
The results were likely to take fuller shape as vote counting progressed in the early morning. But many Israelis went to bed on Tuesday suspended in a post-ballot twilight zone, and the question of who will form the next government may not be known until the ballots of soldiers, prisoners and hospital patients are counted later this week.
The exit polls of the three main television channels were sufficiently disparate that both sides claimed victory.
“This is a night of tremendous victory,” Mr. Netanyahu said after entering a jubilant campaign celebration around 2 a.m. to cheers and chants of “Bibi, king of Israel.”
“I believe that the Lord and history have given the people of Israel another opportunity, a golden opportunity to turn our country into a strong nation, among the strongest nations of the world,” he said.
He said he expected to forge a new coalition with the right-wing parties he called his “natural partners,” but that he intended to be “the prime minister of all the citizens of Israel.”
Earlier, Mr. Gantz entered a packed election-night headquarters in Tel Aviv to thunderous cheers, declaring, “A great light is shining over our Israel.”
“We are the winners!” he said, thanking Mr. Netanyahu for his years of service. He promised to be “the prime minister of everyone and not just of those who voted for us,” and argued, when early exit polls had him in the lead, that the largest party should be the one granted the mandate to form the next government.
That decision will be up to President Reuven Rivlin, who in the next few days is expected to choose the party leader he believes has the best chance of assembling a parliamentary majority.
As Mr. Netanyahu has drifted steadily to the right, the left has migrated to the center, after years of violence in the early 2000s and the absence of a viable peace process since.
He has benefited from strong support from President Trump, who in the past two years has withdrawn from the Iran nuclear deal, recognized Jerusalem as Israel’s capital and just two weeks ago recognized Israel’s sovereignty over the Golan Heights.
But Mr. Netanyahu’s pursuit of a fourth consecutive term came as he faces indictment for bribery and other corruption charges. The evidence in those cases, which was kept under wraps until after the election to avoid leaks that could tilt the contest against Mr. Netanyahu, are now to be turned over to lawyers in the case, meaning Mr. Netanyahu could be plagued by damaging reports while he tries to assemble a coalition.
And even if he succeeds in forming a government, it could be difficult for him to remain in office once formal criminal charges are lodged against him, possibly as soon as late summer.
Mr. Netanyahu spent much of the past year undermining law enforcement officials and the gatekeepers of Israel’s liberal democracy, railing against the police, the attorney general and what he called the “leftist” mainstream media, trying to delegitimize his critics and organizations working for Palestinian rights. His government has also worked to curb the powers of the Supreme Court.
Even as Mr. Netanyahu forged diplomatic ties and trading partnerships with new countries, he stymied any prospect of a resolution of the Israeli-Palestinian conflict, aided by a weak, divided and at times recalcitrant Palestinian leadership. Veering farther to the right in the final days of the election campaign, he pledged to start annexing parts of the occupied West Bank if re-elected, a move he had long resisted.
He was widely expected in his coalition negotiations to try to trade passage of annexation laws for retroactive immunity to prosecution in the corruption cases against him.
But Israelis as a whole have lost faith in a two-state solution, polls show, and the election seemed to bear that out.
For many Palestinians, the distinctions between Mr. Netanyahu and Mr. Gantz were inconsequential.
Saeb Erekat, the chief Palestinian negotiator, pointed to one exit poll showing that only 18 of the Parliament’s members still supported a two-state solution, calling this “a consequence of the culture of impunity granted to Israel.”
“What the exit polls suggest is that Israelis have voted to preserve the status quo,” he said. “They have said ‘no’ to peace and ‘yes’ to the occupation.”
Early analysis showed a historically low turnout among Arab citizens of Israel, many of whom boycotted the vote out of disillusionment with Israeli politics and with their own politicians.
By nightfall Arab leaders were frantically trying to rally their supporters, mosques were broadcasting appeals from minaret loudspeakers, and a last-minute surge of participation seemed to materialize in some predominantly Arab towns, though that was not captured in exit polls.
Though Mr. Netanyahu and Mr. Gantz are polar opposites in style, an unclear outcome could raise the chance that they would try together to forge a unity government if neither is able to build a coalition with a majority of 61 members in the 120-seat Parliament.
“The question is whether people will climb down from their trees or not,” said Abraham Diskin, a professor emeritus of political science at the Hebrew University of Jerusalem, referring to the lofty demands and conditions some party leaders have already placed on entering a coalition.
Mr. Gantz and his allies in the Blue and White alliance have pledged not to join a government with a prime minister facing indictment, but a coalition with Likud without Mr. Netanyahu remains a possibility.
Some ultra-Orthodox politicians ruled out joining a government organized by Mr. Gantz.
The focus could now shift to President Rivlin, who will meet with representatives of all the parties in the coming days and, based on their recommendations, decide to call upon whoever he thinks has the best chance to form a government.
“For the first time in Israel’s history the president’s role may be more than symbolic, and he may have to exercise judgment in choosing who will form the next government,” Yohanan Plesner, president of the Israel Democracy Institute, wrote on Twitter.
That prospect has alarmed Mr. Netanyahu, whose relationship with Mr. Rivlin, a Likud veteran, has long been one of deep, mutual loathing.
“Legally, Rivlin can give the task of forming the government to whoever he wants,” Mr. Diskin, the political science professor, said.
Like most Israeli election campaigns, this one ripped open the fissures in Israeli society. But with Mr. Netanyahu facing indictment and battling for his political survival against Mr. Gantz, the most credible challenger in a decade, many Israelis said it was the nastiest and most divisive race they could recall.
With three former army chiefs in Blue and White’s top four slots, Mr. Netanyahu was unable to rely on his usual politics of fear, presenting himself as the only candidate able to provide Israelis with security.
Instead, his campaign focused largely on perceived enemies within.
Mr. Netanyahu fanned the flames of anti-Arab sentiment, warning Israelis that Mr. Gantz would “hand over parts of the homeland to the Arabs.” He also joined forces with a racist faction, one of whose members was ultimately barred from running in the election by the Supreme Court.
On Election Day, Mr. Netanyahu’s Likud acknowledged sending more than 1,000 activists with cameras into polling places in Arab towns in what they said was an effort to capture evidence of any irregularities, but Arab leaders called it a blatant attempt at voter intimidation.
The dwindling left, for its part, accused Blue and White of being right-wing, saying that it was conspiring to join a Netanyahu government.
Mr. Netanyahu tried to cast the race as one between an experienced world leader and an unproven political novice. His party raised questions about Mr. Gantz’s sexual propriety, his vulnerability to extortion by the Iranians after his cellphone was apparently breached, and even his mental stability.
Mr. Gantz’s party said it wanted to put Israel back on course. It fought Mr. Netanyahu’s polarization with promises of restoring a sense of unity, decency and democratic values.
The fate of smaller parties at both ends of the spectrum was unclear and could still prove decisive. Exit polls there were mixed as well, leaving everyone still waiting for official results.
“It’s been a long night,” Mr. Netanyahu said at his post-midnight rally. “And it will be a long day waiting for the true results.”