Egypt mourned on Saturday as the death toll from a gun and bomb assault at a mosque rose to 305, including children, in the deadliest attack the country has witnessed.
The state prosecution said up to 30 militants in camouflage flying the Islamic State (IS) group's black banner had surrounded the mosque in North Sinai and proceeded to massacre the worshippers during weekly Friday prayers.
Twenty-seven children were among the dead, it said.
IS, which is conducting a deadly insurgency in the Sinai, has not claimed responsibility for the attack, but it is the main suspect as the mosque is associated with followers of the mystical Sufi branch of Sunni Islam whom it has branded heretics.
Funerals for the victims were held overnight and many were buried unwashed in their bloodied clothes, according to the Islamic burial practices for martyrs, security and medical officials said.
President Abdel Fattah al-Sisi declared three days of mourning and vowed to "respond with brutal force" to the attack, among the deadliest in the world since the September 11, 2001 attacks on the United States.
"The army and police will avenge our martyrs and return security and stability with force in the coming short period," he said in a televised speech.
Hours later Egyptian air force jets pursued the "terrorists and discovered several vehicles used in the terrorist attack, killing those inside near the vicinity of the attack," an army spokesman said in a statement.
The state prosecutor's office said in a statement that 305 people were killed and 128 wounded in the assault on the mosque roughly 40 kilometres (25 miles) west of the North Sinai capital of El-Arish.
It said the attackers, with long beards and hair often seen on jihadists, had arrived in five all-terrain vehicles to surround the mosque.
Witnesses said they heard gun shots and explosions before the assailants entered the mosque, according to the prosecution.
One of the wounded, Magdy Rizk, told AFP assailants wore masks and military uniforms, and that extremists had previously threatened people in the area.
Relatives visited victims in hospital in the city of Ismailia near the Suez Canal where the wounded were taken for treatment, an AFP photographer reported.
World leaders voiced outrage. US President Donald Trump denounced on Twitter the "horrible and cowardly terrorist attack on innocent and defenceless worshippers".
Sheikh Ahmed el-Tayeb, the grand imam of Cairo's Al-Azhar, Egypt's highest institution of Sunni Islam, condemned "in the strongest terms this barbaric terrorist attack".
- IS targeting of Sufis -
The Egypt branch of IS has killed hundreds of policemen and soldiers, and also civilians accused of working with the authorities, in attacks in the north of the Sinai peninsula.
They have also targeted Sufis as well as Christians.
A tribal leader and head of a Bedouin militia that fights IS told AFP that the mosque is known as a place where Sufis gather.
IS views Sufis as heretics for seeking the intercession of saints.
The group has also killed more than 100 Christians in church bombings and shootings in Sinai and other parts of Egypt, forcing many to flee the peninsula.
The military has struggled to quell the jihadists who pledged allegiance to IS in November 2014.
The jihadists have since increasingly turned to civilian targets, attacking not only Christians and Sufis but also Bedouin Sinai inhabitants accused of working with the army.
The group also claimed the bombing of a Russian plane that killed all 224 people on board after takeoff from the Egyptian Red Sea resort of Sharm el-Sheikh on October 31, 2015.
Aside from IS, Egypt also faces a threat from Al-Qaeda-aligned jihadists who operate out of neighbouring Libya.
A group calling itself Ansar al-Islam -- Supporters of Islam in Arabic -- claimed an October ambush in Egypt's Western Desert that killed at least 16 policemen.
The military later conducted air strikes on the attackers, killing their leader.