JERUSALEM — Avigdor Lieberman, Israel’s hard-line defense minister, stepped down from his post on Wednesday after the government agreed to a cease-fire with Hamas to end two days of cross-border clashes, in a surprise move that could prompt early elections.

The decision by Mr. Lieberman to step down, and to withdraw his hawkish Yisrael Beiteinu party from Prime Minister Benjamin Netanyahu’s coalition, will decrease the number of seats held by the government from 66 to a precarious 61 in the 120-seat Parliament.

The battle to replace him could precipitate the beginning of the end of the Netanyahu government as the prime minister, whose calling card has been national security, faces increasing criticism from his right-wing rivals who say he was too quick to agree to the cease-fire.

The political crisis began with a covert Israeli intelligence operation in Gaza on Sunday that went awry and spiraled into the fiercest round of fighting since the last Gaza war in the summer of 2014.