On Friday, at least 305 Egyptians were killed by terrorists who detonated a bomb in a crowded mosque, then sprayed frantic worshipers with gunfire as they fled. It was deadliest in the country's modern history.

It “was horrific,” local Ibrahim Sheteewi told the New York Times. “The bodies were scattered on the ground outside the mosque.”

The assault shocked Egyptians for another reason: Attacks on mosques are unusual in Egypt. “I can’t believe they attacked a mosque,” a Muslim cleric in Bir al-Abed told the New York Times.

But to understand why this mosque was targeted, it's important to understand how Sunni extremists see Sufism.

Sufism is a strand of Islam that eschews materialism and emphasizes the inward search for God. Sufi adherents are responsible for some of Islam's most famous and beloved literature, including the poems of Rumi. Followers promote values such as tolerance and pluralism.

Sufi believers can be Sunni or Shiite, though the majority are Sunni. They see Sufism less as a sect than as a way of being, a set of beliefs and practices that lead followers closer to God. “It is nothing more than the spiritual dimension,” Imam Feisal Abdul Rauf told the New York Times. “It is Islam, but we focus on meditation, on chanting sessions, which enable the Muslim to have his or her heart open. The myths people have about Sufis are analogous to the myths people have about Muslims.”

A University of Michigan scholar on Islam, Alexander D. Knysh, summed up the tenets of Sufism as: “love, peace, tolerance.”

It's an interpretation of Islam that's radically different from what Sunni extremists believe. Many extremists see Sufism as heretical, followed only by apostates.

Though no group has claimed Friday's assault, the attackers reportedly carried the banner of the Islamic State.

More and more, extremists are willing to target Sufi mosques. “Opponents of Sufism see the shrines and these living saints as idols,” Knysh told the New York Times. “Their existence and their worship violates the main principle of Islam, which is the uniqueness of God and the uniqueness of the object of worship.”

When al-Qaeda captured northern Mali in 2012, militants destroyed the ancient mausoleums of Sufi saints in Timbuktu. In fall 2016, the Islamic State's local affiliate claimed to have executed a 100-year-old Sufi cleric in Egypt. Last February, militants allied with the Islamic State attacked worshipers who'd come to pray at the tomb of a Sufi philosopher in southern Pakistan. More than 80 people were killed.

Not all Muslim extremists believe that Sufis should be targeted. In Mali, the assailants had acted without the permission of their leaders, and they were reprimanded. In general, al-Qaeda has shied away from conducting attacks on Sufis, though the group has been willing to destroy Sufi sites.

The Islamic State, though, sees things differently. Its followers have targeted Sufi people, lumping them in with other nonbelievers. In an interview with an Islamic State magazine in January, one of the organization's top commanders in Sinai outlined his hatred for Sufism. He labeled Rawda, the district where Friday's attack occurred, as one of three areas dominated by Sufis that his group hoped to “eradicate.”