The deadly attack by the Islamic State at Istanbul’s main airport earlier this week signals a watershed event: The Turkish national identity—a Muslim society governed by a Western-style democracy—now faces an existential threat.

Trouble has been brewing in Turkey for some time. In June 2015 I met up with Turkish columnist and educator Sahin Alpay, who was deeply anxious about his nation’s future. We met at the posh Marmara Hotel in Istanbul’s Taksim Square, to discuss the upcoming national elections. Alpay accused President Recep Tayyip Erdogan of “exploiting Islamic values,” and described the government as “increasingly arbitrary and authoritarian.” Things would only get much worse, he said, if Erdogan’s party won big.

As we sipped coffee, I could hear Nat King Cole’s Unforgettable wafting through the sound system of the hotel lounge. Later that day I would hear the Muslim call to prayer, reverberating throughout the city’s mosques. Here is a nation sitting on the edge of knife: a Muslim society with strong political and cultural ties to Europe and the West. The collapse of the “Arab Spring” makes Turkey, a member of NATO, one of the few examples of how Islam might make its peace with Western political ideals.

Yet the Turkish model of Islamic democracy is under assault—both from inside and outside the country. Tuesday’s attack, carried out by extremists from Muslim regions in the former Soviet Union, left 44 people dead and 240 wounded. The operation that targeted Istanbul’s Ataturk Airport, the third busiest in Europe, was clearly aimed at crippling Turkey’s tourist economy and sending a message to Turkey and its democratic allies.

In the eyes of ISIS militants, Turkey represents not simply a gateway to the soul of the West, but a gutter: It embodies the corrupting influence of Western secular values. It is an “apostate regime,” a disgrace to the teachings of the Prophet and the values of Islam.

Turkish columnist Mustafa Akyol observes that ISIS ratcheted up its criticism of Turkey prior to the Istanbul attack, especially after Turkey became somewhat more engaged in the fight against ISIS in Syria. As an ISIS Turkish-language magazine recently proclaimed: “O Istanbul, you have allowed disbelief in your avenues. You have filled your streets with sins, but surely you will be conquered.”

It may be the wake-up call that President Erdogan needs. “Make no mistake,” he said in a statement this week. “For terrorist organizations, there is no difference between Istanbul and London, Ankara and Berlin, Izmir and Chicago, or Antalya and Rome.” In this, Erdogan seems to have a better grasp of the fundamental nature of the Islamist threat than Barack Obama.

If the Turkish government hoped to make a Faustian bargain with the forces of radical Islam, it has run its course. According to The New York Times, France’s domestic intelligence agency has concluded that nearly all of the ISIS recruits arrested in Europe in 2015 had travelled through Turkey. For a time, Turkey might have escaped ISIS attacks by turning a blind eye to its recruits passing through Turkey’s borders to fight in Syria.

Not anymore. “Erdogan’s policy of supporting Islamist groups to muck around neighboring countries isn’t going exactly to script,” writes Leela Jacinto in Foreign Policy. “Those ingrate jihadis are turning around like snakes to bite the hand that once fed them—just like they did in Pakistan.”

Whatever we make of that assessment, the Syrian conflict is changing Turkish society in potentially fatal ways. The suicide bombing in Ankara last year that killed 97 people and injured hundreds more—the worst terrorist attack in modern Turkish history—exposed a bitterly divided society. Fourteen years of political dominance by Erdogan’s Islamist AKP party has taken a toll on civil liberties: an erosion in the rule of law, a clampdown on critical media, the demonization of political enemies, and an increasingly Islamist vision imposed upon Turkey’s secular democracy. Turkey has absorbed over two million refugees from Syria, the mark of a generous society. But the turmoil on its border, the attacks from separatist Kurds inside the country, and the ongoing struggle to define its relationship to political Islam are creating immense pressures.

The question now is this: what path will Turkey choose? Will it try to play both sides in the struggle against the West, swallowing the poison pill of Islamic jihad that has proven so toxic to nations like Pakistan and Saudi Arabia? Or will it make a clean break with militant Islam, embrace the Western ideals of natural rights, government by consent, pluralism, and religious freedom?

Turkey’s future is in its hands. The future of Islam may well turn on what it does next.

Joseph Loconte is an associate professor of history at the King’s College in New York City and a senior editor at Providence. He is the author of God, Locke, and Liberty: The Struggle for Religious Freedom in the West

Photo Credit: Ataturk Airport in Istanbul. By A. Currell, via Flickr.