It was Saturday night — protest night in Israel, as it’s been every week since January, when Prime Minister Benjamin Netanyahu’s government revealed its plan for “judicial reform,” a gaslighter’s name for regime change. But on this night in mid-July, the sense of crisis was growing: The Israeli Knesset was gearing up to pass the first law in the planned overhaul, crippling the Supreme Court’s ability to prevent abuses of government power. In central Jerusalem, thousands of people marched the short distance from the president’s residence to the prime minister’s house. So many blue and white Israeli flags waved in the hot breeze it seemed a bright stripe of daytime had been painted on the dark heaven.

Within the crowd, the mood was a mix of anger and the joy of shared anger, the noise a booming chant of “De-mo-kra-tia.” Near me, teenagers wore T-shirts bearing the phrase “I love Bagatz” — the name for the Supreme Court when it hears cases by citizens against the government. In contrast, I’d previously spotted a demonstrator whose sign said, “The High Court legitimizes the occupation.” Two women carried a banner with a drawing of an elephant and the words “The occupation in the living room” — a protest against the other protesters’ silence on the issue. Next to me a thin young man wore an Israeli flag as a cape and held a sign: “Democracy and occupation cannot coexist.”

Here, in these posters and these slogans, is a snapshot of the huge movement for democracy that has arisen in Israel this year — and of the fissure that runs through it. The size of the protests has been possible because the main banner is defending Israel’s internal democracy, but also because people who oppose the occupation are intensely involved.

For the most visible leadership of the seven-month-old movement, the key issues that have long defined left and right in Israel — the occupation, keeping or giving up land, West Bank settlement — have barely been on the agenda. That choice has allowed Israelis from the center right and right to join and even take leading roles. But for many other protesters, it makes no sense to talk about democracy while ignoring Israel’s occupation of the West Bank. And in principle, they’re right: There is an essential contradiction between liberal democracy and the denial of rights to Palestinians.

Yet the fact that the Israeli protest coalition has held together this long, despite its very public tensions, is a remarkable achievement. The all-too-common tendency of movements to demand internal agreement, then split into battling factions, has been largely avoided. And that continued alliance is essential in what is turning into a long struggle. Only by maintaining a big tent can the democracy movement keep and increase its numbers and defeat the government’s dictatorial plans.

This unlikely coalition also makes sense when you look at how the current political crisis came about. In the simplest terms, the occupation is the pre-existing condition that has debilitated Israeli democracy for decades. But Israel’s political drama is set against a pandemic of elected governments around the world that are finding legal avenues to create autocratic regimes. Israel’s crisis has arisen as a result of both. A great many Israelis who ignored the chronic crisis of occupation, or long ago gave up on finding a cure, nevertheless recognize the new and acute threat to the country’s fragile democracy.

The divide within the movement, I admit, mirrors a dissonance I’ve long experienced between two sides of my life as an Israeli. I’ve spent much of my 40 years as a journalist covering the occupation. I’ve sat in the living room of a polite couple in a settlement as they described how they and their neighbors went on a rampage in a Palestinian village. I’ve dug through the decrees that allow settlers in the West Bank to effectively live under Israeli laws while Palestinians live under military rule. I’ve driven the route of the Israeli separation fence through the West Bank with the colonel who designed it, and choked on Israeli tear gas at Palestinian demonstrations against building that fence.

Then I’ve returned to my home inside Israel and reported this without fearing government retribution. I’ve voted in free elections. I’ve lived inside a flawed but real democracy. Yes, liberal democracy and endless occupation are a contradiction. Alas, countries are best understood by their contradictions.

Here’s one personal story of contradiction: In 2003, while researching a book, I asked for access to historical records about the settlement project in the Israeli military archives — and was turned away. I then filed a lawsuit against the archive before the High Court of Justice. I eventually won access to some 40 files. One file proved that in a precedent-setting 1973 ruling, the High Court accepted a specious government argument for expelling thousands of Bedouin in the Israeli-occupied Sinai from their land. In my case, the court’s intervention protected freedom of information in Israel. The court had also legitimized occupation, my research showed.

Yet the court has, on occasion, also blocked moves that egregiously violated Palestinian rights. Just three years ago it overturned a law that would have legalized West Bank settlements built on privately owned Palestinian land. Such decisions are part of the reason much of the right seeks to disempower the court.

In Israel, the main restraints on the executive’s power are the Supreme Court and the attorney general — an independent civil servant whose legal opinions are binding and who heads the state prosecution. As the scholar Kim L. Scheppele has written, globally, a common strategy among the new autocrats is to launch “legal reforms that remove the checks on executive power.” The law that Mr. Netanyahu’s coalition pushed through the Knesset on July 24 fits neatly into that playbook: It eliminates the court’s power to overturn “extremely unreasonable” acts by the government. Among other things, this clears the way for the cabinet to summarily fire Attorney General Gali Baharav-Miara, who has steadfastly maintained her independence. A lackey appointed to replace the current attorney general could theoretically drop the corruption charges against Mr. Netanyahu, bringing a quick end to his long-running trial. (Mr. Netanyahu denies that he will replace her; the protesters have little reason to accept that denial.)

More than that, Israeli law allows for filing a criminal libel charge against someone who defames a class of people. Such a charge is rare, and the attorney general must approve it. But an attorney general appointed to do the government’s bidding could, for instance, charge a journalist who wrote a scathing article about settlers or members of Mr. Netanyahu’s Likud party. The effect on the media would be chilling.

The next step in the so-called reforms would give the ruling coalition full control over appointing Supreme Court justices. Since the Supreme Court chooses one of its members to head the committee that oversees elections, a court subservient to the ruling parties could endanger free elections.

In other words, behind a false front of democracy will stand a dictatorship.

The protests that have erupted in response are intensely patriotic. It turns out that in Israel, defense of one’s country will bring more people into the streets than decrying one’s country. A recent survey by the Israel Democracy Institute’s Viterbi Center for Public Opinion and Policy Research found that 23 percent of a national sample had participated in the protests — including 10 percent of self-identified right-wingers.

Critics within the protest movement, and outside it, can rightly claim that full equality for Arab citizens has never been achieved inside Israel and that equality has been wholly denied in occupied territory. “How can one talk about democracy while holding [Palestinians] under military rule?” an activist in the Anti-Occupation Bloc of protest groups said to me. Members of the bloc regularly march together at the massive demonstrations in Tel Aviv on Saturday nights.

As for other protesters, their stance is often unclear: Are they defending Israel as they’d like to think it is, or as they believe it should become? I can live with that ambiguity, since even the flawed Israel up to now is far better than the one Mr. Netanyahu is trying to create. The strength of the protest coalition and its potential for changing Israel’s current trajectory is in its broad base.

If the government continues to transform Israel’s system of government, it is likely to use its new tools to squelch dissent. Reporting honestly on the occupation and protesting against it would become dangerous. Elections will take place — but electing a government that seeks peace rather than annexation will be far more difficult.

In the long run, democracy and occupation cannot coexist. The only hope for curing Israel’s chronic, potentially terminal condition — the occupation — lies in overcoming today’s acute illness. For now, everyone trying to save Israel’s democracy is on the same side.

Gershom Gorenberg is an Israeli journalist and historian. His most recent book is “War of Shadows: Codebreakers, Spies, and the Secret Struggle to Drive the Nazis from the Middle East.”