Egyptian president Abdul Fattah al-Sisi says the country is facing a threat to its existence from jihadists after the military suffered the biggest loss of life in decades in attacks in Sinai.

At least 31 soldiers were killed in two attacks on Friday, the deadliest a bomb blast near the town of El-Arish.

A three-month state of emergency has been declared in parts of the Sinai Peninsula while Egypt's Rafah crossing into the Gaza Strip was closed.

Al-Sisi said a huge plot was being waged against Egypt "by external forces".

He said: "This is meant to break up Egypt and the Egyptians ... Egypt is fighting a war of existence."

No group has said it carried out the attacks, which came as the army continued an offensive against jihadists in northern Sinai.

The area has become increasingly lawless since president Hosni Mubarak was overthrown in 2011.

The attacks are a setback for the Egyptian government, which had managed over the past few months to make some progress in the struggle against an Islamist militant insurgency in the Sinai as it focuses on trying to repair the economy. In a statement issued after a meeting of the Egyptian National Defence Council to discuss the security situation, al-Sisi also expressed serious concerns over militants who are thriving in the chaos of post-Gaddafi Libya and are opposed to the Cairo government.

Egypt has offered to train anti-militant, pro-government Libyan forces while it tries to contain the Sinai insurgency. Security officials say Egyptian warplanes flown by Libyan pilots recently bombed militant targets in Libya.

In Friday's attack in Sinai, 30 people were killed in the first strike in the al-Kharouba area northwest of al-Arish, near the Gaza Strip. Military helicopters transferred the dead and wounded to Cairo. Among them were several senior officers from the Second Field Army based in Ismailia, security sources said.

The car bomb attack targeted two armoured vehicles at a checkpoint near an army installation. Security sources said the big explosion and high death toll were probably caused by the fact that the vehicles were loaded with ammunition and heavy weapons.

Hours later, gunmen opened fire on a checkpoint in al-Arish, killing three members of the security forces, officials said. The casualties were transported to Cairo by military helicopters, state news agency MENA reported.

There was no immediate claim of responsibility for either attack. Similar previous operations have been claimed by Egypt's most active militant group, Ansar Bayt al-Maqdis.

Though the vast Sinai peninsula has long been a security headache for Egypt and its neighbours, the removal of president Mohammed Mursi of the Muslim Brotherhood brought the region new violence that has morphed into an Islamist insurgency

Security forces have been squaring off against militants who have killed hundreds of soldiers and police since the army toppled Mursi in July 2013 after mass protests against his rule.

Most attacks have been in Sinai although militant groups have claimed responsibility over the past year for deadly bomb attacks on state installations in the Nile Delta and in Cairo.

The Brotherhood says it is peaceful and denies government claims it has links to the Sinai-based Islamist militants.