Egypt’s President Abdul Fattah al-Sisi has vowed to respond with “the utmost force” after 235 people were killed at a North Sinai mosque during Friday prayers.
The al-Rawda mosque in the town of Bir al-Abed was bombed and fleeing worshippers were then gunned down.
The military has conducted air strikes on targets in nearby mountains, Reuters news agency reports.
No group has yet claimed the attack, the deadliest in recent memory.
Egyptian security forces have for years been fighting an Islamist insurgency in the Sinai Peninsula, and militants affiliated with so-called Islamic State (IS) have been behind scores of deadly attacks in the desert region.
They usually target security forces and Christian churches, and the bloody attack on a mosque associated with Sufi Muslims has shocked Egypt.
“What is happening is an attempt to stop us from our efforts in the fight against terrorism,” Mr Sisi said in a televised address hours after the attack.
“The armed forces and the police will avenge our martyrs and restore security and stability with the utmost force.”
Three days of national mourning have been declared.
Mr Sisi, the former head of Egypt’s armed forces, has emphasised national security and stability during his time as president.
Dozens of gunmen surrounded the mosque in vehicles and bombed it before opening fire on those trying to escape.
The assailants are reported to have set parked vehicles on fire in the vicinity to block off access to the mosque, and they fired upon ambulances trying to help victims.
At least 100 people were wounded, reports say, overwhelming hospitals.
It is the deadliest militant attack in modern Egyptian history. Bir al-Abed is about 130 miles (211km) from Cairo.
Can Sisi curb a stubborn insurgency?
By Orla Guerin, Cairo correspondent
This is a major challenge to the Egyptian state.
If this was IS, it is always worth considering the broader regional dimension. In the last few months, IS has had massive territorial losses in Iraq and across the border in Syria.
If IS was behind this, this could be an attempt to remind supporters around the world that they are still here, still relevant and can still inflict terrible damage on their enemies.
What we don’t know right now is if the Egyptian security establishment, if President Sisi, has anything else in the arsenal to try.
He has already tried the hardline military approach – there has been a massive military operation going on in the Sinai peninsula for years. It has not delivered results that time and time again the Egyptian establishment has promised.
But it is unclear if they have something new they can try to attempt to curb this very stubborn Islamic insurgency which today has inflicted such terrible damage.
Who was targeted?
Locals are quoted as saying that followers of Sufism, a mystical branch of Sunni Islam, regularly gathered at the mosque.
Although Sufis are widely accepted across much of the Muslim world, some jihadist groups, including IS, see them as heretics.
The head of IS’s religious police in Sinai said last December that Sufis who did not “repent” would be killed, after the group beheaded two elderly men reported to be Sufi clerics.
The victim of the mosque attack also included military conscripts.
The number of victims is unprecedented for an attack of this type, says the BBC’s Sally Nabil in Cairo. She adds that this is the first time that worshippers inside a mosque have been targeted by militants in North Sinai.
Who might be behind the attack?
Militant Islamists stepped up attacks in Sinai after Egypt’s military overthrew Islamist President Mohammed Morsi following mass anti-government protests in July 2013.
Hundreds of police, soldiers and civilians have been killed since then, mostly in attacks carried out by the Sinai Province group, which is affiliated to IS.
Sinai Province has also carried out deadly attacks against Egypt’s Coptic Christian minority elsewhere in the country, and said it was behind the bombing of a Russian plane carrying tourists in Sinai in 2015, killing 224 people on board.
It has been operating mainly in North Sinai, which has been under a state of emergency since October 2014, when 33 security personnel were killed in an attack claimed by the group.
Sinai Province is thought to want to take control of the Sinai peninsula in order to turn it into an Islamist province run by IS.
Journalists, including from state-sponsored outlets, have not been allowed to report from North Sinai in the last few years.
Correspondents say that the frequency of attacks raises doubts about the effectiveness of military operations against militants.
What has the reaction been internationally?
Arab League chief Ahmed Aboul Gheit condemned the attack as a “terrifying crime which again shows that Islam is innocent of those who follow extremist terrorist ideology”.
Governments in the UK, US, France, Russia, Israel, Iran, Saudi Arabia and elsewhere have deplored the massacre.