JERUSALEM — First came the do-over voting. Now comes the do-over haggling.

A day after their second dead-heat election in five months, Israelis awoke Wednesday with their two main parties feverishly jockeying for the support of the smaller factions they will need to form a governing coalition, leaving uncertain the direction of the country and the fate of its longest-serving leader.

The wheeling and dealing that followed April’s election ended in stalemate. This time, many Israelis are wondering if it will end with Prime Minister Benjamin Netanyahu out of office for the first time in a decade. 

Netanyahu, who fell far short of the decisive victory for which he campaigned so fiercely, appeared Wednesday with other right-wing parties at a Jerusalem news conference, still defiantly pledging to assemble the seats in the Knesset, or parliament, he needs to prevail. He warned, as he did through the election, that the alternative was a government beholden to dangerous leftist and Arab parties.

“A government that relies on the anti-Zionist Arab parties must not be created,” Netanyahu said. He appointed Tourism Minister Yariv Levin to lead his coalition negotiations.

The stakes for Netanyahu are high. Israel’s attorney general, Avichai Mandelblit, is scheduled to hold a hearing Oct. 3 on three criminal cases in which police have recommended indicting Netanyahu. The prime minister has been seeking to win majority support for legislation granting him immunity.

Based on preliminary results expected to be finalized on Thursday, Netanyahu’s ruling Likud party trailed the centrist Blue and White faction, headed by his chief rival, Benny Gantz, by one parliamentary seat, 32 to 33. Both were far short of a 61-seat majority in the 120-seat Knesset.

Gantz met reporters Wednesday, having already begun exploring partnerships with secular ­center-left parties. 

“In a day or two, we will know, and then we will create a strong and broad unity coalition in the state of Israel,” Gantz, dressed casually, said outside his home near Tel Aviv. 

Gantz had also already reached out to Ayman Odeh, leader of the Joint List, the conglomeration of four Arab parties that scored well in Tuesday’s election, securing 12 seats.

“The main thing is that Israeli Arabs have made their voices heard, and what they want is to stop a right-wing government headed by Netanyahu,” Odeh said Wednesday in a news conference outside his home in Haifa. “There is clearly a price for incitement.”

Faring not so well in the election were two right-wing and ­ultra-Orthodox parties Netanyahu had hoped would contribute to his majority. They lost seats, leaving him with no clear path to victory and leading many analysts to declare his storied political career imperiled. 

One scenario is a “unity government” in which Likud and Blue and White share power, possibly with a rotating schedule for prime minister and other top jobs. Many centrists, including Gantz, said they would consider such an arrangement only if someone other than Netanyahu leads Likud.

“It will take some time, but this increases the probability of Likud moving Netanyahu aside and joining a unity government with Blue and White,” said Dan Shapiro, former U.S. ambassador to Israel and research fellow at the Institute for National Security Studies in Tel Aviv. “Of all the possible scenarios, I think that’s now the most likely.” 

Speaking outside his home in the West Bank settlement of Nokdim, Avigdor Liberman, Netanyahu’s former ally and leader of the secular nationalist Yisrael Beiteinu faction, told Israeli media that Netanyahu and Gantz have no choice but to form a broad coalition if they want to avert a democratic crisis. 

“It is a shame to waste more time; we need to get on this track as soon as possible,” Liberman said. His party has garnered about nine seats, giving him a potential kingmaker role in any coalition. He used the same power to deny Netanyahu a governing majority after April’s election, leading to the do-over vote.

At the center of the maneuvering now is Israeli President Reu­ven Rivlin, who in the coming days will offer either Netanyahu or Gantz the first chance at forming a government. Rivlin gave no indication which way he would go. In April, he gave Netanyahu the first crack after the spring election. 

When Netanyahu failed to form a coalition after that vote, he triggered the unprecedented second election. Now Likud operatives are even discussing the prospect of a third vote in coming months.

In a statement, Rivlin’s office made clear that a third election was to be avoided at all costs.

“The president will be guided by the need to form a government in Israel as quickly as possible and to implement the will of the people as expressed in the results of the election, as well as the need to avoid a third general election,” the statement read.

One potential history-making outcome is the possibility that Odeh, the Arab party leader, would consider taking the unprecedented step of heading the country’s formal opposition, something that has never been done by an Arab party in Israel. That would give him the opportunity to meet with high-level visiting dignitaries and gain access to some sensitive security information.

But it was still unclear if Odeh’s faction would take such steps. Included in his Joint List are factions that would have a hard time showing any support for Gantz, a former army chief of staff who led Israel in the 2014 war with the militant group Hamas in Gaza.

Netanyahu placed fear of Arab control near the center of his campaign, and the idea of Arabs in the government unnerved some of his supporters. 

“The country is not going to tolerate Arab parties being part of the government because of all the bombings coming in from Gaza, Syria and Lebanon,” said Bruce Lilling, 65, a semiretired patent lawyer and a dual citizen of Israel and the United States who was running errands in West Jerusalem. He had voted for the Yamina party, an ultranationalist right-wing faction. Of Netanyahu, he said, “Sometimes he forgets his right-wing roots.”