The rump state of the once mighty Ottoman Empire, Turkey has experienced numerous traumas over the past century, including repeated coups to suppress internal challengers. It has also fought a tenacious armed insurgency by the Kurdistan Workers’ Party (PKK), which claims to represent the region’s Kurds, many of whom ended up in Turkey when Britain and France divided up the empire’s remains at the end of World War I. (Turkey deems the PKK a terrorist organization, as do the United States and the European Union.) The possibility that Kurdish secession could further erode the country has been intolerable for successive Turkish leaders. They have used methods ranging from harsh repression to bombardments to peace negotiations to curb the PKK’s ambitions, defeat it on the battlefield, or render it politically irrelevant.

The ascendancy of Erdoğan’s Justice and Development Party (AKP), with its conservative base of small-business owners and Muslim Brotherhood–inspired ideology, heralded a decade of rapid economic growth starting in 2002. A confident Turkey embarked on a policy of “zero problems” in its neighborhood, presenting itself as the region’s düzen kurucu, or “order setter.” The government expected significant economic payoffs, as Turkish companies fanned out across the region and made their mark, especially in the construction sector. Turkish television channels entertained Arab audiences with Turkish soaps, warming them up for visa-free visits to Istanbul and the Mediterranean coast.

But the Arab Spring uprisings put an end to all that. Along with the war in Syria, the turning point was the July 2013 coup in Egypt, which ousted the Brotherhood-led government, Ankara’s ally. With the Brotherhood on the retreat throughout the region, Turkey saw its reputation and investments go up in smoke.

Striking an impossible balance in Turkey

In response, Turkey began to focus on its most immediate concern: Syria’s civil war, which the Erdoğan government, along with its Western and Gulf allies, helped kindle in a failing effort to defeat the Assad regime. Instead, the war not only undermined Turkey’s interests as its rebel allies lost their footing—it opened a vacuum that jihadists and the PKK, Turkey’s two most formidable enemies, were keen to exploit. Indeed, for Turkey, the Syrian war has become less about overthrowing Assad—a task that became seemingly impossible once Russia entered the war in 2015—and much more about keeping these two groups at bay. Each threatened Turkey: The Islamic State sought to reestablish the caliphate, while the PKK sought to safeguard Kurdish rights. The latter aim, Turkish leaders feared, could eventually encourage the group to press for statehood, and therefore Turkey’s breakup.

While jihadist attacks generated terror, the war against the PKK in the southeast most worried Ankara. After talks with the group broke down three years ago, the costly and corrosive conflict seemed destined to go on forever. The PKK reinvigorated itself through its Syrian affiliate, the People’s Protection Units (YPG), which had started recruiting and training new fighters to take on ISIS. Even more worrisome for Turkey: The YPG received military assistance from the United States, which saw it as an effective fighting force against the jihadists. The result was a YPG-protected buffer zone inside Syria along the Turkish border—a situation Erdoğan has been keen to reverse.