EL-ARISH, Egypt -- Militants attacked a crowded mosque during Friday prayers in the Sinai Peninsula, setting off explosives, spraying worshippers with gunfire and killing at least 235 people in the deadliest ever attack by Islamic extremists in Egypt.

The attack targeted a mosque frequented by Sufis, members of Islam's mystical movement, in the north Sinai town of Bir al-Abd. Islamic militants, including the local ISIS affiliate, consider Sufis heretics because of their less literal interpretations of the faith.

The ISIS affiliate has been waging a stepped-up campaign of violence in northern Sinai for years and has claimed deadly bombings on churches in the capital, Cairo, and other cities, killing dozens of Christians. It also is believed to have been behind the 2016 downing of a Russian passenger jet that killed 226.

Get Breaking News Delivered to Your Inbox

But this was the first major militant attack on a Muslim mosque and the startling bloodshed eclipsed any past attacks of its kind, even dating back to a previous Islamic militant insurgency in the 1990s.

Egyptians walk past bodies following a gun and bombing attack at the Rawda mosque, roughly 40 kilometers west of the North Sinai capital of El-Arish, on November 24, 2017. A bomb explosion ripped through the mosque before gunmen opened fire on the worshippers gathered for weekly Friday prayers, officials said. Stringer / AFP/Getty Images

The militants opened fire from four off-road vehicles on worshippers inside the mosque during the sermon, blocking off escape routes from the area by blowing up cars and leaving the burning wrecks blocking the roads, three police officers on the scene said.

Victims including some 130 wounded were rushed to local hospitals, they added, speaking on condition of anonymity because they weren't authorized to brief reporters.

No one claimed responsibility immediately following the attack, but ISIS has targeted Sufis several times in the area in the past, notably beheading a leading Sufi religious figure, the blind sheikh Suleiman Abu Heraz, last year and posting photos of the killing online.

President Donald Trump condemned the "cowardly" attack on Twitter, and took the opportunity to tout the need for a border wall and travel ban, even though his most recent ban doesn't affect Egypt. He also said he would be speaking with Egypt's president, Abdel-Fattah el-Sissi, later Friday.

Horrible and cowardly terrorist attack on innocent and defenseless worshipers in Egypt. The world cannot tolerate terrorism, we must defeat them militarily and discredit the extremist ideology that forms the basis of their existence! — Donald J. Trump (@realDonaldTrump) November 24, 2017

Will be calling the President of Egypt in a short while to discuss the tragic terrorist attack, with so much loss of life. We have to get TOUGHER AND SMARTER than ever before, and we will. Need the WALL, need the BAN! God bless the people of Egypt. — Donald J. Trump (@realDonaldTrump) November 24, 2017

Images circulating on social media showed dozens of bloodied bodies wrapped up in sheets laid across the mosque floor, while others revealed dozens of relatives queuing up outside the hospital as ambulances raced back and forth.

Resident Ashraf el-Hefny said many of the victims were workers at a nearby salt firm who had come for Friday services at the mosque, which had contained some 300 worshipers.

"Local people brought the wounded to hospital on their own cars and trucks," he said by telephone.

Egypt's state news agency reported the casualty toll, citing "official sources," revising it upward several times following the officials' initial reports.

MENA reported that Egypt's presidency declared a three-day mourning period, as President Abdel-Fattah el-Sissi convened a high-level meeting of security officials.

Egyptian president Abdel-Fattah el-Sisi has condemned the extremist attack on a mosque in the troubled Sinai Peninsula, calling it "criminal" and "cowardly" and expressing condolences to the victims and their families.

In a statement after the meeting, el-Sissi said the attack "will not go unpunished" and that Egypt will persevere with its war on terrorism. The suffering of the victims was not in vain, he added, and will only "add to our insistence" to combat extremists. Addressing the nation later on television, he repeated his view that Egypt was fighting a battle for the rest of the world.

Cairo's international airport boosted security following the attack, with more troopers and forces seen patrolling passenger halls, conducting searches and manning checkpoints at airport approaches.

State condolences poured in for Egypt, including messages from Israel, the United Arab Emirates, the U.S., Russia, France and Britain condemning the violence.

Security forces have been battling militants in northern Sinai for years, but attacks to date have focused on military and police assets, although assassinations of individuals ISIS considers government spies or religious heretics are not uncommon.

Hundreds of soldiers and militants have been killed in the conflict, although exact numbers are unclear as journalists and independent investigators are banned from the area.

In September, ISIS militants ambushed a police convoy in Sinai, killing 18 police and wounding seven others in one of the deadliest attacks this year in the restive region bordering Israel and the Gaza Strip.

The ongoing violence in Sinai shows the resilience of the militants there in the face of a years-long campaign to eradicate them by the military and police, which between them command far superior firepower, air support, heavy armor and larger numbers.

Egypt is also facing a growing number of attacks by militants in its Western Desert, including an attack last month that killed 16 police, according to an official tally issued by the Interior Ministry. Security officials have told journalists that dozens more, including high-ranking counterterrorism officers, perished in the Oct. 20 attack some 135 84 miles southwest of the capital, Cairo.