The alliance between Washington and Ankara needs to be saved—and easy fixes won’t cut it.

Once NATO’s model ally, Turkey has since become its bête noire. Both inside and outside the country, there is a growing chorus wondering aloud if it is time for a divorce. Those who disagree dismiss these concerns as a tempest in a teapot. Halil Karaveli made this case recently in Foreign Policy, portraying President Recep Tayyip Erdogan’s threats to cut ties with the United States as empty bluster—above all, because of pressures from his political coalition—and exuding confidence that Ankara will ultimately do whatever it takes to restore the relationship.

Such optimism is misplaced. In Turkey, NATO is an object of aversion for Erdogan’s friends and foes alike. The United States is as popular as root canals. Only 18 percent of Turks have a favorable view of the country. Seventy-two percent consider it a major threat. The NATO alliance is in true danger of unraveling, and it cannot survive on its own. Saving it will require persistence, perseverance, and hard work.

Erdogan is surely a part of the problem. Once a darling of the West, he now keeps the company of some of the world’s most unsavory leaders and has come to resemble them. Institutions are weakening. Liberties are declining. Democracy is eroding. Relations with Russia are cozier than ever, while ties with the United States are at their nadir and those with Europe remain crisis-ridden.

Turkey’s crisis with the West, however, dates earlier and runs deeper than Erdogan’s time in office. He only stoked the flames of an already burning fire.

Turkey’s membership in the Atlantic alliance was a marriage of necessity. On both the left and the right, there existed deep reservoirs of antipathy toward NATO. And, even in the better days, the alliance’s grand strategy was somewhat dissonant with Turkey’s security concerns. During the Cold War, the role assigned to Turkey was to bottle up the Soviet Navy in the Black Sea, tie up Warsaw Pact forces along NATO’s southern flank, and serve as a staging ground for a counterthrust against the Soviet Union. Starting in the 1970s, Turkey found itself facing another problem. Its neighbors—particularly Syria and Iraq—were supporting militant groups fighting against it: first the Armenian Secret Army for the Liberation of Armenia and then the Kurdistan Workers’ Party (PKK). But Turkey could not fight back, because its forces were unavailable and its allies were uninterested.

With the end of the Cold War, Ankara thought that this picture would change. Then-President Turgut Ozal believed that if Turkey could prove its worth as an ally, it would have a bigger say in how the United States, now the hegemon of a unipolar world, would shape its region. He was one of Operation Desert Storm’s most fervent supporters. He opened Incirlik Air Base to U.S. soldiers, moved 100,000 Turkish troops from the Bulgarian border to the Iraqi border, and lobbied to deploy them in Iraq alongside the Americans. Allegedly, he even asked then-U.S. President George H.W. Bush for U.S. support to annex Mosul and Kirkuk, bringing Ataturk’s expansionist dream to fruition.

Instead, Turkey lost more than it gained. The U.S.-enforced no-fly zone turned Northern Iraq into a de facto Kurdish state under the protection of U.S. and British aircraft. The region also became a staging ground for PKK attacks into southeast Anatolia. The two years that followed the Gulf War are still the deadliest in Turkey’s two-decade-long fight against the PKK—a fact not lost on many Turks, who, rightly or wrongly, blame it on the United States, which was careless at best and complicit at worst. This experience also convinced many in Turkey that Washington favors an independent Kurdistan next door—a sentiment so pervasive that a decade later, it was enough to scare the Turkish parliament away from allowing U.S. troops into the country during the Iraq War, despite intense lobbying from Erdogan and promises of billions of dollars in aid.

Turkey does bear blame for foreign-policy malpractices such as its cavalier attitude toward Iran sanctions, unrestrained enthusiasm for Syrian President Bashar al-Assad’s ouster, ham-handed response to the rise of the Islamic State, and relations with regional partners such as Egypt and Israel squandered over petty vendettas with their leaders. When Turkey’s allies lambast it for these misdeeds, however, they should also take stock of their own record. Ankara’s life would have been much less difficult had Iraq not been invaded over a hoax, had the West not lacked a sound strategy in Syria, had Turkey’s protests about Kurdish militancy not been dismissed with a sneer, and had the United States not tended to talk down to its allies more often than it listens to them.

Consider two of the most controversial aspects of Turkey’s foreign policy: the military presence in Syria and the S-400 deal with the Russians. Ankara’s concerns over the growing strength of the PKK’s Syrian affiliate, the People’s Protection Units (YPG), and the implications of an autonomous Kurdistan in northern Syria were well known and well grounded. The PKK’s campaign for secession from Turkey took tens of thousands of lives. Yet, Washington made allies with it in Syria, while the Europeans have been allowing it to operate freely in their countries for decades. Turkey’s allies expected Ankara to make nice with its enemies and faulted it when it did not—a fact made even more disturbing because, ostensibly, the PKK was an enemy of NATO as well since it is designated by both as a terrorist organization.

A similar dynamic was at play in the S-400 deal, a crisis that was by no means inevitable. With Russia’s growing footprint, the security situation in Syria and Iraq, and the expanding missile programs of other regional powers, Turkey had a well-founded rationale to seek air defense capabilities of its own. It is no secret that Ankara has high ambitions for its defense industry. The country is already investing billions into building its own battle tank, combat warship, and fifth-generation fighter jet. One of Ankara’s key strategies in this pursuit has been to leverage its purchasing power to gain know-how and build capacity, which its NATO allies knew full well because their companies—including the two NATO bidders in Turkey’s air defense deal, Raytheon and Eurosam—have long been in such partnerships with their Turkish counterparts. Nonetheless, they gave Ankara the cold shoulder.