EL-ARISH, Egypt — Pope Francis sent a message saying he is “profoundly grieved to learn of the great loss of life caused by the terrorist attacks on the Rawda mosque in North Sinai.”

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 affiliate of the Islamic State group, consider Sufis heretics because of their less literal interpretations of the faith.

The message – sent on his behalf by the Vatican Secretary of State, Italian Cardinal Pietro Parolin – expressed the pope’s solidarity with the Egyptian people, and commended the victims of the attack to the mercy of God.

“In renewing his firm condemnation of this wanton act of brutality directed at innocent civilians gathered in prayer, His Holiness joins all people of good will in imploring that hearts hardened by hatred will learn to renounce the way of violence that leads to such great suffering, and embrace the way of peace,” the message said.

The startling bloodshed, which also wounded at least 109, was the latest sign of how more than three years of fighting in Sinai has been unable to crush an insurgency waged by the IS affiliate.

Seeking to spread the violence, the militants the past year have carried out deadly bombings on churches in the capital, Cairo, and other cities, killing dozens of Christians.

Over 100 Christian families fled the Sinai earlier this year, after seven Christians were killed in religiously-motivated attacks.

Before Egypt’s 2011 Arab Spring uprising, some 5,000 Christians lived in northern Sinai, but the number has since dwindled to fewer than 1,000, priests and residents say. Egypt does not keep official statistics on the number of Christians in cities or across the country.

The IS affiliate also is believed to have been behind the 2016 downing of a Russian passenger jet that killed 226 people.

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

The militants opened fire from four off-road vehicles on the hundreds of worshippers attending the sermon in the mosque. They also blocked 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, speaking on condition of anonymity because they were not authorized to talk to the press.

Dozens of bloodied bodies wrapped up in sheets were laid across the mosque floor, according to images circulating on social media. Relatives queued up outside the hospital as ambulances raced back and forth. The state news agency MENA put the death toll at 235.

(Credit: Maps4News via AP.)

Resident Ashraf el-Hefny said many of the victims were workers at a nearby salt factory who had come for Friday services at the mosque.

“Local people brought the wounded to hospital in their own cars and trucks,” he said by telephone.

No one immediately claimed responsibility for the attack. But IS 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.

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

In a statement afterward, 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 is fighting a battle against militancy on behalf of the rest of the world.

Cairo’s international airport boosted security following the attack, with more forces 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.

President Donald Trump denounced what he called a “horrible and cowardly terrorist attack on innocent and defenseless worshippers in Egypt.”

“The world cannot tolerate terrorism” he said on Twitter, “we must defeat them militarily and discredit the extremist ideology that forms the basis of their existence!”

Bishop Joseph Arshad, the president of Pakistan’s bishops’ conference, told Crux he offered his “deepest condolences to the people and government of Egypt for the loss of innocent lives in the attack on the mosque. We pray for the souls of those who lost their lives in this senseless violence and we pray for the speedy recovery of the wounded.”

The bishop said an attack on any religious place hurts all religions.

“A place of worship where people gather together in prayer and solidarity. It is a loss for humanity.”

Islamic militants stepped up their campaign of violence in northern Sinai after the military ousted the Muslim Brotherhood from power in 2013.

The result has been a long, grinding conflict centered on el-Arish and nearby villages and desert mountains. The militants have been unable to control territory, but the military and security forces have also been unable to bring security, as the extremists continuously carry out attacks.

Largely the attacks have focused on military and police, killing hundreds, although exact numbers are unclear as journalists and independent investigators are banned from the area. But the militants have also assassinated individuals the group considers spies for the government or religious heretics.

Egypt has also faced 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 84 miles southwest of the capital, Cairo.

In April, Francis visited Egypt in part to show his support for Christians in this Muslim majority Arab nation who have been increasingly targeted by Islamic militants. During the trip, Francis paid tribute to the victims of a December 2016 bombing at Cairo’s St. Peter’s church, located in close proximity to Cairo’s St. Mark’s cathedral, the seat of the Coptic Orthodox Church.

Following the pope’s visit, IS vowed to escalate attacks against Christians, urging Muslims to steer clear of Christian gatherings and Western embassies, saying they are targets for the group’s followers.

Egypt’s Copts, the Middle East’s largest Christian community, have repeatedly complained of discrimination, as well as outright attacks, at the hands of the country’s majority Muslim population. They account for about 10 percent of Egypt’s 93 million people.

Ashraf Sweilam reported from el-Arish. Brian Rohan reported from Cairo. Crux staff contributed to this report. Associated Press writer Samy Magdy in Cairo contributed to this report. Nirmala Carvalho in Mumbai contributed to this report.