Hamas has long sought to stymie Egyptian control over the peninsula and keep its weapons smuggling routes open, but its latest opportunistic gamble on local jihadists carries wider dangers that should be nipped in the bud by sponsors Turkey and Qatar.

In recent months, Hamas has been increasing its clandestine military cooperation with the Islamic State's so-called "Sinai Province." This cooperation culminated in a prolonged secret visit to Gaza this month by IS Sinai's military chief Shadi al-Menai, who held talks with his counterparts in Hamas's military wing, the Izz al-Din al-Qassam Brigades (IDQB). Menai has been at the top of Egypt's most wanted list since an attempt to kill him failed in May 2014.

No information has been provided about the discussions, and some Hamas officials denied the initial report (made by this author) that a visit was taking place. Yet one can safely assume that Menai's trip, via one of the few remaining underground tunnels along the Egyptian border, was dedicated to increasing arms deliveries through these tunnels and expanding Hamas military assistance to IS Sinai operatives.

CROSS-BORDER SMUGGLING AND TRAINING

Over the past two years, IS Sinai helped Hamas move weapons from Iran and Libya through the peninsula, taking a generous cut from each shipment. Hamas relies on Bedouin guides to avoid detection by the Egyptian army and reach the few tunnels that have survived Cairo's aggressive flooding and closure campaign. In this manner, IS Sinai acquired the advanced Kornet antitank missiles it has used to sink an Egyptian patrol boat off the coast of al-Arish and destroy several tanks and armored carriers stationed in the peninsula's northeastern sector. Hamas has also provided training to some IS Sinai fighters and assisted with the group's media campaign and online postings.

One of the main Hamas officials involved in this activity is Ayman Nofal, former commander of the IDQB's Central District Brigade. Prior to his 2008 arrest by Egyptian authorities, he was in charge of developing Hamas's system of safe houses and collaborators among the Bedouins. He managed to escape from a Cairo prison in 2011 during the riots accompanying the Arab Spring and soon resumed his work in Sinai.

LITTLE PROGRESS IN EGYPT DESPITE WARNINGS

Since 2013, Israel has agreed to effectively modify the military annex of the 1979 peace treaty by permitting Cairo to introduce attack helicopters and more than a mechanized division's worth of ground forces into previously prohibited areas of the Sinai. Despite this escalation, however, the Egyptian army's campaign has not curbed the local IS branch. Around a thousand heavily armed Bedouins affiliated with the group still pose a serious threat to Egyptian troops and government offices. Attacks occur almost daily on administrative facilities, roadblocks, and mobile patrols, while the group's improvised explosive devices are becoming more effective.

In response, Egyptian forces now refrain from night patrols, barricade themselves in camps, and move around only in armed convoys. Similarly, the Multinational Force & Observers (MFO) has pulled its personnel from some outposts and discontinued certain inspection missions. Egypt's intelligence-gathering capability in the peninsula is still lacking, and local commanders are reluctant to venture into IS Sinai strongholds such as Jabal Halal and Wadi Amr, preferring to target such areas from a distance with artillery, F-16 bombing runs, or attack helicopters.

Therefore, despite losing dozens of operatives, IS Sinai remains confident enough to press forward with its goal of exporting terrorist operations across the Suez Canal into mainland Egypt. In this context, one should bear in mind that sizable communities of Sinai Bedouins live in Cairo, mainly from the Tarabin tribe. IS could also try to cultivate an alliance with Salafi groups that oppose President Abdul Fattah al-Sisi.

It should also be noted that Israeli intelligence has been alerting Western and Arab security agencies for over a year now to the growing cooperation between Hamas and IS Sinai. Until a few months ago, these warnings were met with skepticism because Israel was reluctant to share its sources. Lately, however, a sufficient body of evidence has led to a reassessment by the MFO, spearheaded by veteran U.S. diplomat David Satterfield and various intelligence agencies. Egypt's General Intelligence Directorate and military intelligence officials are convinced that Hamas is engaged in a sustained effort to undermine government control over the Sinai, even as it publicly seeks a rapprochement with Cairo. This conviction is frequently manifested by vitriolic anti-Hamas rhetoric in the Egyptian media, especially on television.

HAMAS'S INTERNAL CALCULUS

The ongoing cooperation with IS Sinai has been quite controversial among Hamas's top echelons, since many leaders are concerned that it will poison their already-tense relationship with Sisi's government. Therefore, the group's Shura Council and Political Bureau have seemingly refrained from making a decision about reaching out to IS Sinai. Instead, the cooperation is reportedly managed by a handful of high-ranking IDQB commanders as a semi-independent initiative, without prior approval by Hamas leader Khaled Mashal in Qatar or even his deputy in Gaza, Ismail Haniyeh. Both of them turn a blind eye to the continuing flirtation with IS Sinai.

In fact, Hamas has been cultivating relations with tribes and minority Palestinians in the Sinai since before it took over Gaza in 2007. The group needed consent from the tribes -- especially the Sawarka, Breikat, Ramailat, and Tarabin -- to move weapons through their turf, and it has gradually established a network of local collaborators to store rockets for use against Israel. It already arranged for some of these rockets to be fired against the resort town of Eilat and other areas during past ceasefires with Israel. The Muslim Brotherhood administration of former Egyptian president Mohamed Morsi only facilitated this major expansion of Hamas activity.

As a result, Hamas operatives have witnessed firsthand the rise of Salafi jihadist groups among Sinai Bedouins during the past decade. After the Brotherhood was ousted from government in 2013 and Egypt instituted its blockade of Gaza, Hamas responded by assisting the main terrorist organizations in the peninsula: Ansar Beit al-Maqdis and Majlis Shura al-Mujahedin Fi Aknaf Bayt al-Maqdis, most of whose cadres swore allegiance to IS leader Abu Bakr al-Baghdadi last year, forming the Sinai Province.

For Hamas, such cooperation is intended to ease the pressure of tough Egyptian military measures to isolate Gaza from Sinai. Despite the deep ideological rift between Hamas and IS and the traditional animosity between Muslim Brothers and Salafis, Hamas sees IS Sinai as a partner in preventing Cairo from asserting its grip over the peninsula (for more on these ideological nuances, see "What Is Salafism?"). Both organizations share deep hostility toward Sisi -- so much that they are even willing to overlook rising tensions with pro-IS groups in Gaza that oppose Hamas's policy of maintaining calm with Israel. IS Sinai has not offered public support for such groups, including the Sheikh Omar Hadid Brigade, which occasionally fires rockets against Israel. And while IS leaders in Syria and Iraq have denounced Hamas openly, the Sinai affiliate refrains from echoing these statements.

Interestingly, Hamas's mentors are also keeping quiet about its dealings with IS Sinai. Neither Iran nor Qatar nor Turkey has publicly expressed any concern about this development. Tehran has continued arms deliveries to Hamas through the Red Sea and the Sinai even though it must be aware by now that some of these weapons are destined for IS Sinai; Doha has maintained its aid program to Gaza in full coordination with Israel; and Ankara still provides shelter to some Hamas military operatives.

CONCLUSION

Hamas cooperation with IS Sinai presents a double challenge: it undermines Egypt's counterterrorism efforts, and it opens the door to IS gaining more ground among the Palestinians. Indeed, further recruitment efforts could eventually turn IS into a powerful competitor against Hamas and Fatah, whose popularity keeps declining. IS entrenchment in the peninsula would also expose international shipping through the Suez Canal and the Gulf of Aqaba to potential attacks.

One way to forestall these scenarios is by encouraging Hamas's main sponsors -- Qatar and Turkey -- to dissuade the movement from continuing its undeclared alliance with IS Sinai. Confronted with insistent demands to sever ties with the group, Hamas may have no choice but to drop its opportunistic gamble on Menai and his jihadists.

Ehud Yaari is a Lafer International Fellow with The Washington Institute and a Middle East commentator for Israel's Channel Two television.