In 1818, Amir Abdullah bin Saud was taken to Istanbul for execution. This was no ordinary prisoner. He was leader of a rebellion that had occupied the two holy cities of Islam for a decade and had dared to declare the Ottoman sultan, Caliph of the Faithful, an unbeliever. Among the various public humiliations before ibn Saud’s execution—since his strict Wahhabi interpretation of Islam forbade music—the Ottomans made him listen to the lute. But the cruelest punishments were reserved for the rebels’ religious leaders, some of whom were stuck into the muzzles of cannons and mortars and blown to pieces .

The rebellion clearly struck a nerve with the Ottomans. The rebels belonged to the Salafi tradition of Sunni Islam, meaning that they believed in a literal reading of the earliest Islamic texts. The mainstream Anatolian Sunnis of Turkey on the other hand, belong to the Hanafi- Maturidi tradition, which goes into textual interpretation to attain the true meaning of the Prophet’s teachings. It sprang out of an age of enlightenment, when Islamic civilization reached its zenith in mathematics, medicine, astronomy and the arts. The Ottomans saw themselves as the heirs of Islam’s natural evolution towards a higher civilization. They did not care to be called infidels.

Salafism had a marginal place in politics for much of the time since its 14th century beginnings when it was influenced significantly by the works and students of the prominent scholar Ibn Taymiyyah. It only started to gain a foothold when Ottoman rule slackened in the 19th century. At this time, a Salafist scholar named ibn Wahhab made a pact with Abdul Aziz, a tribal chief with ambitions to exert influence over Arabia. The two made Salafist ideology into their weapon in the form of the Ikhwan, an elite fighting force known for its religious zeal and brutality (no affiliation with the Egyptian group of the same name, Ikhwan al-Muslimun, the Muslim Brotherhood). The Ikhwan began to raid neighboring villages and eventually Iraq, on the pretext that anyone not of the Salafist creed was non-Muslim, and hence their “life and property was halal [religiously sanctioned]. ” The Ikhwan massacred women and children, and destroyed shrines, graves and works of art, all of which are offensive to the Salafist tradition. In 1803, Abdul Aziz entered the Holy City of Mecca. In the subsequent decade, his tribe would rule over an area roughly the size of present day Saudi Arabia.

The Ottoman government tasked the Egyptian army—then subservient to Istanbul—to squash the rebellion. The Egyptians took some time to get into gear, but in 1812 , they defeated the Ikhwan and recaptured Mecca and Medina. That’s when Abdullah bin Saud was sent to Istanbul to be executed.

But the Ikhwan did not disappear. In some sense they are the rational consequence of Salafi ideology, supported by a historical pattern. They represent a violent urge that is repressed and resurfaces throughout the decades. The Ikhwan came back onto the scene during World War I, when the British were supporting the Arab revolts against the Ottoman Empire. They helped the al-Saud family establish the Kingdom of Saudi Arabia, and wanted to push into Iraq, just as their ancestors had done, to “cleanse” the Shia. Even the Saudi king was disturbed by their zeal, and soon realized that they were incompatible with his alliance with the British. In a brief civil war, his forces ended up mowing down the Ikhwan with European machine guns. In 1979, a group of armed extremists stormed the Grand Mosque in Mecca because they believed that the Saudi monarchy had deviated from the path of its founders. After a two week siege, hundreds of dead, more injured, and three French commandos briefly converted into Islam in order to enter the holy city, the remaining militants surrendered. They said they were Ikhwan.

More than any other group however, ISIL is truly the sword of Salafism. Among the genocidal, slave-trading Salafis of today, only it occupies territory and is building a state on it, just like the Ikhwan have always tried to do.

ISIL also has an advantage that the Ikhwan did not have—a more modern, fluid identity that allows it to recruit people from across the world, including Turkey. While an Ottoman Turk in Anatolia would not have entertained the thought of joining the Ikhwan, ISIL is recruiting Turks by the droves. That is because ISIL’s anti-imperialist narrative is almost universal among Muslims today, including Turks. Poll after poll shows that Turks harbor hostile feelings towards American policy, mostly due to its intervention in Muslim countries, as well as its support for Israel.

But part of it is also due to modern Turkey’s religious structure. The Ottomans’ perception of themselves as the vanguard of the liberal Central Asian Islamic tradition has dissipated. The Republic of Turkey, founded in 1923, did away with the caliphate and made mainstream Sunni orthodoxy less institutional in Turkey. Fewer people today are bound to tariqas or devotional schools headed by spiritual guides. Sunni Islam in Anatolia has become a more individual pursuit, and even families frequently harbor multiple strands of practice within them. That is not a bad thing in itself, but it can lead to a sort of contest of religiosity, one that ultra-orthodox Salafis will always win.

There are varying accounts of how Turkey’s majority-Sunni AK Party (AKP) government has been handling the situation. One narrative states that the AKP government, in its zeal to overthrow Syrian leader Bashar Assad, supported, and may still be supporting ISIL . Assad, the narrative goes, is an Alawite, and Turkish leaders supported the Sunni ISIL against him, thinking that the group could be controlled. The government and its supporters vehemently deny this, saying that aid only went to Syrian rebel groups other than ISIL. The government has been cracking down in recent weeks, especially after last Monday’s attack on the Turkish border town of Suruc , but its efforts might be too little, too late.

If the AKP government really did support ISIL, it was either spectacularly ignorant of the group’s feelings towards it, or uncharacteristically adventurous. ISIL has long been clear that it considers Turkey to be a “kuffar,” or unbelieving state. The first issue of its online Turkish-language magazine calls for the “renewed conquest of Constantinople,” and gives readers practical advice, like saying that they should not eat meat in Turkey because it would most likely have been prepared by unbelievers. There is therefore no doubt that just as the Ikwan undermined the Ottoman Sultanate, ISIL undermines the AKP’s political legitimacy.

But the AKP leadership does not have the luxury of decapitating ISIL as the Ottomans did. Turkey is deeply vulnerable to ISIL. The active ISIL presence within its borders means that should it declare open war against the group, it would risk great danger to civilian populations in its major cities. Turkey’s 30-year war against the PKK, a Kurdish guerilla group, hard as it was on both sides, was confined within certain boundaries. A war against ISIL would be a far more intimate affair.

The AK Party government treads a fine line between the security of its citizens and maintaining ideological authority. Unfortunately, even the most able of governments could not hope to stop as broad a historical trend as the tide of Salafism sweeping across the region. Like the frog in warm water, the Turkish state stays put as its environment heats up.

Selim Koru is a research fellow at the Economic Policy Research Foundation of Turkey (TEPAV), an Ankara-based think tank, where he focuses on Turkey¹s policies in the Middle East and Asia. He holds a BA in History from the University of Wisconsin-Madison and an MA in International Relations and Economics from the Johns Hopkins School of Advanced International Studies (SAIS). Before TEPAV, Selim worked and interned with various media institutions such as the Turkish daily Sabah, Al Jazeera’s Arabic and English offices in the United States, and The Hill newspaper in Washington DC.