The Islamic State group has claimed an attack on a remote Egyptian army outpost in the Sinai Peninsula that killed at least 23 soldiers, the deadliest assault in the turbulent region in two years.

IS said in an online statement late Friday that it carried out the attack as the army was preparing to assault militant positions in the territory bordering Gaza and Israel.

The coordinated attack suggested the Sinai-based militants are among the region's most resilient, after IS in Iraq and Syria, where the so-called caliphate is rapidly losing ground. It also underscored the challenges facing Egypt's security forces as they try to contain the insurgency.

Local TV channels on Saturday carried live footage of the funerals of those killed, with their coffins wrapped in Egypt's red, white and black flag.

Egypt has for years battled militants in Sinai, where the jihadis have exploited the vast, arid and underdeveloped region, recruiting from its disgruntled Bedouin population.

Friday's assault began in the early morning, 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 Cruisers 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.

When the attack subsided, the militants apparently looted the checkpoint, snatching weapons and ammunition before fleeing, the officials said. A number of militants were killed in the shootout and some of their vehicles were abandoned at the scene.

The suicide blast apparently disabled the checkpoint's military communications system, forcing an officer to use his own cellphone to record an audio message seeking help. The message, sent to a colleague via WhatsApp, was later circulated on social media.

"This might be the last seconds in my life," a man's voice calmly says in the recording. "Quickly, oh men, anyone who knows how to reach the command center, notify them to use artillery as we are still alive."

He then praises God and ends by saying "we will either avenge them or die," referring to his fallen colleagues.

According to the IS statement, a second car bomber was used to strike an army convoy sent to reinforce the embattled soldiers. The IS claim was circulated by supporters online and picked up by the U.S.-based SITE Intelligence Group, which monitors jihadi websites.

Earlier, Egyptian army spokesman Tamer el-Rifai confirmed the attack on his official Facebook page, saying that 26 army personnel were killed or wounded. He didn't provide a breakdown, but added that 40 of the assailants were killed.

Local Sinai residents, speaking on condition of anonymity because they fear for their safety, said they saw Apache helicopters carrying out airstrikes across Rafah after the attack. On his page, al-Rifai posted photographs purporting to show slain militants.

Elsewhere in Egypt on Friday, a police officer was gunned down while heading to a mosque in the outskirts of Cairo. A shadowy militant group suspected of links to the banned Muslim Brotherhood claimed responsibility. The Hasm group has attacked Egyptian security forces in the past but has no known links to the IS affiliate in Sinai.

On Saturday, the Interior Ministry said security forces raided a training camp near the Suez Canal city of Ismailia, killing 14 militants.

IS has not been able to seize and hold territory in Sinai, but it maintains a strong presence in northern areas of the peninsula.

In recent months, it has focused its attacks on Egypt's Christian minority, killing more than a 100 in four major attacks between December and May. The attacks prompted President Abdel-Fattah el-Sissi, a former army chief, to declare a nationwide state of emergency.

The restive northern Sinai has been under a state of emergency since October 2014, after Islamic militants killed more than 30 soldiers in a single attack. There was a significant decline in attacks this year in Sinai, but one major assault killed eight policemen in el-Arish in January.

On July 1, 2015, IS carried out a series of coordinated attacks, including suicide bombings, against army and police positions in Sinai, killing at least 50. However, the army said only 17 soldiers and over 100 militants were killed.


Michael reported from Cairo.