After two weeks of protests and denunciations, it’s time to acknowledge that outrage won’t end the war in Gaza. The most plausible way to stop this cycle of violence is through internationally supervised demilitarization. Amid so much death and destruction that may seem utterly hopeless. But in fact, many of the tools we need are already in place. Here’s an analysis of the problem and how to fix it.

1. Gazans have no government to protect them. Every day, more civilians die in Gaza. Israel, the country that’s killing them, has agreed to cease-fire proposals. But Hamas, which controls Gaza (though many of its political leaders don’t even live there), rejects these proposals and continues to fire rockets into Israel. You can argue that the rockets justify Israel’s attacks or that they serve merely as a pretext. Either way, they get more Gazans killed.

The only way to make sense of Hamas’ behavior is to recognize that its goal is not to stop the killing but to exploit it. That explains why Hamas encouraged Gazans to stand atop targeted buildings and ordered them to stay in areas where Israel had issued pre-invasion evacuation warnings. It also explains why Hamas insists that Israel grant concessions in exchange for a cease-fire. Hamas thinks a cease-fire is a favor to Israel. Given the gross imbalance in casualties, that’s a pretty clear statement that Hamas thinks Gazan deaths should bother Israel more than they bother Hamas.

That is just the latest display of Hamas’ warped priorities. Another illustration is its tunnels. It has diverted hundreds of thousands of tons of building materials from civilian projects to tunnel construction. The tunnels to Egypt, which are largely for commerce, are rudimentary. The tunnels to Israel, which are for military attacks, are elaborate. Hamas cares more about hurting Israelis than about helping Gazans.

2. The absence of a protector in Gaza has worsened Israel’s behavior. Israel knows from experience that invading and occupying Gaza is bad for Israel. During the present conflict Israel has signaled its willingness to stop, first by unilaterally honoring Egypt’s cease-fire proposal, then by postponing a ground invasion. But Hamas has pressed on, daring Israel to go further.

Israel has unwisely accepted the dare. Its mission has expanded from bombing the rocket launchers to destroying the tunnels. Predictably, the number of tunnels has grown. The number found so far ranges from 23 to 45. One report, based on infrared satellite imagery, says there might be 60 or more. Now the fighting has spread to Hamas’ suppliers—on Friday there was a mysterious strike in Sudan—and Israeli hawks are talking about recapturing the Gaza-Egypt border. There’s always another mission you can add to make Gaza “safer.”

Worse, Israel has adopted Hamas’ use of human shields as a blanket excuse for civilian deaths. It’s true that Hamas has used civilians this way, putting its rockets in schools, mosques, and hospitals, for example. But Israel has twisted these case-by-case abuses into a categorical claim that every civilian death is Hamas’ fault. This kind of thinking inherently corrupts an invading army.

Now some Israeli government ministers are calling for sweeping measures against Gaza, such as cutting off its electricity. The line between fighting Hamas and fighting Gaza is blurring.

3. Israelis have lost faith in a military solution. Since withdrawing its troops from Gaza in 2005 (but maintaining control over Gaza’s borders, coast, and airspace), Israel has fought three wars there. By now, almost no one in Israel, other than the far-right fringe, believes force will stamp out Hamas or teach it a lasting lesson. The missiles get restocked, the tunnels get rebuilt, and every dead Hamas fighter is replaced by at least one more. Israel’s callous phrase for its periodic operations in Gaza—“mowing the grass”—is a confession that force doesn’t work. Israelis expect that after this war, they’ll be at it again within two years.

Each time, the futility becomes clearer. Gaza is so densely populated that you can’t bomb it without killing civilians, and you can’t send in ground forces without getting bogged down in the kind of urban warfare that spells death for invading troops. More than two dozen Israeli soldiers have already died in this operation, and one is missing. If Hamas captures another Gilad Shalit, it could easily extract concessions that would make the invasion a net loss for Israel.

4. There’s an obvious candidate to take over Gaza. Seven years ago, after winning a parliamentary election, Hamas seized military control of Gaza from Mahmoud Abbas, the president of the Palestinian Authority. But times have changed. The Hamas regime is bankrupt, and Abbas, who preaches nonviolence, is the one with access to international agencies and donors. That’s why Hamas agreed in April to form a unity government controlled by Abbas.

Here’s where Israeli Prime Minister Benjamin Netanyahu made a wrong turn. He halted peace talks with Abbas, denounced the merger, and did everything possible to sabotage it. That was stupid, because if anyone can coax Hamas toward a more rational style of government, it’s Abbas. Israelis grouse about Abbas, but he has done a lot to merit their trust. His security forces in the West Bank have cooperated with Israel even when it angers Palestinians.

Abbas would restore a government in Gaza that protects the people. He’s already coaching Hamas on how to respond more intelligently to the Israeli bombardment. (First step: Accept a cease-fire.) He’s meeting with officials from Egypt and other countries, who can help Gaza but have been spurned by Hamas. In effect, he’s being treated internationally as Hamas’ adult supervisor. And Hamas is beginning to listen.

5. The pieces of a solution are in place. Netanyahu and other Israeli politicians are converging on a proposal by Shaul Mofaz, Israel’s former defense minister, to demilitarize Gaza in exchange for $50 billion in aid. That’s nearly 30 times Gaza’s GDP, but it’s not a lot to ask from international donors, who might find it a better use of their money than paying for reconstruction after another Gaza war. (The damage from the last two weeks alone will cost $3 billion.)

A credible international coalition would have to oversee the demilitarization. That’s a useful mission to propose to the many countries that have expressed outrage over the carnage in Gaza: Put your soldiers and your money where your mouth is. (The European Union reaffirmed this commitment on Tuesday: “All terrorist groups in Gaza must disarm.”) Meanwhile, Hamas’ chief arms supplier, Iran, would have to be pressured to back off. Fortunately, Iran has been trying to rebuild good will and is in the midst of productive talks with the United States, to which this issue could be added.

Israel would resist yielding control of Gaza, but current conditions make Israeli flexibility more likely. The success of the Iron Dome anti-missile system has given Israelis confidence that if rockets start flying out of Gaza again, they can withstand the barrage without casualties for a while. The election of an Egyptian government hostile to Hamas strengthens Israel’s trust that Gaza’s Egyptian border won’t become an easy channel for importing weapons. Israelis also complain that loosening restrictions in Gaza after a war with Hamas would reward violence. But Israel accepted that tradeoff 20 years ago, when it agreed to the principle of land for peace.

Hamas, too, has essentially accepted this principle. Netanyahu claims that Hamas, like al-Qaida, “has no resolvable grievance.” That’s nonsense. Last week, Hamas issued a long list of demands, in exchange for which it offered Israel a 10-year truce. Many of these demands, such as an airport and the free flow of commerce across borders and the sea, are perfectly negotiable.

Ten years is a long time. If Gaza could go 10 years without another war, and build an economy that looks more like the West Bank, we might not need another deal to keep the peace in place.