Earlier, security sources and eyewitness said the Egyptian air force conducted airstrikes in northern Sinai, near the site of the attack in Bir al-Abed, west of El Arish. The strikes were concentrated in several mountainous areas surrounding Bir al-Abed, where militants were believed to be hiding out, the security sources said.
Between 25 and 30 suspected ISIS militants attacked the Al-Rawdah mosque in Bir al-Abed, detonating a bomb and gunning down worshippers in the deadliest such attack of Egypt's modern history, state media and witnesses said. Of the 305 fatalities, 27 were children, and a further 128 were injured, Egyptian media reported.
Following the attack, Egyptian President Abdel-Fattah al-Sissi convened an emergency meeting of defense officials.
"The armed forces and the police will avenge our martyrs and restore security and stability with the utmost force," Sissi later said in a televised address. "What is happening is an attempt to stop us from our efforts in the fight against terrorism, to destroy our efforts to stop the terrible criminal plan that aims to destroy what is left of our region."
Egypt said it would delay the opening of the Rafah border crossing to Gaza after the attack due to security concerns. The crossing had been due to open for three days beginning on Saturday.
No group immediately claimed responsibility for the attack, but since 2013 Egyptian security forces have battled a stubborn Islamic State affiliate in the mainly desert region, and militants have killed hundreds of police and soldiers.
State media showed images of bloodied victims and bodies covered in blankets inside the mosque.
Worshippers were finishing Friday prayers when a bomb exploded, witnesses said. Around 40 gunmen set up positions outside the mosque with jeeps and opened fire from different directions as people tried to escape.
"Four groups of armed men attacked the worshippers inside the mosque after Friday noon prayers. Two groups were firing at ambulances to deter them, said Mohamed, a witness.
The public prosecutors' office said in a statement 235 people had been killed and 109 more wounded.
The Arabiya news channel and some local sources said some of the worshippers were Sufis, whom groups such as Islamic State consider targets because they revere saints and shrines, which for Islamists is tantamount to idolatry.
The jihadists have also attacked local tribes and their militias for working with the army and police, branding them traitors.
The Sinai branch is one of Islamic State's surviving branches following the collapse of its self-declared caliphate in Syria and Iraq after military defeats by U.S.-backed forces.
Security has long been one of the key sources of public support for President Sissi, a former general who is expected to run for re-election early next year for another four-year term.
U.S. President Donald Trump, in a post on Twitter on Friday, called the assault a "horrible and cowardly terrorist attack."
"The world cannot tolerate terrorism, we must defeat them militarily and discredit the extremist ideology that forms the basis of their existence," he addded.
Trump later said he would call Sissi to discuss the attack. A White House statement called on the international community to strengthen its efforts to defeat terrorist groups.
French Foreign Minister Jean-Yves Le Drain also condemned the attack and said Paris stood with its ally.
North Sinai, which stretches from the Suez Canal eastwards to the Gaza Strip and Israel, has long been a security headache for Egyptian security forces because of smuggling.
Sissi has support from some Bedouin tribal leaders, who have helped the army locate weapon-smuggling routes used by jihadi groups, security officials said.
Local militant group Ansar Bayt al-Maqdis, once allied to Al-Qaida, split from it and declared allegiance to Islamic State in 2014.
Bloodshed in the Sinai worsened after 2013 when Sissi led the overthrow of President Mohammed Morsi of the Muslim Brotherhood.
Islamic State earlier this year posted a video of the beheading of two Sufis in northern Sinai, accusing them of practicing "sorcery."
In July this year, at least 23 soldiers were killed when suicide car bombs hit two military checkpoints in the Sinai, in an attack claimed by Islamic State.
Militants have tried to expand their operations into Egypt's heavily populated mainland, hitting Coptic Christian churches and pilgrims. In May, gunmen attacked a Coptic group travelling to a monastery in southern Egypt, killing 29.
On Saturday an Egyptian court sentenced seven Islamists to death by hanging on charges of setting up a local affiliate of the Islamic State extremist group and plotting terrorist attacks in the country.
The ruling was issued by the Cairo Criminal Court, which also sentenced 13 others in the same case to terms ranging from 15 to 25 years in prison. All the verdicts can be appealed.
Some of the defendants were convicted of involvement in Islamic State's execution of 21 Egyptian Christian workers in Libya in 2015.
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now