Images of thousands of Palestinians massing near the fence between the Gaza Strip and Israel, coupled with the news that almost 20 young men of fighting age were killed in the March 30 confrontation between Hamas and the IDF, looks like a public relations nightmare for the Jewish state.

But as bad as the optics are in the short-term, what is unfolding is a win for Israel. What the riots really tell us is that Hamas’ ability to disrupt Jewish national life every two years or so is being degraded. And that is a very good thing.

Hamas, a group that was previously able to terrorize Israelis with suicide bombings, kidnappings and rocket attacks, is now reduced to staging riots, setting truck tires on fire and getting its young leaders killed in hopeless confrontations with the IDF to generate sympathetic media coverage. News outlets assist Hamas in its PR war, but the fact is, Israelis are increasingly safe from Hamas attacks — and that’s the story that matters.

A terror organization historically dedicated to killing Jews in an effort to demoralize them and drive them from their homeland has failed in its quest and that failure is becoming too obvious to ignore. Hamas is now desperately trying to stay relevant with attention-seeking demonstrations that accomplish nothing other than generating news coverage.

As Hamas’s ability to kill Israelis diminished over the past decade, it used the tragic deaths of Palestinians during confrontations with the IDF as a tool in its propaganda war against Israel, but even this strategy has lost its power to incite the Arab street and force the hands of leaders in the Middle East to attack Israel. As the Gaza riots have unfolded, Egypt has told Hamas to bring them to an end and a Saudi Arabian has acknowledged what Hamas keeps denying – the Israelis have a right to their own land.

A number of factors were necessary to degrade Hamas’ status as a player in the Middle East — which was rooted almost entirely in its ability and willingness to kill and terrorize Jews.

First, the construction of the security barrier between Israel and population centers in the West Bank made it harder for terrorists to murder Israelis in suicide bombings. Second, Israel’s missile defense system assured Israelis that for the most part they will be safe from Hamas rocket attacks, as frightening as they are. Third, Israel was aggressive in confronting Hamas tunnel-digging into Israel. As a result of these strategies — and intense intelligence gathering — Hamas simply can’t get close enough to Israeli civilians to kill them.

All this has forced Hamas to go for broke with something akin to a people’s march on Israel. Salting crowds of civilians with armed Hamas operatives who use these civilians as cover as they attempt to pierce Israel’s defensive barrier is a war crime that has gone unnoticed by the international media, which has fixated on the Palestinian deaths.

But even with the poor coverage, the average person can see the riots for what they are — an attempted invasion. The riots will continue and the death toll will rise, but eventually, Hamas will run out of young men to put in harm’s way and the inhabitants of Gaza will get sick of being used as human shields for failed attacks on Israel and stop showing up at the fence.

Israelis will maintain the resolve necessary to protect their borders and their dignity.

One of the most profound moments in my life came while I was sitting in Ben Gurion Airport in 2014 waiting to return home to the US. I heard a siren, then a boom. I was scared to death, but calmed down substantially as I stood under a stairwell with Israelis who talked excitedly, but without fear, on their cell phones telling their friends and families that they were all right.

The message is clear.

Am Yisrael Chai.

And there isn’t a damn thing Hamas can do about it.