The war in Syria has not only tested Turkey’s economic and institutional ability to absorb 1.1 million refugees, but has also deepened latent tensions between secularists, leftists, Kurds and Islamists. In particular, the increasingly visible presence of ISIS in Turkey has polarized the country, with opponents of the Erdogan government saying its support of the Syrian opposition has allowed ISIS to flourish, even generating homegrown support for militant Islam.

Historically, political parties in Turkey have tended to rally constituents not on a policy basis, but on ethnic, religious and ideological grounds. The Republican People’s Party (CHP) – now the main opposition – identifies with secularist, Kemalist and Alevi voters. By contrast, the center-right Islamic Justice and Development Party (AKP) appeals to Muslim constituents, and has appeared to balance its moderate Islamic platform with democratic values and economic success. Indeed, the AKP’s flourishing relations with Western allies, particularly NATO and the United States, helped make Turkey the poster child for political Islam during the last decade. But tensions have resurfaced in Turkey with greater intensity, particularly between secularists and Islamists.

The Erdogan-led AKP has taken a hard line against Syrian President Bashar Assad, insisting on his departure and calling for the international community to intervene militarily to help the opposition. As part of this policy, Turkey has hosted and funded Syria’s political and military opposition; but it has also brought about criticism at home and abroad for an open-door policy that has seen thousands of foreign jihadis enter Syria through its border. ISIS has garnered significant domestic support, as proven by reports of jihadi cells and hospitals operating in Turkey, clashes at Istanbul University between Turkish supporters and opponents of ISIS, and the thousands of Turkish foreign fighters in Syria.

In July, for instance, a widely circulated video of ISIS supporters praying in a central Istanbul park to mark the end of Ramadan triggered a storm of controversy. In response to the video, CHP Vice President Sezin Tanrikulu asked the interior minister whether the site was an ISIS-affiliated training camp and whether police and the Gendarmerie Command had given permission for the group to congregate. (Erdogan has strongly dismissed claims that the AKP government supports ISIS, calling it a smear campaign by his political opponents.)

Nonetheless, violent clashes occurred on Sept. 26 at Istanbul University, when Islamists wielding sticks and knives attacked leftist students protesting the group’s brutality. More than 40 people, including eight ISIS supporters, were arrested following a similar clash in October, according to local media reports. In the aftermath, other students accused authorities of targeting leftists and not doing enough to contain the Islamists.

The clashes were reminiscent of the “dark days” of Islamist-secularist tensions in the 1980s. For example, in May 2013, a double car bomb in Reyhanli on the Syrian border killed 53 people. Rival accusations of responsibility were made against both ISIS and the radical leftist nationalists from the Turkish Peoples Liberation Party/Front (THKP/C), illustrating the growing threat of homegrown militant movements on both sides of the political divide.

While Turks have remained largely wary of intervention in Syria, many Sunnis in the country are sympathetic to the revolutionaries, expressing solidarity with what is perceived to be the oppression of the Sunni majority by a secular military regime. Meanwhile, leftists and secularists, as well as the country’s main ethnic Kurdish minority and Alevi populations – who complain the ruling AKP discriminates against them – have tended to oppose the government’s position on Syria and criticize its perceived support for radical Islamists.

As Turkey’s Syria policy became more contentious, leaders from all parties ratcheted up emotional and polarizing language in campaign speeches, drawing on the Syrian file to rally their constituents on ideological or sectarian grounds. For example, in the lead-up to his successful win in the August presidential election, Erdogan accused opposition CHP leader Kemal Kilicdaroglu, an Alevi, of supporting Assad because of his religion, drawing criticism for equating the two similar but different sects (Alevi and Alawite.) The election results, in which Erdogan won with a 51.9 percent majority, also revealed the deep-rooted geographical split between urban secularists and conservative rural Turks.

Among Turkey’s minority communities, tensions were exhibited in sporadic incidents along Turkey’s border region from early on in the uprising – in the Hatay region (home to the largest population of the country’s estimated 1 million Alevis), in Gaziantep (where hundreds of thousands of Syrians reside), and in the Kurdish-dominated south. Hatay in particular has witnessed small-scale CHP-affiliated leftist protests against intervention and in support of Assad, and there have been consistent reports of small-scale clashes between leftists and Syrians migrating to the area.

In August, for example, police intervened in Gaziantep after a large group of Turks attacked an apartment housing Syrians whom they alleged were connected to a man who stabbed his Turkish landlord. Residents blamed President Recep Tayyip Erdogan’s policy on Syria for the outbreak of violence. The resounding CHP victory in Hatay province in May’s local elections was direct punishment for the AKP policy on Syria, which brought an influx of refugees and militants that is destabilizing the economy and worsening the area’s security situation.

But events in Kobani have most clearly brought the deep fissures in Turkish society to a new head. At least 37 people were killed over four days across the country in early October when the armed forces suppressed violent protests by Kurds, along with supporters from leftist camps and Erdogan opponents, against the government’s reluctance in siding with the Kurds against ISIS in Kobani. Abdullah Ocalan, leader of the Kurdistan Workers’ Party (PKK), declared that all peace talks with the Kurds would be off if Kobani fell, and warned of a revived Kurdish military insurgency. The presence of more religiously conservative and radical militant Kurdish groups such as the Free Cause Party (Huda-Par) and the Revolutionary People’s Liberation Party (DHKP) at protests also fueled fears of a return to violence and increased popularity for secessionist Kurdish movements.

Turkey faces a host of policy challenges with all options pointing to greater engagement in Syria. Whether the Erdogan government softens its line on Assad, collaborates more cooperatively with the United States on anti-ISIS policy, or hardens its position by resisting cooperation with the Kurds and continuing to back the mainly Sunni opposition in Syria, it risks rallying some sectors of society while alienating others even further.

Syria has meant the stakes have become higher for all domestic actors in Turkey, stoking old rivalries in what may prove the unraveling of the greatest period of stability in modern Turkish history.

Lauren Williams is a freelance journalist based in Beirut and Istanbul. She was formerly editor for the Middle East and North Africa at THE DAILY STAR in Beirut. This commentary first appeared at Sada, an online journal published by the Carnegie Endowment for International Peace (www.carnegieendowment.org/sada).