JERUSALEM —

Israeli Prime Minister Benjamin Netanyahu and his chief rival faced a midnight deadline Wednesday to form an emergency government to tackle the coronavirus threat and prevent another costly and divisive election.

Netanyahu and former military chief Benny Gantz gathered late Wednesday, after the end of the Passover holiday, for last-ditch talks on a power-sharing deal. If they fail, the country moves closer to a fourth consecutive election in just over a year.

The two rivals were given a 48-hour extension by President Reuven Rivlin on Monday to try to complete the talks after reporting significant progress in their negotiations.

A deal would likely require major compromise by both men. During three bitter campaigns over the past year, Gantz vowed never to serve in a government under Netanyahu, who has been indicted on a slew of corruption charges. The long-serving Netanyahu, meanwhile, would likely be forced to step aside and allow Gantz to serve as prime minister in a rotating power-sharing deal.

Should they fail, parliament will have three weeks to agree upon a prime minister. With that scenario appearing unlikely, parliament would dissolve at the end of the three weeks and the country would be forced into its fourth consecutive election.

Last months election, just like campaigns last September and April, ended with no clear winner. But with a slight majority of lawmakers endorsing him, Gantz was given the first shot at building a coalition.

Although his backers are deeply divided, they were united in their animosity toward Netanyahu, and he began to move forward with legislation that would disqualified the indicted Netanyahu from serving as prime minister in the future.

But with the virus crisis worsening, and his own shaky alliance fraying, Gantz made an about-face late last month and accepted an offer from Netanyahu to pursue a joint government to deal with the pandemic. The move drew heavy criticism from Gantzs supporters and caused his Blue and White alliance to crumble, leaving him with a faction of only about half its original size.

Israel has reported over 12,500 cases and at least 130 deaths from the outbreak, which has paralyzed the economy, shuttered Israelis in their homes and driven unemployment to record highs.

Netanyahu and Gantz appeared close to a rotation deal in which each would serve terms as prime minister. But last week negotiations stalled, reportedly over a demand by Netanyahu to have more influence over judicial appointments.

Netanyahu is awaiting trial on charges of bribery, breach of trust and fraud. He has denied any wrongdoing and portrays himself as a victim of a media and judicial witch hunt.

After three nasty campaigns, plenty of distrust and bad blood remain. Despite his calls for unity, Netanyahu may actually be angling for another election to capitalize on what has generally been regarded as his capable handling of the coronavirus crisis.

A poll published late Monday on Channel 12 TV showed Netanyahus Likud surging in support and easily securing him re-election.

It also would allow him to remain in the prime ministers post for at least several more months to fight his looming trial. Citing the coronavirus crisis, Netanyahus hand-picked justice minister has already delayed the trial by shuttering most of the court system.

Netanyahu currently has the support of 59 lawmakers, just two short of a majority in the 120-seat parliament. If parliament is plunged into a three-week period of uncertainty, Netanyahu will likely use that time to try to lure a pair of defectors from the opposition to give him a majority and avert elections.

With the country led by a caretaker government and hobbled by legislative paralysis since the first election was called in late 2018, a fourth vote would extend the political crisis amid a global pandemic. Its unclear how an election could take place with present-day stay-at-home orders.