JERUSALEM – Ending a 510-day political crisis that three elections had failed to resolve, Israel on Sunday swore in a new government charged with responding to the coronavirus pandemic, extending Prime Minister Benjamin Netan­yahu's record-setting tenure just a week before his corruption trial is set to begin.

Netanyahu, 70, has joined forces with his challenger, centrist former army chief Benny Gantz, 60, who now holds the new title of "alternate prime minister," and veto power over most major decisions, control over half the government's ministries and an agreement to switch positions with Netanyahu on Nov. 17, 2021.

But by keeping Netanyahu in office, even as he faces prosecution on bribery, fraud and breach of trust charges over his dealings with wealthy media executives, the new ruling coalition may represent a crowning political achievement for Israel's longest-serving leader.

Only 2 ½ years ago, Netanyahu's closest allies had ruled out the possibility that he could continue in office if he were indicted. Only 2 ½ months ago, a clear majority of Israeli voters had elected lawmakers promising to usher Netanyahu into the political afterlife.

Yet in a matter of weeks, Netanyahu transformed those adversaries into political footnotes.

Gantz's Blue and White party broke apart over his decision to join Netanyahu, the once-dominant Labor party was reduced to two seats in parliament and Arab lawmakers who had sought greater influence than ever over Israeli public life found themselves again on the margins.

Gantz's acceptance of an IOU from Netanyahu could prove foolhardy: Few analysts say they believe that their agreement will survive long enough for Gantz to take his turn as prime minister.

The opposition now lacks coherence. The center-left parties that backed Gantz were joined by Yamina, a right-wing party led by Naftali Bennett, a former defense minister.

Israel's long political stalemate, dating from December 2018, had kept the government in limbo, unable to pass major legislation or enact a new spending plan reflecting changing national priorities.

Netanyahu promised to deliver a new budget "that will prevent the economy from collapsing, that will guarantee stability, that will restore growth — a budget that will give you, citizens of Israel, hope, and a horizon, by restoring three things: jobs, jobs, jobs."