The assault began when a suicide bomber rammed his vehicle into a checkpoint at a military compound in the village of el-Barth, southwest of the border town of Rafah.

Dozens of masked militants then descended on the site in 24 Land Cruiser SUVs and opened fire on the soldiers with machine guns, according to security officials.

The shooting lasted nearly half an hour, the officials added, speaking on condition of anonymity because of regulations. 

The troops at the compound were estimated to have numbered about 60.

After nightfall, the Islamic State group issued a claim of responsibility, saying in an online statement that it had carried out the attack as the Egyptian army was preparing an assault on ISIS positions in Sinai.

The coordinated attack suggested the Sinai-based militants are among the region's most resilient, after ISIS in Iraq and Syria, where the so-called caliphate is now witnessing its demise.

And it underscored the struggles Egyptian forces face in trying to rein in the insurgency.

Egypt has for years battled militants in Sinai, where the jihadis have exploited the vast arid and underdeveloped region and its disgruntled Bedouin population as an ideal incubator for Islamic militancy even before the ISIS affiliate has emerged at the forefront of the insurgency.