Would a long-term truce with Hamas be compatible with the interests of Israel, Egypt and Hamas, ensnared in the web of their common borders? Israel and Egypt would be happy enough just to secure their common border but Hamas, a branch of the Muslim Brotherhood, which was set up for the sole purpose of destroying Israel, as attested to by its charter, is carrying on a relentless war of attrition. Israel retaliated by imposing a land and sea blockade. In order to go around that blockade and keep on receiving arms and ammunition, Hamas turned to the neighboring Sinai Peninsula, blatantly flouting Egyptian sovereignty. Repeated clashes led Cairo to take tough measures against the terrorist organization, however, it always stopped short of frontal conflict. During president Muhammad Morsi’s tenure, a Muslim Brother himself, relations even improved, though Hamas increased the number and scope of its smuggling underground tunnels. There are two reasons for that restraint: solidarity with the Palestinian issue and the need not to damage its status in the Arab world, especially in relation to Israel, in spite of the peace treaty.A quick survey of the fluctuating relations between Hamas and the last three Egyptian presidents shows clearly that it was Hamas which called the tune. The same holds true regarding Israel. Hamas launches attacks whenever it feels like it, disrupting the life of civilian populations on Israel’s side of the border, leading to successive rounds of fighting that stop short of full-blown military operations. Israel has no wish to conquer the Gaza Strip and having to tackle its economic and security problems.Going back to Egypt, the terrorist organization turned the Sinai Peninsula into a de facto terrorist base, ostensibly against Israel but also endangering Egypt’s security. Missiles, explosives and terrorists were smuggled into Gaza through a vast network of tunnels. Local Bedouin were recruited to help move contraband coming from Iran by way of Sudan in the beginning, and later from Libya. Without the cooperation of jihadi groups in the northern Sinai, which formed together with the Ansar Bayt al-Maqdis movement before swearing allegiance to Abu Bakr al-Baghdadi and becoming the Sinai branch of the Islamic State, such large-scope operations would not have been possible. It started in 2008, barely a year after Hamas ousted the Palestinian Authority from Gaza. Its militants, led by Ayman Nofel, a senior Izz ad-Din al-Qassam Brigades commander, broke through the border fence with Egypt in order to infiltrate into Sinai and set up outposts for attacks against Israel in the hope of drawing Egypt into the conflict. The Egyptian Army caught them all and returned them to Gaza with the exception of their leaders, including Nofel who stood trial and went to jail. President Hosni Mubarak refrained from tackling Hamas directly, saying it was up to Israel to deal with what was happening in Gaza. It must be remembered that president Anwar Sadat had refused to take control of the Gaza Strip during peace negotiations, arguing that it was part of the Palestinian problem that Israel had to solve.At the same time, the growing cooperation between Hamas and the Muslim Brothers went on unchecked. When the mass popular demonstrations that ultimately toppled Mubarak started in January 2011, militants from the terrorist organization helped the Brothers create chaos and even took part in raids on jails to free thousands of prisoners, including Ayman Nofel and Sami Sheab, head of a Hezbollah cell that had infiltrated into Egypt and was caught while planning to sabotage the Suez Canal. ALSO SPRUNG in one of the raids was Muhammad Morsi, then a middle-ranking Brother. The supreme military council that ruled the country until elections were held cooperated with the Brotherhood, in which they saw an organized political force that could help restore stability to the country. They nearly turned a blind eye to violent incidents in the Sinai Peninsula, from the repeated bombing of the pipeline bringing Egyptian gas to Israel to attempts to storm police stations. Hamas was later suspected of having contributed to the bombings. Following Morsi’s election, Hamas went on developing its tunnels infrastructure and tightening its links to jihadi organizations in the northern Sinai. It may have gone too far when it was accused by Egyptian media of having taken part in the murder of 18 Egyptian soldiers and kidnapping several others in the border town of Rafah in August 2012. Nevertheless, the president took no measures against Hamas. He did, however, fire the defense minister, appointing in his stead Abdel Fattah el-Sisi, a pious Muslim, in the hope that he would cooperate with the Muslim Brotherhood and ensure the support of the army to the movement. It turned out that Sisi strongly opposed Morsi’s intention to establish an Islamic regime backed by the Brotherhood and demanded that the president let the army launch a vast operation against the jihadi groups and Hamas infiltration in Sinai. Morsi’s refusal enabled the expansion of jihadi terrorism in the peninsula.With his ouster and Sisi’s takeover, relations between the new president and Hamas swiftly degraded. The extent of Hamas meddling in Egyptian affairs during the 2011 demonstrations and its collaboration with the Muslim Brothers became evident through a series of high-profile trials. Hamas activities in Egypt were banned by the courts, its offices seized, and it was branded a terrorist organization. A higher court, however, quashed that decision. Today it is unclear what the status of Hamas in Egypt is. Former president Morsi was condemned to death; so were three Hamas terrorists, but in absentia.President Sisi focused on defeating the Islamic State in the northern Sinai and cutting links between the jihadi organization and Hamas, which was not only letting its terrorists come to Gaza to rest and have their wounds attended to, but also to experiment with new weapons to be used against the Egyptian Army. He acted swiftly and decisively, imposing a blockade on the Strip, opening and closing the border sparsely to pressure Hamas. Of late, the border has been left open to encourage Hamas to reach a long-term truce with Israel. At the same time, more than 1,000 smuggling tunnels were flooded by the army with sewage and later with sea water. A buffer zone five kilometers wide was established along the border. Hamas bowed to the inevitable, swore to cut off its ties to the Islamic State and set up a buffer zone on its side of the border. ISIS retaliated by closing its mutual smuggling tunnels. It is doubtful that all links were indeed severed; the Sinai Peninsula is still vital for the survival of Gaza.President Sisi probably came to the conclusion that a full-blown showdown with the terrorist organization would not be beneficial for his country; furthermore it would deprive him of the role of honest broker in his attempts at reconciliation between the Palestinian Authority and the rulers of Gaza, as well as between the latter and Israel. January 2017 appeared to be a turning point, with Cairo hosting Ismail Haniyeh, the head of Hamas political wing. In June it was the turn of Yahya Sinwar, the leader of the terrorist organization. Then there were a number of delegations coming to confer with Egyptian chiefs of intelligence on the possibility of reaching an understanding between Gaza and Ramallah.AT THE same time, relations with Palestinian Authority President Mahmoud Abbas soured when he declined to attend a summit meeting with Prime Minister Benjamin Netanyahu initiated by the president, because by having direct talks with Hamas the Israeli leader “violated the sovereignty” of the Palestinian Authority. Abbas was upset by Egyptian efforts to facilitate a rapprochement between Hamas and his sworn enemy Muhammad Dahlan, touted as his successor and the man who could bring a reconciliation.Of late, relations between Hamas and Egypt have soured as well; Ismael Haniyeh, who had been granted permission to cross the border, traveled to Iran to take part in the funeral of Qasem Soleimani in violation of his pledge not to do so. He even eulogized the man. Cairo’s anger could be seen in vitriolic attacks in the press; a sudden increase in the price of gas supplied to Gaza by Egypt is attributed to that anger.Demonstrating once more its ability to manipulate both sides, Hamas then launched explosive balloons toward towns and villages across its border with Israel, which promptly sent trucks filled with gas to make up the shortfall.Nevertheless, Cairo is doggedly pursuing its efforts to bring if not a long-term truce, at least a period of quiet. It wants to avoid at all costs a large-scale military operation by Israel that would probably lead Gazans to break through its own border by the tens of thousands. Not only would it have to take care of them; some could turn to terrorism and cooperate with the Islamic State. On the other hand, it is not willing to pay the price of a Palestinian peace agreement with Israel which would entail giving up part of Sinai to settle Gazans; it even rejected a plan to build a sea port in El-Arish to ease the situation of the people of Gaza. Egypt sees Hamas only through the prism of its own security and its status in the Arab world. As to the security of Israel, it is only of concern when it impacts Egyptian interests.The Jewish state has a different take on Egyptian mediation. It offers a strategic opportunity for security cooperation between the two countries based on the peace treaty, while efforts at normalization between the people stall. The new gas deal being implemented these days is not contributing to that normalization, since it is the result of a contract between Israeli and Egyptian companies and does not impact Egyptians directly. President Sisi, who has launched a number of ambitious projects, several of which are in fields in which Israel has proven expertise, such as desalination and agriculture as well as innovation, refrained from turning to that country’s experts. He has left the state of affairs as it was during the Mubarak presidency.In Israel there is no clear-cut consensus regarding a possible long-term deal with Hamas. The deal would have to include measures to improve the welfare of the population: steady supply of water and electricity, creating an artificial island off the coast of Gaza, with a seaport and an airport, which though closely monitored by Israel for security reasons, would greatly contribute to the development of the Gaza Strip. On the one hand, such a solution would dramatically improve the standard of living and theoretically lead to appeasement with Israel; however, freed of the need to take care of the population, Hamas could keep arming itself to an extent similar to that of Hezbollah. It is highly doubtful that an agreement could be reached on the demilitarization of Gaza.It is hard to imagine that a long- term truce would release Egypt, Hamas and Israel from the snare which glues them together. While Egypt and Israel are capable of rational thinking, Hamas, focused on destroying Israel, is still calling the tune.The writer is a former ambassador of Israel in Romania, Egypt and Sweden, and a senior researcher at the Jerusalem Center for Public Affairs.