And that same border with Syria offers a gateway for ISIS attacks inside Turkey. In July, after the Islamic State claimed credit for a suicide bombing in the Turkish town of Suruc that killed more than 30 people, Erdogan agreed to open Turkish bases to U.S. planes and drones, and pledged to join the U.S. campaign to bomb ISIS targets in Syria. In doing so, Erdogan has ensured that ISIS sees Turkey as an enemy, and the group will inevitably, and unfortunately, attack Turkey again. The only question is when, and how severely.

Turkey is theoretically powerful enough, with U.S. backing, to withstand the threats from both ISIS and the PKK. But it’s not clear the government has the domestic support it needs to do so. This is the crux of my worries: At another time, most Turks would, however grudgingly, have stood behind the government—even at the cost of life and liberty—for the sake of their own security. That no longer seems to be the case in today’s political climate.

Turkish concerns over the PKK and ISIS appear to have been trumped by polarization between pro- and anti-AKP camps. At the height of the PKK insurgency in the 1990s, I attended funerals in Turkey where family members of security officers killed in the fighting would praise the Turkish government’s efforts against the insurgents in eulogies for their loved ones. Over 70 members of the Turkish police and military have been killed by the PKK since July, and in many cases their funerals have turned into anti-AKP and anti-Erdogan rallies. In the wake of the Suruc attack, protesters blamed the government for failing to stop it.

The source of Turkey’s dangerous polarization is Erdogan himself. Erdogan has won successive elections since 2002, and built a cult of personality, as a kind of authoritarian underdog, portraying himself as a victim who is forced to crack down harshly on those whose “conspiracies” undermine his authority. On this basis, he has successfully targeted and politically brutalized the secular Turkish military, businesses, liberals, the media, Jews, left-wing voters, Alevis, and now the Kurds.

Combined with the story of Turkey’s economic success, this narrative has contributed to Erdogan’s enduring, if shrinking, popularity. And though he stepped down as prime minister and AKP leader in August 2014 due to his party’s term limits, he has continued to run Turkey as president from behind the scenes. As a result, the country is on the verge of a constitutional crisis: It is a parliamentary democracy per its charter, with the prime minister as head of government responsible for running the country, but it looks more and more like a de facto presidential system, with Erdogan at the helm. The AKP won about 40 percent of the vote in the last election, and Erdogan himself retains significant support from Turks who identify with his humble roots and social conservatism. Conversely, the nearly 60 percent of the electorate that voted for anti-AKP parties in the June 7 elections, including a demonized and alienated opposition, will not support his efforts to change the constitution and give himself more power.