They fear they've seen this movie before. In the first reel, the world watches with awe as the streets of a distant capital fill with the young and the angry, brave enough to shake their fist at a hated dictator. In the second, the statues fall, the tyrant flees and all hail a triumph for democracy. But in the final reel there's a twist: the original street rebels are pushed aside, replaced by a tyranny just as ruthless as the one it toppled – and much more menacing to its neighbours.

That's the movie famously screened in Tehran in 1979 and which Israelis fear they are watching again in Cairo in 2011. One senior Israeli official told me: "You can't watch the scenes of all these young people demanding their freedom and not get excited." But at the same time, a question keeps nagging: "Where's this heading?"

The answer Israelis dread is a replay of the Iranian revolution. They recall that the Tehran crowds which won western hearts 31 years ago also looked secular and modern – only to be rapidly displaced by a dictatorship of the ayatollahs. Israel's Egypt-watchers fret that the country's secular opposition parties are small, comprised of intellectuals with little grassroots support. Only the Muslim Brotherhood has the resources and organisation to take control. If the current regime topples, they expect the Islamists to take its place.

To understand why that prospect chills the blood of Israel's policymakers, it's worth recalling a few nuggets of geography and recent history. Egypt looms over Israel from the south, dwarfing it in size and population: 80 million Egyptians outnumber Israelis by more than 11 to one. It is the most populous Arab nation and the de facto leader of the Arab world. If Egypt shakes, Israel trembles.

Perhaps the key strategic event in Israel's 63-year history was the 1979 peace treaty with Egypt. At a stroke, what had been a battle between Israel and the entire Arab world – the "Arab-Israeli conflict" – was reduced to the more manageable dispute between Palestinians and Israelis. For 30 years, Israel has not had to worry about its southern flank. Just look at Israeli defence spending. When Egypt was still the enemy, defence accounted for nearly 30% of Israeli GDP, driving the country to the brink of bankruptcy. Now it stands at just 8%.

So here's the scenario making Israeli heads throb. Hosni Mubarak leaves, replaced eventually by forces dominated by the Muslim Brotherhood. They hold elections – but they are of the "one man, one vote, one time" variety.

Among the new regime's first moves is tearing up the Israel treaty – heeding the demands of those in Tahrir Square reportedly chanting for Mubarak to "go back home to Tel Aviv". No longer will Egyptian forces police the tunnels that run under the border with Gaza: instead Hamas will be allowed to import as much weaponry as it wants, including from Iran. Nor will Cairo play intermediary between Israel and Hamas (useful until Egypt-Hamas relations all but broke down recently).

Suddenly the map will look very different, with Israel facing what one analyst calls Islamist "encirclement: Hezbollah from the north (in Lebanon), Hamas from the west (in Gaza) and the Muslim Brotherhood from the south (in Sinai)."

If that scenario doesn't sound gloomy enough, Israel will have lost something even deeper. Beyond all the talk of borders and buffer zones, what Israel craves is recognition of its legitimacy – starting with acceptance of its existence. The 1979 treaty provided that, signalling an acknowledgement – grudging, maybe; cold, perhaps – that Israel was in the Middle East to stay. If Egypt were to annul that accord, the strategic bedrock of Israeli security and its sense of itself in the region will have been pulled away.

This is what the Israeli official who spoke to me of a "game-changer" has in mind. Suddenly, Jordan would stand alone as the sole Arab state that formally recognises Israel – and judging by King Abdullah's hasty sacking of his prime minister today under popular pressure, that hardly seems a reliable foundation. Lacking the cover once provided by Egypt, the Palestinian Authority would be increasingly isolated in its policy of dialogue with Israel.

Small wonder then that Israel's preachers of realpolitik are left concluding that democracy is fine in theory, but not, when it comes to the Arab world, in practice. As former foreign minister Moshe Arens puts it: "Peace you make with dictators." Only a tyrant, he argues, can deliver the two essentials of any peace deal with Israel: a promise to terminate the conflict and a guarantee of security, with no armed attacks from his territory.

If Arens is right, then Israel is left hoping either for Mubarak to stay on or, at most, for his strongman-in-waiting, Omar Suleiman, to take over. But that is not just bleak in principle – putting Israel on the wrong side of a democratic wave it should welcome – it doesn't make pragmatic sense.

For surely the events of recent days, in Tunisia, Jordan, Yemen as well as Egypt, have shown that no dictatorship is truly sustainable, not for ever. And if those regimes can't last, then nor can any peace made with them. Sure, the peace accord with Anwar Sadat and then Mubarak brought great benefits – but how much bigger a prize would be an Israeli peace with the Egyptian people, one underpinned by their genuine consent? That, and that alone, would be a treaty to last.

The cynics will dismiss such talk as naive and Pollyanna-ish, the stuff of leftist daydreams. But it was the former Soviet dissident turned Israeli politician – and no leftist – Natan Sharansky, who long argued that peace depended on an Arab shift to democracy.

Or listen to the former deputy chief of mission in Israel's Cairo embassy, Ruth Wasserman Lande. She agrees that Israel is right to be concerned by the upheaval in Egypt, that it should remain vigilant, "with seven eyes in the back of its head". But she also urges Israelis to listen to the protesters with "open eyes and an open heart". Doom is not inevitable.

She notes the historic rejection by the Egyptian public of Islamist violence, a trend that dates back to the 1920s. Even now, jihadists who have mounted attacks on foreign tourists have won little popular support. She recalls the joint Israeli-Egyptian Qualified Industrial Zones established in 2005. They provoked protests – not by Egyptians angry at collusion with the enemy, but by jobless Egyptians furious at being excluded from the scheme. Show Egyptians that peace with Israel brings tangible benefits and they'll support it.

Is Lande naive? "I lived alone in Cairo for three years as a Jew and a woman and an Israeli diplomat. It's hard for me to be naive about Egypt." For now, as Israelis watch their neighbour, fear is outstripping hope. But another reaction is possible. It would acknowledge that peace with Arab rulers alone could never last, that one day Israel will have to make peace with the peoples it lives among. That day may not be coming soon – but that truth just got a whole lot harder to avoid.