Hamas failed again last week to convince Cairo that it harbors no hostile intentions toward Egypt; the Islamic resistance movement swore that there is no cooperation with Islamic State in Sinai and vehemently denied any involvement in the assassination of Egyptian attorney-general Hashem Barkat last year. It would be difficult, however, to say which of the two is more distrustful of the other. Hamas is an offshoot of the Muslim Brotherhood – and Egyptian President Abdel Fatah al-Sisi came to power after ousting Muhammad Morsi, a member of that organization.Yet geopolitical considerations make some form of dialogue mandatory. There is the Palestinian issue, with Egypt keen to maintain its position as a go-between. Of late, Saudi Arabia has hinted that too much pressure on Hamas might send it to search help from Iran, endangering the Sunni consensus against the ayatollahs.It was Ahmed Yassin, a Muslim Brother, who in 1987 founded Hamas in Gaza as a fighting branch of the Brotherhood dedicated to destroying Israel and establishing an Islamic state on the ruins of the Jewish state. After the Gaza disengagement in 2005, Hamas strengthened its military and political grip on Gaza and drove the Fatah movement out in the bloody coup of 2007. An unholy alliance between the Sunni Jihadi movement and Shia Iran bolstered Hamas, a steady supply of missiles, weapons, and explosives smuggled from Sudan through Egypt and then to Gaza by way of hundreds of underground tunnels.Hamas terrorists took the reverse route to training camps in Iran.Sinai turned into a logistic hub and a base where Hamas could organize and prepare for its fight against Israel. President Hosni Mubarak more or less turned a blind eye to what was happening in spite of the occasional flare-ups with his security forces. As head of the pragmatic front of Arab states against Iran, he believed that Hamas was focusing its efforts on the fight against Israel and allegedly was wont to say that Gaza was Israel’s problem and that Egypt was not obligated to defending Israel’s border. He dismissed Israeli warnings about the potential danger for his own country of smuggling tunnels, which worked both ways.Smuggling networks in the Sinai, mainly manned by local Beduin, were left to develop without hindrance. A major incident occurred in 2008, when thousands of Palestinians broke through the border fence and entered Egyptian territory. Security forces swiftly rounded most of them and built the fence anew, but among those who evaded capture were a number of high ranking terrorists from Izzadin Kassam, the military branch of Hamas, intent on setting up new cells deep into the peninsula as well as in the heartland of Egypt. Their leader, Ayman Nofel, was caught with some of his men and sentenced to life imprisonment.During the popular uprising against Mubarak there were concerted attacks against several prisons on January 29, 2011. Nofel and his team broke out of the Marag jail, together with members of the Hezbollah cell which had plotted terrorist operations against the Suez Canal in order to shut down that vital waterway.Morsi – the future president of Egypt – escaped from another jail with 33 fellow Muslim Brothers. It was widely rumored at the time that forces loyal to the regime had engineered the breaks, to provoke panic among law-abiding citizens terrified at the flight of hundreds of dangerous criminals; a panic which would have led them to clamor for security forces to intervene.This did not happen, because Mubarak resigned a few days later. The military junta that took over ordered the courts to launch a thorough investigation. In July 2013 the court concluded that the attacks had been jointly organized by Hamas and the Brotherhood, with some assistance from Hezbollah, and the assailants, mainly Beduin, recruited among smuggling networks and provided with sophisticated armament and vehicles.Morsi’s election was to signal a new era for Hamas; leaders of the organization were welcome visitors in the president’s house and were allowed to open an office in Cairo; Rafah crossing between Egypt and Gaza opened for 12 hours each day. Egyptian security forces, well aware of the threat of Hamas in Sinai, vainly tried to minimize their contacts with the organization. Morsi condemned Israel’s Pillars of Defense operation against Hamas in Gaza, recalled his ambassador from Tel Aviv and dispatched his prime minster on a solidarity visit to Gaza. He nevertheless urged his security services to broker a truce, having come to the conclusion that openly supporting Hamas and encouraging the pursuit of hostilities would damage his image in the international community.It is yet unclear what led Hamas to make a critical mistake which ultimately brought Morsi’s regime to an end.Jihadists attacked an army checkpoint near the border with Israel in August 2012, killing 16 Egyptian soldiers. Egyptian intelligence accused Hamas of having abetted the operation; there was an outcry in Egypt about the failure of the army to prevent the attack and Morsi decided to dismiss the army commander in chief – replacing him with Sisi.The ouster of Morsi in 2014 and the election of Sisi signaled the end of the idyll with Hamas. The Brotherhood was banned and declared a terrorist organization; Egypt’s attorney- general reopened the file of the 2011 prison breaks and jailed the Brothers who had fled – former president Morsi included. He ordered the arrest of the Hamas terrorists, who prudently stayed away. In June 2015 Morsi was sentenced to death together with 72 Brothers and Hamas militants.The Rafah crossing was closed, opening one a month for three days in order to lessen tension. The Palestinian Authority, technically in charge of the Gaza side, had reached an agreement with Egypt for better opening hours, but Hamas refused to implement it.At the same time, Sisi waged a relentless war against the tunnels, destroying more than 3,000. It was not enough to stop Hamas operations in the Sinai, since they need to control the smuggling routes bringing them the much needed weapons. However, they had to come to an understanding with the terrorists of Daesh, who are strengthening their hold in the North of the Peninsula. The Gaza border thus became a war zone. The Egyptian Army has so far been unable to regain full control.Sisi declared that Izzadin Kassam was a terrorist organization, then forbade all Hamas activities in Egypt; last June a court declared that Hamas was also a terrorist organization.That decision was rescinded, but not the interdiction of all Hamas activities.Hamas is not only accused of aiding Daesh, but also the banned Brotherhood.Hamas staunchly denied all accusations but the latest attempt at some form of understanding last week was a failure. In the background, Riyadh’s attempt to defuse the situation in order to keep the coalition against Iran together may have been the decisive factor in rescinding the decision to call Hamas a terrorist organization. Egypt also wants to maintain some form of working relationship with Hamas because of the pivotal role of that organization in the Palestinian conflict. Nevertheless, it is unlikely that Egypt and Hamas achieve some kind of understanding. Hamas has to be able to operate in the Sinai Peninsula to keep up its fight against Israel, but can only do so through continued cooperation with Daesh. This is against Egypt’s vital interests and there can be no compromise on the issue.