JERUSALEM — Even in a country whose politics are routinely fractious and confusing, many Israelis were scratching their heads on Thursday.
Prime Minister Benjamin Netanyahu had been tapped to assemble a new government, just a week after an election that appeared to jeopardize his career. Instead of facing the end of a decade-long run as prime minister, Mr. Netanyahu had a new lease on political life and the possibility of staying in office despite a looming corruption indictment.
It was a remarkable reversal, and it was the result of a series of hardball political machinations in which Israel’s Arab parties played a surprisingly crucial role and Mr. Netanyahu’s chief rival, Benny Gantz, made a risky bet that could still work in his favor.
Israel’s do-over election last week seemed to give the clear edge to Mr. Gantz, a former military chief of staff and leader of the centrist Blue and White party.
Blue and White won 33 seats in Parliament, compared to 32 for Mr. Netanyahu’s Likud. And even more important, Mr. Gantz had won the endorsements of 57 members of Parliament, giving him an edge in reaching the 61-seat majority required to form a government. Mr. Netanyahu had 55.
Mr. Gantz took the lead in endorsements thanks in part to a stunning decision by Arab parties to break a 27-year taboo and weigh in on a candidate for prime minister. The Arab parties were no fans of Mr. Gantz, and said they would not sit in a government with him, but were willing to support him out of a desire to unseat Mr. Netanyahu.
The Arab coalition known as the Joint List won 13 seats, making it the third-largest faction in the newly elected Parliament, and threw them to Mr. Gantz.
“We are part of this mission,” said Thabet Abu Rass, an Arab-Israeli political analyst, adding that there was “full coordination” between Blue and White, which has three former military chiefs of staff in its top four slots, and the Joint List.
It was a strange collaboration, given the Joint List’s aversion to Israel’s military campaigns in the region and occupation of the West Bank. Mr. Gantz was the chief of staff who oversaw the devastating, 50-day war against militant groups in Gaza five years ago.
Then the numbers began to change.
Three of the 13 Arab lawmakers, from the hard-line Balad party, opposed the Gantz endorsement and demanded that their seats be withdrawn. Writing in Haaretz on Thursday, Dr. Mtanes Shehadeh, a Balad lawmaker, cited Mr. Gantz’s military record and what he called his “glorification of the murder of civilians in the Gaza Strip in the previous election campaign.”
Mr. Gantz had ignored the demands of the Arab parties, including repealing a law that declared Israel the nation-state only of the Jewish people, and denied holding talks with them, Mr. Shehadeh wrote.
The Joint List wanted to oust Mr. Netanyahu, Mr. Shehadeh wrote, “but we never promised to do so by supporting the ostensibly less dangerous candidate, Gantz, at any price.”
That brought Mr. Gantz’s endorsements down to 54, one fewer than Mr. Netanyahu.
But that may have been part of Mr. Gantz’s plan.
Ayman Odeh, the leader of the Arab alliance, said Wednesday that a Blue and White lawmaker approached him and told him that 10 recommendations were preferable to 13, because Mr. Gantz did not want to come out on top and go first in trying to form a coalition.
Mr. Gantz believed that if Mr. Netanyahu went first he would fail, Mr. Odeh explained in a Facebook Live video. By going second, he said, Mr. Gantz hoped that other parties would have to compromise and enter a Gantz-led coalition because they would be under pressure from the public to avoid a third election.
The Blue and White envoy, Ofer Shelah, did not deny the assertions, only saying that he did not determine how Balad would vote. Mr. Gantz has not commented on Mr. Odeh’s claim.
The president of Israel, Reuven Rivlin, can use discretion in selecting the candidate he thinks has the best chance of forming a government. Nobody knows what Mr. Rivlin would have done if Mr. Gantz had retained 57 endorsements, only four short of a blocking majority.
But Blue and White’s 54 to Likud’s 55 may have left him with little choice.
Ultimately, Mr. Rivlin discounted even the 10 Joint List recommendations because the Arab lawmakers said they would not join an Israeli government, leaving Mr. Gantz with only 44.
Experts said Mr. Gantz’s strategy of waiting to go second was risky.
“I believe it’s a miscalculation,” said Prof. Yedidia Stern of the Israel Democracy Institute, a nonpartisan think tank in Jerusalem. “I believe Netanyahu has enough options, charisma and experience. I would not take that chance when your rival is Netanyahu.”
Mr. Netanyahu now has 28 days to forge a coalition, and a possible 14-day extension. If he fails, Mr. Rivlin could tap Mr. Gantz to have a try. Failure by both of them would most likely force a third election in a year.
Mr. Netanyahu, who has derided Mr. Gantz as a leftist political naïf and a “radish,” blindly reciting prepared messages, is now advocating what may be the only path to building a majority coalition, a national unity government including Blue and White and Likud.
Preliminary unity talks quickly broke down, however, and the path to unity is fraught.
Mr. Gantz’s party has been advocating a unity government for months but refuses to sit in a coalition led by a prime minister facing indictment on accusations of bribery, fraud and breach of trust. It has also accused Likud of negotiating in bad faith. Mr. Netanyahu already signed up his right-wing and ultra-Orthodox allies in a pact, pledging, in return for their loyalty, to negotiate on their behalf.
“We promised, in the election campaign, that we would form a right wing government with all our partners,” Yariv Levin, a Likud minister and negotiator, told Israeli public radio on Thursday. “We can’t do that, but we can definitely hold onto all our partners and so we shall.”
Speaking to his party faithful on Thursday, Mr. Gantz called upon Mr. Netanyahu and his Likud to resume unity talks immediately, “without preconditions, without spin and without blocs.”
Avigdor Liberman, the leader of the secular, ultranationalist Yisrael Beiteinu party, has so far refused to back either candidate. With eight seats, his party could still hold the balance.
Mr. Liberman, a former Netanyahu ally turned rival, has imposed tough conditions for sitting in a government with ultra-Orthodox parties again, some of which they would be hard pressed to meet. But he said on Thursday that he would be willing to enter into talks with Likud.
But Mr. Netanyahu may be in a hurry, as his political timetable is about to collide with his legal one. He has a hearing set with the attorney general on Oct. 2, and charges could be filed within weeks.
If he is criminally charged, he can only remain in his post if he is prime minister, until a final conviction. As an ordinary minister, he would have to resign.
That prospect, analysts say, has made him desperate to remain in power. Staying in the prime minister’s office, they said, was his best prospect of avoiding prosecution, perhaps by clinching some kind of immunity deal, even if it means forcing a third election.
As long as no new government is formed, he remains in office as caretaker.
“He forced needless elections on us once before in order to save his own skin,” wrote Ben-Dror Yemini, a columnist, in Thursday’s Yediot Ahronot. “Netanyahu is currently ahead in the game of political chess. He’s the winner. Israel is the loser, and we’re all being held hostage.”