On July 15, 2016, a group of military servicemen launched a coup against Turkish President Recep Tayyip Erdogan’s government. Even though the coup attempt was ultimately foiled, it constituted the gravest threat to Erdogan’s hold on power since he became Turkey’s Prime Minister in 2003.

Immediately after he recaptured the presidency, Erdogan arrested thousands of military servicemen suspected of participating in the coup and dismissed 2,700 judges for alleged links to the coup plotters. Erdogan’s mass arrests of coup plotters and calls for the extradition of dissident cleric Fethullah Gulen revealed his intolerance for dissent in striking fashion.

Should Turkey reinstate capital punishment and try coup plotters en masse, Turkey’s transition to authoritarianism will be complete. A comprehensive analysis of Erdogan’s responses to past challenges to his authority reveals how this transition will likely take place. The precedents derived from Erdogan’s handling of three major Turkish political crises over the past decade will be examined below:

1) The 2007 Military E-Memorandum Coup Threat Against Erdogan

In 2007, a General Staff E-Memorandum revealed that some Turkish military officers intended to stage a coup if Islamist Abdullah Gul was elected president. Erdogan responded to this threat by mobilizing the public against the military. Erdogan criticized dissident generals in incendiary fashion and emphasized that his government was the genuine protector of secular democracy in Turkey.

Citing the need to preserve civilian rule in Turkey, Erdogan implemented institutional reforms to entrench the ruling Justice and Development Party (AKP)’s political hegemony. In May 2007, the AKP government called a referendum on whether the Turkish people should directly elect their president. Erdogan supported direct presidential elections, arguing that the president was the “embodiment of the nation.”

Fears of an imminent coup strengthened public support for a strong presidency. Even though the opposition Republican People’s Party (CHP) vocally opposed Erdogan’s bill, 69% of Turkish voters backed direct presidential elections when the referendum was held in November 2007. This public show of support for Erdogan demonstrates his adeptness at exploiting political crises to entrench the AKP’s authority.

Based on his conduct in 2007, Erdogan will likely use the turmoil created by the coup attempt as a pretext for mass purges of the military and judiciary. Dissenters in these government bodies that threaten the AKP’s political dominance will be marginalized. A complete overhaul of these institutions could strip the military of its traditional role of guarding secularism in Turkey and allow Erdogan to implement his political agenda by decree.

2) Taraf Newspaper’s Revelations of Turkey’s 2003 Sledgehammer Coup Plan

In 2010, Taraf, a liberal Turkish newspaper, revealed that secularists in the Turkish military planned to overthrow Erdogan’s government in 2003. Even though the Microsoft Word document cited as evidence for the plot was only created in 2007, 300 suspected coup plotters were found guilty in 2012.

Many high-ranking Turkish military officials expressed opposition to Erdogan’s mass arrests on fabricated evidence and accusations of terrorism against suspected plotters. In 2011, the Turkish army’s chief of staff, Isik Kosaner, resigned alongside his navy and air force counterparts in protest against Erdogan’s crackdown on dissident officers.

Erdogan responded to these resignations by appointing Necdet Ozel, a general lacking NATO experience, as Turkey’s General Staff chief. Erdogan’s critics condemned this appointment as a cynical political machination aimed at subjugating the military’s autonomy.

Erdogan’s replacement of dissident military officers with his own loyalists reveals his willingness to crack down on military personnel who oppose AKP policies. To stabilize Turkey after Friday’s coup attempt, Erdogan will intensify his persecutions of high-ranking military officers opposed to his rule.

Two senior army generals were arrested immediately after the coup was foiled. Erdogan’s insistence on “cleansing” the Turkish military suggests that more arrests are likely to follow. As Turkey has a conscript army, it is impossible to purge all opposition activists from the rank and file of the Turkish military. But a forceful subordination of the military’s senior command to the AKP’s authority will likely curb retaliatory coup attempts from disgruntled servicemen.

3) The 2015 Electoral Success of Kurdish Nationalists in Turkey

In June 2015, the AKP lost its parliamentary majority and Erdogan’s attempts to form a workable governing coalition were unsuccessful. The Kurdish nationalist HDP greatly expanded its parliamentary representation from 29 to 80 seats. This posed a grave threat to Erdogan’s authority, as the Turkish government has frequently linked the HDP to the militant Kurdish Workers Party (PKK) organization.

The electoral success of Kurdish nationalists emboldened the PKK to kill Turkish security personnel on the pretense that senior officials in Ankara were collaborating with the Islamic State (ISIS). In response to Kurdish militancy, Erdogan scrapped the 2012 ceasefire with the PKK and escalated Ankara’s repression of the Kurdish minority.

Erdogan’s repression fuelled a wave of anti-Kurdish nationalism that resulted in an AKP majority government in November 2015. Decreased voter turnout in Kurdish communities afflicted by political violence reduced the HDP’s presence in the Turkish parliament from 80 to 59 seats.

Erdogan’s belligerence towards the Kurds during a period of political turmoil demonstrates AKP’s willingness to scapegoat a vulnerable minority for political purposes. Supporters of the Gulen-backed Hizmet movement will be the most likely victims of Erdogan’s post-coup repression.

Pro-government media reports have frequently speculated that Gulen sympathizers are present in the highest levels of the Turkish government. According to Erdogan’s supporters, the Hizmet movement aims to subvert Turkey’s secular identity and create a moderate Islamist state.

In order to foment Turkish nationalism and gain popular support for his repression of Hizmet supporters, Erdogan will likely link Gulen to the much-maligned shadow government in Ankara. For decades, Turkish politicians have justified political repression by invoking the presence of a “deep state” network of government officials with anti-democratic inclinations.

Blaming Gulen supporters for the recent coup attempt implicitly links the Hizmet movement to the deep state coalition. It also ensures that Erdogan’s persecutions of the Hizmet faction will have broad popular support in Turkey.

Based on Erdogan’s past handling of political crises, Turkey is likely to emerge from Friday’s coup attempt as an authoritarian state. Purges of the Turkish military command, the marked expansion of presidential power, and the scapegoating of vulnerable minorities will be the signature features of Erdogan’s post-coup governance style. Unless Turkish liberals can force Erdogan to change course, decades of uneven progress towards democracy might unravel and Ankara’s hopes of EU accession could be irreparably shattered.

Samuel Ramani is a DPhil candidate in International Relations at St. Antony’s College, University of Oxford. He is also a journalist who contributes regularly to the Washington Post and Huffington Post. He can be followed on Facebook at Samuel Ramani and on Twitter at samramani2.