What motivated Hamas to set the Gaza Strip on fire on Friday, sparking an escalation that could have taken the organization to the brink of another military conflict with the Israel Defense Forces—a round that would have brought death and destruction to a territory that is already collapsing under the burden of an Israeli blockade and sanctions imposed by Palestinian Authority leader Mahmoud Abbas, and also quite possibly the collapse of the Hamas regime?

The answer, at least in principle, has several layers.

Hamas understands the geopolitical changes taking place in the Middle East and their repercussions not just for the organization but the entire region. The Arab Spring has had an enormous impact on Arab regimes and led to a far less hostile approach to Israel in the Arab street. Countries like Egypt and Jordan see their peace agreements with Israel as strategic assets, Muslim countries in Africa and Asia have full diplomatic ties with Israel and, according to various reports, countries like Saudi Arabia and the Persian Gulf states no longer hide the fact they are cooperating with Israel. Add to all this the change that U.S. President Donald Trump has effected to global diplomacy.

Hamas hears the plans to rehabilitate Gaza and the billions of dollars to go toward that end, and it wants to see itself in the role of contractor.

Yet Hamas is not even willing to hear about the “Gaza first” plan offered by the Trump administration within the framework of the regional peace plan it is busy consolidating. Details of the plan were presented in a joint opinion piece by senior adviser Jared Kushner, Special Representative for International Negotiations Jason Greenblatt and Ambassador to Israel David Friedman in The Washington Post on Friday. While the plan promises billions in dollars for Gaza’s rehabilitation, it does so in return for a heavy political price from Hamas—first and foremost, the disarmament of the terrorist organization, as well as the other armed groups operating in Gaza.

Hamas has rejected this demand, and what better than literally setting Israel’s south on fire and escalating the security situation in Gaza to make this perfectly clear and, at least for the time being, take the White House’s plan—which has the support of the moderate Arab states—off the negotiating table.

As for deterrence, Hamas has come to understand it cannot rely on kite terrorism and incendiary balloons forever and as a result, has decided to suffice with the “achievement” of killing an Israel Defense Forces’ soldier on the border with sniper fire. The fact that Hamas political bureau chief Ismail Haniyeh was visiting the area where protesters gather near the border fence, not far from where the soldier was shot, and his guards rushed to remove him from the area as soon as they learned of the shooting out of fear of the IDF’s response is proof the decision to kill the soldier was made at the field commander level and not by Hamas’s senior leadership.

Hamas, which has grown accustomed to having the luxury of being warned in advance of IDF strikes so that it can remove its members from positions slated for attack, was surprised by the speed and intensity with which the IDF responded to the soldier’s killing on Friday.

The terrorist organization rushed to seek the mediation of Egypt and United Nations Middle East envoy Nickolay Mladenov to quickly reach a ceasefire. Israeli officials, however, did not suffice with Hamas’s assurances and demanded guarantees from the Egyptians Hamas was committed to completely halt the kite terrorism before they would stop the airstrikes on Gaza. The Egyptian mediators made Israel’s message clear to Hamas, which was that “we will not shoot children and youths flying kites. But we will not hesitate to carry out targeted assassinations of senior members of the military wing and even the heads of the political leadership of Hamas.”

These messages were enough to convince the heads of Hamas that in the event of a military conflict with Israel, the Arab states would not blindly support them as they had done in the past and that they would be wise to accept the terms of the ceasefire in light of their perceived achievement of killing an Israeli soldier on the border.