The terrorist attack in Rafah presents the first major challenge to President Mohamed Mursi and his new government, Emad Gad explains why At sunset on Sunday officers and soldiers of the border patrol in Rafah were breaking their Ramadan fast when they were attacked by 35 masked gunmen. The attackers charged towards the guards in four-wheel drives, first shooting and killing two Egyptian soldiers in the lookout towers and then unleashing a barrage of automatic gunfire at the other officers and soldiers. The terrorists, who were also carrying RBG anti-tank weapons, took two armoured vehicles and drove them towards the border with Israel. Israeli forces destroyed one of the vehicles as it tried to navigate the sand dunes and the second after it had penetrated about 100 metres into Israeli territory. Sixteen Egyptian servicemen died in the attack and seven were wounded, three of whom are in a critical condition. Egyptians were stunned by the attack, the largest against Egyptian forces since the disengagement agreements that followed the 1973 War. Suspicion immediately focussed on jihadist groups already operating in the Sinai and the possible infiltration of extremists through the border tunnels between Egypt and Gaza. Israeli security agencies warned against the possibility of an attack three days before it occurred and had advised all Israeli tourists in the Sinai to leave the area "immediately". Such facts raise compelling questions. Why did the Egyptian authorities not only ignore the Israeli warnings but dismiss them out of hand. The governor of North Sinai went so far as to accuse Israel of spreading rumours in an attempt to undermine tourism in the peninsula. Such questions are all the more perplexing given that Egyptian security agencies knew that jihadist elements were operating in Sinai, and specifically in the area of Gabal Al-Hilal. They had already attacked a police station in Arish and staged displays of their numerical and military strength in what have become known as "black banner marches". It is also known that jihadist organisations with ideological affiliations to Al-Qaeda were operating in Gaza, that members of these organisations were in direct contact with their counterparts in the Sinai, and that they could easily make their way back and forth via the Rafah border tunnels. Yet shortly after assuming office President Mursi ordered that the Rafah crossing be opened permanently. He also met with the head of the Hamas political bureau, Khaled Meshaal, and with Hamas's Gaza leader Ismail Haniyeh, and issued a presidential decree allowing Palestinians to enter Egyptian territory without a visa, a decision that caused unease among Egyptian security officials. The Rafah crossing, in short, had been thrown open for unrestricted passage while the smuggling of goods, arms, equipment and possible terrorist operatives continued as usual through the tunnels. On top of this, the president pardoned a number of individuals convicted of terrorist attacks that had caused the death of Egyptian citizens. Some of those released had received death sentences, others life imprisonment. The move stirred consternation not only among Egyptian security officials but a broad segment of public opinion, especially in liberal and leftwing quarters. Fears were voiced that the move was an invitation to revive terrorist violence. Others pointed out that the president's amnesty policy, while it extended to members of extreme Islamist groups, excluded anyone who belonged to Egypt's revolutionary youth movements. In its statement of condolences to the families of the dead soldiers SCAF noted that the attack had been preceded by an outburst of mortar fire from Gaza, a signal for the operation to start, and that shelling continued in an attempt to offer the attackers cover for their escape. This would appear to confirm that groups in Gaza were complicit in the attack. Hamas, however, has denied any Gazan involvement. Its spokesmen have condemned the attack and said Hamas is ready to cooperate with the Egyptian authorities in any investigations. Spokesmen for the Islamic Jihad movement in Gaza issued a similar statement. Immediately following the incident Egypt announced that the Rafah border crossing would be closed for an indefinite period. Many among the Egyptian public believe militant Islamist groups in Gaza are responsible for the tragedy. Hamas, too, has come under suspicion, on the grounds that mortar fire could not have been unleashed against Egyptian territory without Hamas's knowledge. Egyptian media outlets and political analysts have not shied away from pointing out that Hamas is a branch of the Muslim Brotherhood and that Hamas's leaders are subordinate to the Muslim Brotherhood's supreme guide, or that many decisions made by President Mursi -- including the permanent opening of the Rafah crossing and the shipment of fuel to operate electricity plants in Gaza -- are tailored to support Hamas. The latter -- the provision of fuel for Gaza at a time when Egyptians are suffering repeated power cuts -- has played particularly badly with domestic opinion. However strongly suspicions are voiced it is unlikely that Hamas was directly involved in the attack. It would be unwilling to provoke such an awkward crisis for the newly elected Egyptian president, a fellow Muslim Brotherhood member. Nor is it in Hamas's interests for the Rafah crossing to be closed for an indefinite period, a decision that the Egyptian government had to take in order to appease public opinion. Hamas also has nothing to gain from the Mursi government being shackled, for the time being at least, in its attempts to develop closer relations with Hamas-controlled Gaza. Nor will it relish the fact that Egyptian security agencies are likely to intensify security and intelligence coordination with their Israeli counterparts. Hamas may not have been directly involved but there is no question that it played an indirect role. Hamas, after all, controls Gaza. It oversees the tunnels and collects fees for the passage of goods through them. Nor is there any point denying that the party that has gained the most from the attack is Israel. The Rafah crossing is closed again. The Egyptian drive to support Hamas and Gaza has been put on hold. More importantly, Israeli authorities have been able to use the attack to turn international attention towards the Sinai, which they paint as the Egyptian Tora Bora. Tel Aviv has been presented with a propaganda gift which it will try to use to build foreign pressure on Egypt. It is not inconceivable that Israeli policy-makers may eventually press for international military intervention in the Sinai with the aim of eliminating terrorist organisations linked to Al-Qaeda. Egypt would then be cast as a failed state, unable to control its own territory, something that could clearly jeopardise sovereignty, security and even, perhaps, territorial integrity. Mursi, his newly appointed prime minister and government, need to act quickly and wisely to avert dire repercussions from Sunday's terrorist attack in Rafah.