Turkey’s military leaders rarely make public appearances at political events. But on August 7, General Hulusi Akar, the country’s chief of staff, appeared in uniform before a rally of more than a million people in Istanbul, alongside President Recep Tayyip Erdogan, Prime Minister Binali Yildirim, and the leaders of the Turkish opposition. Through numerous interruptions for applause, Akar thanked Turkey’s civilians for helping to quash July’s coup attempt and told the assembled crowd that the “traitors” behind that event would be punished harshly.

The vision of unity among the people, the military, and elected officials presented at the rally stood in sharp contrast to the bloody images that emerged after July’s unrest, which showed soldiers lynched by crowds and generals tortured by the police. It also underscored a transformation that is under way in the relationship between Turkey’s government and its military. Erdogan is attempting to balance two conflicting imperatives in his handling of Turkey’s armed forces. On the one hand, the president must rebuild a broken army into a strong and well-respected institution that can project power and meet security challenges ranging from Kurdish separatism to the terrorism of the so-called Islamic State, or ISIS. On the other, he has to ensure that the military will submit to his own authority. In balancing these demands, he will depend on a short-term alliance between his own Islamist government and secular ultranationalist elements in Turkey’s military and society: a marriage of convenience that will ultimately dim the prospects for peace between Ankara and the Kurdistan Workers’ Party (PKK) and could encourage Turkey to drift away from the West and toward China, Iran, and Russia.

At Ataturk's mausoleum in Ankara, August 2009. Umit Bektas / REUTERS

ERDOGAN’S NEW ALLIANCE

As the guardians of Turkey’s secularism, the military has never trusted politicians enough to fully subordinate itself to them. The military’s interventions in politics before this year—in 1960, 1971, 1980, and 1997—aimed at protecting the republic from what the generals saw as the harmful intentions of Turkish politicians. In the eyes of the Turkish public, the military has long enjoyed a privileged status as the guardians of Mustafa Kemal Ataturk’s vision of a secular Turkish nation-state.

Historically, the military has also functioned without much civilian oversight: after each coup, the generals made sure they expanded their autonomy by passing new laws and regulations. As a result, even under the ruling Justice and Development Party (AKP), which in recent years has whittled down the generals’ influence, the military has enjoyed considerable independence.

In recent months, Erdogan’s task has been to strip away this autonomy without compromising the military’s effectiveness. In the weeks that followed the coup attempt, the government placed the Coast Guard and the gendarmerie, an internal security force, under the control of the Ministry of Interior, and it subordinated the army, air force, and navy to the Ministry of Defense. Ankara shut down Turkey’s military schools and passed reforms that will allow graduates of the imam-hatip schools, which train state-employed preachers, to enter the armed forces. Erdogan also wants to put the chief of the general staff under the direct control of the office of the president and establish a system in which the presidency decides on high-level military promotions and appointments. The Emergency Law system, introduced after the coup attempt and extended in October, allows the ruling party—effectively controlled by Erdogan—to push through such structural reforms without real judicial or legislative oversight.

The clearest way for Erdogan to subordinate the military while safeguarding its effectiveness will be to turn to its most secular members.

These steps will move Turkey closer to establishing complete civilian control over the military. Yet they will also undermine and politicize the armed forces. Erdogan’s purges, which have targeted thousands of military personnel and nearly half of Turkey’s generals, have left the army weak. The hasty institutional changes, meanwhile, are likely to disrupt the chain of command, sowing division and competition in the ranks. In the longer term, Erdogan’s plan to inject conservatism and Islam into the military and to fill its institutions with government loyalists could politicize the officer corps and de-professionalize the army. At the moment, the military is too weak to resist those changes or to otherwise preserve its independence. That fact has been made clear by Turkey’s military incursion into Syria, which began in August. After resisting Erdogan’s call to intervene in that country for years, the brass acquiesced to his demands in part to prove its loyalty.

In the short term, the clearest way for Erdogan to subordinate the military while safeguarding its effectiveness will be to turn to its most secular members: the Kemalists, whom Erdogan has often demonized since coming to power in 2002. Without the cooperation of that group, whose members are among the military’s most numerous and professional, Erdogan’s government will struggle to replace the thousands of military officers it has purged. From the Kemalists’ perspective, meanwhile, cooperating with Erdogan has its own appeal. It could help repair the military’s damaged reputation and protect its core ideology from further assault, at least for now.

The government’s narrative that the coup was orchestrated entirely by followers of the U.S.-based cleric Fethullah Gulen should facilitate this cooperation, since it has helped obscure the Kemalists’ role in the violence. To be sure, Gulenists had an established presence in the military on the eve of the coup attempt, but most of them had been commissioned in the years since 2002, when the AKP came to power; as a result, they were concentrated in mid-ranking positions, mostly at colonel level and below. The number of generals and admirals involved in the coup attempt, as well as the confessions of some Kemalist officers, contradicts the government’s account of the coup atttempt as an exclusively Gulenist affair.

Both civilian leaders and the brass will continue to deny the Kemalists’ involvement in the plot, however, since naming the Gulenists as the lone culprit has formed the backbone of what might be called a Green-Kemalist alliance between the government and the military. The terms of this partnership are clear: the military will submit itself to an Islamist government, and in the short run, Erdogan will tolerate the Kemalists gaining strength.

The Green-Kemalist alliance will probably produce an even more nationalist, resentful, autocratic, and anti-Western Turkey.

There are already signs that this alliance is taking shape. In the aftermath of the coup attempt, ten Kemalist colonels who had been sentenced to prison in the Sledgehammer-Ergenekon mass trials were promoted to positions as brigadier generals and rear admirals. (Those anti-Kemalist trials, which were instigated by Gulenist police officers, prosecutors, and judges with Erdogan’s support, targeted ultrasecularist military officials and other figures accused of plotting to undermine Turkey’s elected government.) Government officials have repeatedly invoked Ataturk as a symbol of Turkey’s unity in recent months, and the Kemalists in the military have expressed their firm support for the elected government. Ataturk’s portrait has even been hung from the headquarters of the AKP.

Yet in the long term, sustaining the Green-Kemalist alliance will be difficult. Despite his scapegoating of the Gulenists, Erdogan is probably still worried about a Kemalist-led coup. What is more, the two sides are deeply divided over their visions for the country and the military’s futures. Kemalists think the answer to Turkey’s recent chaos is a return to secular principles. Erdogan, who worries that such an outcome might unduly empower the generals, favors the military’s total subordination and the gradual injection of conservativism and Islam into the ranks. An eventual clash over Erdogan’s efforts to restructure the army therefore seems likely. For now, however, the government and the military will focus on their common enemies and let their shared resentment of the West—particularly the United States, which they believe enables both the Gulenists and Kurdish militants—shape Turkey’s foreign policy.

A portrait of Ataturk hangs from the AKP's headquarters in Ankara, August 2016. Umit Bektas / REUTERS

THE PIVOT TO EURASIA

The first area in which the effects of the alliance between Erdogan and the generals will be felt is in the conflict with the PKK. Since the cease-fire between Turkey and that group broke down in July 2015, the fighting has killed more than 1,700 people and displaced more than 350,000 others. Erdogan has pursued a policy of escalation against the PKK in part to rally nationalist support.

The prospects for renewed talks between Ankara and the PKK have been bleak for many months, and they will grow even dimmer under the Green-Kemalist alliance. The military has always opposed peace talks with the PKK, and Erdogan will press the fight against that group to secure the generals’ backing. For its part, the military sees the campaign as an opportunity to restore its damaged public image.

The Green-Kemalist alliance is also likely to move Turkey further from the West. In recent months, anti-Western sentiment has reached an all-time high in Turkey, mostly because the government and most Turks believe that the United States, of which Gulen is a permanent resident, played a role in the coup attempt. Anti-Americanism has been intense within the military, too, especially since the Sledgehammer-Ergenekon trials: Turkish prosecutors mostly targeted anti-Gulen generals who backed a shift in Turkey’s strategic orientation away from NATO and toward China, Iran, and Russia. Those generals were part of a group within the military that might be called its Eurasianists—a clique that grew even more hostile toward the United States around the time of the trials because they suspected that Washington had used Gulen to cleanse the military of NATO critics.

Now, in the aftermath of the coup attempt, the military’s Eurasianists are back. The ten Kemalist colonels who were sentenced to prison terms in the Sledgehammer-Ergenekon trials and promoted after July’s violence are known supporters of that strategic reorientation. Since July, Erdogan’s government has also fired several hundred Western-educated senior military staff who were serving with NATO in Europe and in the United States. At NATO’s headquarters in Belgium, where Turkey had once assigned 50 military staffers, only nine remained as of early October. At a time when tensions between Ankara and Washington are high over the requested extradition of Gulen, and as Ankara and Moscow mend ties, the Green-Kemalist alliance is likely to gain further ground.

The Green-Kemalist alliance will probably produce an even more nationalist, resentful, autocratic, and anti-Western Turkey. Neither Erdogan’s conservative religious government nor the military’s ultrasecularist elements believe in liberal democracy or pro-Western policies. To the contrary: nationalism, anti-Western resentment, and a strong attachment to Turkey’s sovereignty are the main factors that unite them. In the absence of a solution to the conflict with the PKK and without Gulen’s extradition to Turkey, these tendencies will only worsen. One can only hope that those who stood against the tanks on July 15 will defend democracy and secularism against these unnerving trends.