THE LATEST mini-war between Israel and the Hamas movement is as unwinnable for either side as previous rounds in 2009 and 2012. Though it has stockpiled thousands of rockets and some longer-range missiles, Hamas lacks the ability to inflict serious damage or casualties; a new anti-missile system has blocked most of the warheads headed toward Tel Aviv and other populous areas. Israel, for its part, can target Hamas commanders and infrastructure in Gaza but probably can’t entirely silence the rocket launchers. A ground invasion of Gaza, for which troops are now being mustered, would cause heavy casualties and, if it destroyed Hamas, leave Israel with the task of governing the territory and its nearly 2 million people.

Both sides thus seem to be playing for tactical rather than strategic gains. Israel would like to reduce the military power Hamas has built up since the last conflict, slightly more than 18 months ago; Prime Minister Benjamin Netanyahu on Wednesday said his aim was to stop the rocket attacks and restore “quiet.” Hamas hopes to win concessions, including the release of operatives recently rounded up by Israel and the opening of its border with Egypt, in exchange for a cease-fire.

Those goals hardly seem worth the bloodshed — nearly 50 people reportedly had been killed in Gaza by late Wednesday, including civilians — or the economic losses to both Palestinians and Israelis. In fact, neither side wanted war. Hamas had just agreed to back a united Palestinian government with the West Bank-based Fatah movement, while Israel quietly offered a truce before the escalation of hostilities on Sunday. As so often happens in the Middle East, acts by extremists forced these events: the kidnapping and murder of three Israeli teenagers allegedly by Hamas militants apparently acting on their own; the revenge murder of a Palestinian by Israeli thugs; the initial firing of rockets from Gaza by small militant groups challenging Hamas’s authority.

The first imperative in these circumstances is to stop the fighting before it escalates beyond the control of either side. That will be harder than in 2012, when the Obama administration teamed with Egypt’s then-Islamist government, but contacts at least have begun. The larger challenge will be finding a way forward from what, before the new fighting, was already a dangerous low point in Israeli-Palestinian relations. Since the collapse of U.S.-sponsored peace talks in April, both sides have been gravitating toward militant strategies: Israel is contemplating new settlement construction, while Palestinian Authority President Mahmoud Abbas is relaunching his campaign to obtain Palestinian membership in international organizations, such as the International Criminal Court, that then can be directed against Israel.

Obama administration officials argue that this deterioration proves that it was right to pursue a comprehensive Israeli-Palestinian peace settlement. In our view, the failed U.S. effort, with its tight timetable and disregard for the obvious unwillingness of leaders on both sides, merely raised expectations that could not be met, making a backlash inevitable. What’s needed is not another diplomatic blitz but a more patient, incremental and sustainable effort to restore trust between Israelis and Palestinians, improve economic conditions in the West Bank and Gaza, and create the foundations for an eventual settlement. That is if the fire in Gaza can be put out.

An Iron Dome launcher fires an interceptor rocket in the southern Israeli city of Ashdod July 9, 2014. (Baz Ratner/Reuters)