The humanitarian ceasefire in Gaza, which ran until 3 p.m. Thursday, ended abruptly. The two sides went back to fighting each other. Hamas fired rockets all over Israel, and Israel tried to strike the organization’s infrastructure, hitting Palestinian civilians along the way. Then, on Thursday night came the ground offensive — part two of Operation Protective Edge, as the IDF Spokesman put it.

An Israeli delegation had returned from Cairo Thursday morning, where they tried unsuccessfully to reach a ceasefire. According to Egyptian media reports, the delegations from the two sides stayed in the same hotel in Cairo, as Egyptian mediators ran between them trying to bring about a truce.

Hamas’s demands in the Cairo talks make it increasingly clear why the organization went to war. Hamas, it seems, initiated an escalation with Israel when its target was really Egypt. Hamas may be aiming its missiles at Tel Aviv and Jerusalem, but Israel was ultimately a hostage in the Islamists’ effort to get closer to Cairo.

Hamas wants this in order to bring an end to the blockade on Gaza, open the Rafah Border Crossing, and in many ways to ensure its own survival.

On Tuesday morning, many people in Israel raised an eyebrow at Hamas’s rejection of the Egyptian ceasefire. But if we examine the crisis from the prism of Egypt-Hamas relations, we can see things differently.

Cairo offered the organization the same language it rejected from the outset: quiet for quiet. But for Hamas, the big problem was the way the Egyptian ceasefire was presented: At the same time that Razi Hamid, Hamas representative in Gaza, received the Egyptian document, the initiative was already being published in the Egyptian media.

This was a humiliation for Hamas, since no one thought to consult with its leadership. And still, as even senior Hamas officials admit, there is no other mediator in the region. Just like real estate agents who have a monopoly on a certain area, Egypt has a monopoly on Israel-Hamas relations.

Cairo might have no patience for the Palestinian group, treat it like an enemy for its deep connection with the Egyptian Muslim Brotherhood, and want to humiliate it, but Egypt’s own regional standing is no less important. Cairo does not want to see the involvement of any other regional actor, not Turkey and certainly not Qatar. (Egypt sees the al-Jazeera channel, which is so critical of the el-Sissi regime, as the long arm of the Qatari royal family and the semi-official mouthpiece of the Muslim Brotherhood.)

The bottom line is that the key to solving the current escalation was — and remains — in Egypt’s hands, not in those of any other Arab or international party. Hamas demanded the opening of the Rafah crossing between Egypt and Gaza from almost the first minute of the operation. Egypt rejected the idea immediately, as long as Hamas stands on the Palestinian side of the crossing. But Cairo has emphasized that, if there are Palestinian Authority forces under Mahmoud Abbas deployed there, it has no objection to opening the crossing.

Hamas security forces stand guard at the closed gate of the Rafah crossing with Egypt in the southern Gaza Strip in May, 2013. (photo credit: Abed Rahim Khatib/Flash90)

Hamas security forces stand guard at the closed gate of the Rafah crossing with Egypt in the southern Gaza Strip, May 2013. (photo credit: Abed Rahim Khatib/Flash90)

And that is how the idea got rolling. The PA adopted it warmly, since it puts back Abbas at the center of things in Gaza. Israel didn’t reject it, primarily because it trusts Egyptian security oversight at Rafah. Justice Minister Tzipi Livni even held a series of consultations on the matter. And it seems as if, both in Ramallah and Jerusalem, the understanding was that Egypt would offer the opening of Rafah as part of the ceasefire package.

But Egypt didn’t play the proposal entirely right. It first offered quiet for quiet — perhaps in order to push Hamas into the corner, perhaps to keep another arrow in the quiver in ceasefire negotiations, perhaps both. Only after Hamas said no, and came out looking like a warmonger, did Abbas arrive in Cairo in order to come across as the one who proposed the idea that would save Gaza from both Hamas and Israel. A smart move.

The question remains, however, what will happen until the crossing is opened. Placing PA forces in Rafah, along the border and at the crossing, is not the work of a few hours. Abbas and Egypt made the offer to Hamas on Wednesday to first and foremost stop the firing, and then to talk about the opening of Rafah. Evidently the heads of the Hamas military wing were not prepared to do that.

In addition, Hamas has consistently presented other demands, such as the release of prisoners originally freed in the Gilad Shalit deal and re-arrested after the murder of the three Israeli teens last month, to which Israel does not agree at the moment.

And so, on Thursday evening, the possibility of a ceasefire grew dimmer and dimmer, and the ground option that Netanyahu so feared suddenly became the reality.

Who remembers now that some foreign media outlet reported a ceasefire would take effect on Friday morning at 6 a.m.?