The moment Israel’s devastating war in the Gaza Strip ends, the unfinished conflict within Israel over its future will begin again. Prime Minister Benjamin Netanyahu and his right-wing coalition partners know this. That may be, in part, why they have set the improbable aim of “total victory” as the war’s ultimate objective, and why they have so far refused any deal that would end the fighting in exchange for returning the roughly 100 hostages still in Hamas captivity. After almost six months, this war is already Israel’s longest since Israel’s war of independence.

The assault on Gaza has nearly frozen Israel’s fractious political system. Once-ferocious debates have largely been put on hold. Even Mr. Netanyahu’s most vociferous critics seek to avoid being painted as treasonous during a time when massive banners declaring “Together We Will Win” hang from skyscrapers. For months all of the country seem to have rallied behind the war. In service of keeping the war going, and unencumbered by any real opposition, Mr. Netanyahu also steered his country into a head-on collision with its most significant backer, the United States, putting his short-term political considerations ahead of the country’s long-term interests.

In the weeks following Hamas’s gruesome Oct. 7 incursion, Mr. Netanyahu’s political future looked bleak. The prime minister had long boasted that his more than 15 years in power had been Israel’s most secure; Hamas’s attack shattered that legacy. The man who described himself as “Mr. Security,” who said he hoped to be remembered as “the protector of Israel,” appeared responsible for the deadliest single day in Israel’s history. Even as military and intelligence leaders have since stepped up to take the blame, Mr. Netanyahu has pointedly refused to acknowledge his own culpability.

A poll published in January found that only 15 percent of Israelis wanted him to remain in office after the war. And, in another recent poll, by Israel’s Channel 13, most Israelis said they did not trust Mr. Netanyahu’s handling of the war. Support for his right-wing Likud party has likewise cratered.

And yet, Mr. Netanyahu remains in power, largely unchallenged.

For roughly 39 weeks before the start of the war, hundreds of thousands of Israelis in cities across the country demonstrated every Saturday night against the Netanyahu government’s hard-right agenda, and in particular against its plan to all but completely undercut the country’s judiciary. After Oct. 7, at the very moment Mr. Netanyahu became more unpopular than ever before, the grass-roots movement that had emerged to challenge his government fell nearly silent.

At the same time, Mr. Netanyahu skillfully outmaneuvered his most serious rival, Benny Gantz, the former Israel Defense Forces chief of staff, who brought his National Unity party into Mr. Netanyahu’s emergency coalition following the Hamas attacks as a show of patriotic responsibility. The war’s transition from immense aerial bombardment and full-scale ground invasion to a grinding counterinsurgency has kept Mr. Gantz and his party from leaving — and enabled Mr. Netanyahu to head off a new round of elections.