Istanbul, in western Turkey, is one of Europe’s great cities. As Constantinople, it was the capital of the Roman and Byzantine Empires, and after its capture and renaming by Mehmed II in 1453, it served as the capital of the Ottoman Empire for nearly another 500 years.

Throughout its history, the city on the western side of the Bosphorus Strait separating Europe from Asia has been an epicenter of the relationship between the geopolitical West and East. And Istanbul will most likely continue to play that role, given the current importance of mostly Christian Europe’s relationship with the wider Muslim world.

Turkey itself emerged from the ruins of the Ottoman Empire, and Turkish political life has often been tumultuous, marked by competing visions and aspirations, successes and setbacks. Still, during the last two centuries, reformers seeking to modernize Turkey have looked to Europe for inspiration.

This was certainly true of Turkey’s first president, Mustafa Kemal Atatürk, who pushed through authoritarian reforms in the 1920s and 1930s to secularize the country; and it has been true for Recep Tayyip Erdoğan, who, over the past 13 years, first as Turkey’s prime minister and now as its president, has emerged as a towering personality on the world stage.

Erdoğan and his Justice and Development Party (AKP) spent their first decade in power pushing through impressive economic and, yes, democratic reforms. Turkey, whose membership in the European Union Customs Union was already supporting its economic transformation, moved closer to eligibility for eventual EU membership—a process that reinforced the country’s motivation to make progress on democratic reforms. Hope that the country had finally overcome its checkered history of military dictatorships was gaining strength.

However, much changed in the last few years. Turkey’s accession talks with the EU have ground almost to a halt, owing partly to outright hostility against Turkey in some EU member states. The motives behind this animus vary, but the overall effect has been to alienate many Turks, who now feel rejected by a Europe that once inspired them. Not surprisingly, some Turks now look for inspiration and opportunities elsewhere.

Moreover, the situation inside Turkey has worsened in recent years, with Turkish society becoming dangerously polarized under the strain of the escalating conflicts in Syria and Iraq. Threats from militant Kurdish factions have resurfaced after a long ceasefire, and the Islamic State has launched a series of terrorist attacks in Istanbul and Ankara. It is a testament to Turkey’s resiliency that, under such conditions, it has still managed to host up to three million refugees.

Turkish politics since 2013 has also suffered from a ruthless and increasingly destructive silent civil war between the AKP and its former allies in the Gülenist movement, an Islamic community nominally led by the exiled preacher Fethullah Gülen, who now lives in the United States, outside Philadelphia.

The AKP and the Gülenists were once united in seeking to eradicate the Kemalist ‘deep state’—an alleged network of anti-democratic, nationalist agents embedded in the state’s security structures with a mission to uphold Atatürk’s secular vision. Part of this united effort involved, in 2007, show trials of senior Turkish generals that were based on fabricated evidence—an episode that many now agree led the country astray.

The years since then have been marked by warnings of Gülenist infiltration of the police force, the judiciary, and parts of the military. This silent civil war has significantly degraded the country’s democratic development, with the elected government resorting to more authoritarian measures to respond to the perceived threat of Gülenist subversion.

The silent civil war became audible with the failed coup in July, which most observers believe was orchestrated by Gülenist forces, though Gülen himself has denied any involvement. If the coup had succeeded, Turkey likely would have descended into open civil war with no end in sight, and with all hope for democracy extinguished.

One silver lining of the recent putsch is that, after years of division, it has united Turkey’s democratic political parties around the shared goal of defending democracy against future internal threats. The West’s lack of empathy for Turkey during this traumatic period has been astonishing; it can be in no Western country’s interest that Russian President Vladimir Putin was the first to meet with Erdoğan in the episode’s aftermath.

No one should be surprised that Turkey is now trying to purge Gülenists from positions of power. Any state faced with insurrection from within would do the same. To be sure, we should not ignore abuses in the immediate post-putsch crackdown; but we should put ourselves in the authorities’ shoes. It is hard to know at this stage if the government is casting the net too wide or not wide enough, but erring in either direction will only create new problems.

For what it’s worth, senior Turkish officials, in a meeting with Council of Europe Secretary-General Thorbjørn Jagland, have promised to uphold the rule of law in accordance with Council membership. In any case, there will be opportunities for the Council to address abuses after the immediate furor has subsided.

Turkey is at a historical crossroads, but it is still too early to tell where the country is headed. If the previous trends toward polarization and authoritarianism continue, the country could eventually reach a breaking point. But if national unity, based on shared commitment to democracy, ultimately prevails, Turkey’s political climate will improve, allowing for a resumption of the Kurdish peace process, further progressive political reforms, and new hope for future integration with Europe.

And make no mistake: the West’s attitude toward Turkey matters. Western diplomats should escalate engagement with Turkey to ensure an outcome that reflects democratic values and is favorable to Western and Turkish interests alike.

A democratic and European Turkey could be a bridge to deliver reform and modernity to the Muslim world; an alienated and authoritarian Turkey could bring conflict and strife back to Europe’s eastern borderlands. What happens on the Bosphorus affects us all.