The last election, like the two before it, produced no clear winner.

Mr. Gantz, a former army chief and leader of the centrist Blue and White party who entered politics not much more than a year ago, came out in a slightly better position than Mr. Netanyahu, the conservative incumbent and Israel’s longest-serving prime minister.

With more endorsements from members of Parliament, Mr. Gantz was afforded the first chance to build a coalition. But the anti-Netanyahu camp, encompassing Arab, Islamic and Jewish ultranationalist parties, proved too disparate to form a government.

Mr. Netanyahu’s Likud party and his right-wing and religious partners fell short of a majority to form their own government in the 120-seat Parliament.

The only way forward was for Mr. Netanyahu and Mr. Gantz to join forces in a national unity government. Mr. Gantz resisted at first because it meant reneging on his repeated election promises not to sit in a government with a prime minister under indictment. Mr. Netanyahu is facing trial on charges of bribery, fraud and breach of trust. He has denied any wrongdoing.

Then the coronavirus hit Israel.

Mr. Netanyahu, a canny political survivor, publicly beseeched Mr. Gantz to join him in a national emergency government to combat the health crisis. He proposed sharing the job of prime minister, with Mr. Netanyahu holding it for the first 18 months, and Mr. Gantz taking over for the next 18.