No country should have to endure the rocket attacks that Israel has endured from militants in Gaza, most recently over the past four days. The question is how to stop them permanently.

On Wednesday, Israel launched one of the most ferocious assaults on Gaza since its invasion four years ago. At least 20 targets were struck and a Hamas military commander, Ahmed al-Jabari, was killed. Israeli leaders also threatened another ground war.

Hamas has controlled Gaza since Israel withdrew in 2007. The group has mostly adhered to an informal cease-fire with Israel after the war there in the winter of 2008-09. But, in recent months, Hamas has claimed responsibility for participating in rocket firings, and last week it took credit for detonating a tunnel packed with explosives along the Israel-Gaza border while Israeli soldiers were working nearby.

Israel has a right to defend itself, but it’s hard to see how Wednesday’s operation could be the most effective way of advancing its long-term interests. It has provoked new waves of condemnation against Israel in Arab countries, including Egypt, whose cooperation is needed to enforce the 1979 peace treaty and support stability in Sinai.