Egypt has just experienced its second coup in as many years. The event was surprising in two ways. First, it will actually strengthen Egyptian democracy. Second, whether they meant to or not, the Israelis helped make it possible.

The first coup came in February 2011, when the Egyptian Army responded to popular protests by removing President Hosni Mubarak from office. Although it came in the context of the Arab Spring, and the generals claimed it was just an interim measure, this was assuredly a military coup. The Supreme Council of the Armed Forces, led by Field Marshal Mohamed Hussein Tantawi, allowed legislative and presidential elections. But it kept control through the nation’s constitutional court, which oversaw the disqualification of several important presidential candidates and eventually ordered the legislature to dissolve just as voters were electing Mohamed Mursi, the candidate of the Muslim Brotherhood.

Since Mursi was elected in June -- indeed, since the legislative elections in January -- there has been serious tension between the elected representatives of the Brotherhood and the military. The goal of the Supreme Council, and especially of Tantawi, has been to delegitimize the politicians by claiming that they are Islamists intent on turning the country into another Iran. This old tactic, borrowed from Mubarak and other dictators in the region, has resonance in some foreign capitals, and no doubt with some Egyptian secularists who fear what an Islamic democracy in their country might look like.

Weakened Army

Meanwhile, the goal of the Islamic democrats has been to weaken the army and use the fact that they were elected to generate public support. The only trouble with this strategy has been that the army wouldn’t budge, and that the Egyptians who went to the streets for freedom in the early Arab Spring haven’t been eager to repeat their heroic efforts.

Hence the subtlety of the latest coup. It came in the aftermath of an Aug. 5 attack by jihadis on an Egyptian military encampment in the Sinai desert, not far from the Gaza border. The militants, who probably included local tribesmen and al-Qaeda-trained outsiders, and probably got help from Palestinians inside Gaza, killed 16 Egyptian soldiers. Then they crossed into Israel, where they would presumably have attacked Kibbutz Kerem Shalom just across the border. They made it a mile in -- half a mile from the kibbutz -- before Israeli strikes wiped them out.

The resulting humiliation for the Egyptian military gave Mursi the chance he had been waiting for. Over the course of several days, he forced the retirement of the head of intelligence and then of Tantawi himself and the other senior-most brass. They went unwillingly, but they went.

This gives Mursi and the Brotherhood the chance to negotiate power-sharing with a more pliant group of somewhat younger officers who have replaced the old ones. The Supreme Council’s bid to consolidate power has failed.

To make this happen, Mursi used the tools of traditional coups: taking advantage of the weakness of the powers-that-be at their most vulnerable moment. Here is where Israel helped. By quickly and easily killing the jihadis who had just as easily defeated the Egyptian soldiers in the desert, the Israelis reminded everyone concerned that the Egyptian military is weak and ineffectual against the most serious threat it faces, that of jihadism.

Failed Promise

Because the army’s claim to legitimacy was precisely that it could protect the state against Islamists, this was no small point to have made in public. To make matters worse, in Egypt there is still residual memory of the terrible defeat to Israel in the Six-Day War of 1967, which brought down the military regime of Gamal Abdul Nasser. Mursi must have been thanking his lucky stars for the object lesson.

The Israelis didn’t mean to weaken the generals when they killed the jihadis -- they were just protecting themselves. But something more complex was going on, as we saw when Israeli Defense Minister Ehud Barak publicly stated that he considered the attacks “a wakeup call” for Egyptian authorities.

Presumably, Barak wanted only to send the message that Sinai security must be improved and that militants in Gaza should be reined in by Egypt, which has significant and increasing influence there. Yet the effect was to weaken the very generals whom the Israelis had previously seemed to support. The message was that the generals were not taking their job seriously. This, too, was a major gift for Mursi --something Barak should have foreseen.

In addition to the unwitting help from Israel, Mursi’s success depended on his fundamental democratic legitimacy. The techniques were traditional, but the situation was shocking for the Arabic-speaking world: A coup against a usurping military leader was brought about by the democratically elected president -- not the other way around.

This is a harbinger of good things for the Arab Spring, which has been badly stalled in large part because of the Egyptian Supreme Council. The remarkable democratic successes of tiny Tunisia are not enough to make the Arab Spring a historically significant moment. For that, there must be transformation on a bigger scale.

Egypt, historically the regional leader, is the best possible demonstration case for Arab democracy, which so far means Islamic democracy. If Egypt can succeed, then anything is possible -- even a democratic outcome from Syria’s civil war.

(Noah Feldman, a law professor at Harvard University and the author of “Scorpions: The Battles and Triumphs of FDR’s Great Supreme Court Justices,” is a Bloomberg View columnist. The opinions expressed are his own.)

To contact the writer of this article: Noah Feldman in Cambridge, Massachusetts, at noah_feldman@harvard.edu.

To contact the editor responsible for this article: Tobin Harshaw at tharshaw@bloomberg.net.