Israel had to take precautions against its soldiers and citizens being killed or kidnapped. It had to make sure that thousands of Palestinians did not force a total shutdown of southern Israel until all infiltrators were located and detained. Knowing Hamas and its tactics, Israel assumed — for good reason — that letting the marchers cross the fence and detaining them later would have had worse consequences: Hamas operatives masquerading as demonstrators would hurt Israelis.

Of course, the question of Israel’s larger policy toward Gaza remains. But the answer is hardly a secret: Israel pulled out of Gaza more than a decade ago. All it wants from Gaza is peace and quiet. But what it gets from Gaza is different: It is an attempt by Hamas to build a base for violence against Israel. To prevent this, Gaza must be isolated until its leaders are replaced or until they realize that their war against Israel hurts the population they rule more than it hurts Israel. And yes, this means that people in Gaza suffer more than they should — not because of Israel, because of Hamas.

It would be dishonest for me to pretend that the interests of Palestinians are at the top of the list of my priorities. I want what’s good for Israel and I expect my government to have similar priorities. Nevertheless, I believe Israel’s current policy toward Gaza ultimately benefits not only Israel but also the Palestinians.

Of course, it does not benefit the Palestinians who dream about “returning,” or in other words, about eliminating Israel. But it is the only way forward for those who have more realistic expectations. The people of Gaza are miserable. They deserve sympathy and pity. But looking for Israel to remedy their problems will only exacerbate their misery. Expecting Israel to solve their problem will only lead them to delay what they must do for themselves.

There are two reasons for that. First, denying Hamas any achievement is the only way to ultimately persuade the Palestinians to abandon the futile battle for things they cannot get (“return,” control of Jerusalem, the elimination of Israel) and toward policies that will benefit their people. If Hamas is rewarded for organizing violent events, if the pressure on it is reduced because of the demonstrations, the result will be more demonstrations — and therefore more bloodshed, mostly Palestinian. Second, only an Israel that has the ability to feel secure about its borders could engage in any serious talks with the Palestinians. As Ehud Barak, a former prime minister and a critic of Israel’s current government, put it, “Those who believe in having separation from the Palestinians, getting into a peace agreement, having borders — you have to make clear that borders are respected.”

The Jewish sages had a famous, if not necessarily pleasant, saying that went something like this: Those who are kind to the cruel end up being cruel to the kind. As harsh as this sounds amid the scenes from Gaza, as problematic as this seems to good-intentioned people whose instinct is to sympathize with the weaker side in every conflict, sometimes there is no better choice than being clear, than being firm, than drawing a line that cannot be crossed by those wanting to harm you. By fire, if necessary.