At least 26 Egyptian soldiers including a colonel were killed in a suicide bomb attack on an army checkpoint in northern Sinai, according to security sources.

Forty fighters were also killed in a subsequent gun battle with soldiers at the checkpoint, an army spokesperson said on Friday.

The attack started when a suicide car bomber rammed his vehicle into the checkpoint at a military compound in the southern Rafah village of el-Barth, followed by heavy gunfire from dozens of masked fighters on foot, officials said.

The dead included a high-ranking special forces officer, Colonel Ahmed el-Mansi, and at least 26 soldiers were wounded in the attack.

The officials spoke to AP news agency on condition of anonymity because they were not authorised to speak to the media.

The Islamic State of Iraq and the Levant (ISIL, or ISIS) claimed responsibility, saying in an online statement that it had carried out the attack as the Egyptian army was preparing an assault on the group's positions in Sinai.

Wilayat Sinai, a group affiliated with ISIL, frequently targets military and police personnel.

Over the past few months, ISIL has focused its attacks on Egypt's Christian minority and carried out at least four deadly assaults that killed dozens, prompting President Abdel-Fattah el-Sisi to declare a state of emergency in the country.

The Sinai branch of ISIL appears to be the most resilient outside Syria and Iraq, where the group is losing ground.