It wasn’t much noticed at the time, but this past winter, as some Egyptians flooded Tahrir Square to bring down a pharaoh, others were busy opening the gates of Cairo’s jails.

Common criminals found their way to freedom, and so too did an unknown, but possibly substantial, number of hardened jihadists, including men involved in some unspeakable acts of terrorism.

All indications are that these men, including some from a group in al-Qaeda’s orbit, have returned to Sinai since their spontaneous parole. Security officials in Egypt and Israel suspect that some of these jihadists may have been involved in repeated attacks on a natural-gas pipeline running between the two countries.

And they worry about more grandiose plots as well -- plots meant to unravel the Egyptian-Israeli peace accord.

The return of Egyptian militants is only one reason the Sinai threatens to become the new Somalia. Another is that Gaza-based terrorists now understand that the Sinai can be their playground.

These men exploited the Sinai’s growing lawlessness a few days ago, when, according to news reports, teams of terrorists associated with the Popular Resistance Committees (a network for which the word “shadowy” was practically invented) tunneled from Gaza into Sinai, made their leisurely way down the peninsula, and entered Israeli territory at will. There they killed eight people at four locations and proved, conditionally, that Egyptian authorities have lost control of the territory returned to them by Israel as part of the Camp David peace treaty.

A Portent

In their pursuit of these terrorists, Israeli gunships mistakenly killed three Egyptian policemen. It was a terrible mistake, of course, but it was a portent of things to come. Egyptians railed against Israel in Cairo, and celebrated as a hero the man who pulled down the Israeli flag from a building housing Israel’s embassy. But the death of those three men was a direct consequence of Egypt’s failure to secure its borders.

Back in the flush early days of the Egyptian revolution, there were many people (I count myself as one) who were swept up in the drama and promise of President Hosni Mubarak’s downfall. Supporters of the revolution directed angry words at those -- in Washington, Jerusalem and the capitals of conservative Gulf monarchies -- who didn’t seem quite so excited.

Many Israelis mourned the departure of Mubarak, not because they opposed democracy, but because they feared precisely what has come to pass: An Egypt unable, or unwilling, to fulfill its security obligations.

Robert Satloff, the executive director of the Washington Institute for Near East Policy, told me this past weekend that “the new reality -- a no-police-zone in Sinai, wall-to-wall political opposition to peace, a Hamas-friendly civilian leadership and a set of military rulers fearful that their fate may be like Mubarak’s in a cage -- makes the cold peace of the ancien regime seem absolutely balmy.”

Egypt, of course, isn’t Gaza -- Israel cannot simply invade the Sinai (though history suggests that it is very good at doing so) and clean out the terrorists. Such an invasion could cause Egypt to make a decisive break with Israel, with profound consequences for the region and for the U.S. It’s up to the Obama administration, and European leaders, to stress to the Egyptians that the security of their border with Israel must be a top priority.

Maximum Restraint

What is also needed is maximum Israeli restraint, not only in Sinai, but also in Gaza. The terrorists who carried out the fatal attack last week came from Gaza, and so have the rockets that have fallen regularly on southern Israel in the past few days. There are loud calls for retaliation in Jerusalem; the opposition Kadima Party has been leading the charge, demanding military operations to root out terrorism.

But a full-blown Israeli attack on Gaza would be a terrible idea, for many reasons. Hamas, the party in charge of Gaza, is not firing the rockets (that is the role mainly of the Islamic Jihad, which Hamas tries to control, intermittently). Israel’s international isolation would only intensify if pictures of Israeli tanks rolling through Gaza were broadcast around the world, and Israel cannot afford more opprobrium now, a month before the Palestinians ask the United Nations to recognize them as a state.

Most importantly, such an attack would inflame Egyptian public opinion, and cause Egypt’s current military rulers to curtail whatever level of security cooperation they’re giving Israel to prevent further terror attacks.

And these sorts of incursions rarely seem to achieve their desired ends. In late 2008, Israel launched the unfortunately named Operation Cast Lead in Gaza, which was meant not only to suppress Hamas rocket attacks but also destroy Hamas’s infrastructure. Israel failed to achieve the second objective, and, although Hamas quieted its rocket launchers after the incursion, it still possesses the capability to launch when it pleases. (Israel can also afford more restraint now that it has developed more sophisticated anti-rocket defenses.)

There are no immediate solutions to these problems. But the best chance to maintain some semblance of peace and to limit the impact of terrorism is for Israel to buttress its anti-missile capabilities and work assiduously to convince Egypt that peace in the Sinai is an overriding, and common, interest.

What Egypt has to do is what it did successfully for decades: secure its border and keep jihadists in jail. We know the Egyptians are capable of doing this. The question is whether they still want to.

(Jeffrey Goldberg is a Bloomberg View columnist and a national correspondent for The Atlantic. The opinions expressed are his own.)

To contact the writer of this article: Jeffrey Goldberg at goldberg.atlantic@gmail.com.

To contact the editor responsible for this article: Timothy Lavin at tlavin1@bloomberg.net.