U.S.-Turkish relations are in crisis. On July 12, Turkey’s Ministry of National Defense announced that it had taken delivery of the first elements of the S-400 system from Russia. The S-400 is no ordinary weapon but an advanced air defense system whose capabilities have worried American military planners. Well before the first components arrived, the Trump administration warned that such a step would jeopardize Turkey’s purchase of the F-35 Joint Strike Fighter, the most advanced plane in the world today. American officials informed their Turkish counterparts, repeatedly and in no unmistakable terms, that they could not acquire, simultaneously, state-of-the-art American stealth jets and the Russian weapon designed to shoot them from the skies.

The American decision to deny Turkey the F-35, which is almost irreversible at this late stage, is a major blow to the Turkish Air Force, which had ordered 100 planes as its combat fighter of the future. This is only the beginning of the story, however. As the largest weapons program in the world, the F-35 is being co-produced by an international consortium of countries, of which Turkey was an early member. Over the lifetime of the F-35, Turkey’s defense industry was banking on producing major components worth millions of dollars per plane across thousands of fighters—and subsequently performing maintenance and repair work on them. The lost F-35s will create a gaping hole in Turkey’s industrial balance sheet, which President Recep Tayyip Erdoğan is talking about filling, in part, by co-producing the S-400 with Russia.

This is not an isolated commercial transaction, the mere purchase of a single weapon. It is a repositioning of Turkey in international politics. Turkey’s decision to go through with the deal will trigger the application of the Countering America’s Adversaries through Sanctions Act (CAATSA), which Congress passed in 2017 to punish Russia for its military interventions in Ukraine and Syria, and its meddling in the last American presidential campaign. While the administration has a strong inclination to mitigate the force of these retaliatory measures, it has no choice but to take them, if for no other reason that it fears a parade of countries, including the Egyptians, Saudis, and Indians, among others, lining up to acquire the S-400. Moreover, if it does not act, the administration will lose control of its policy to Congress, which has unprecedently strong, bipartisan feelings on this subject.

It is difficult at this stage to predict the second and third order effects of the American retaliation. Will the Turks accept being sanctioned as their just deserts, or will they seek to respond aggressively in some way? And what of the lost F-35s? Will Russian President Vladimir Putin step forward to offer a replacement program, and, if he does, how will Erdoğan reply?

What is also clear is that Turkey’s purchase of the S-400 is not the whimsical move of a mercurial leader. Erdoğan means for this to register in the West as a turning point, one that did not arrive out of the blue but came after a long and steady deterioration in ties. He is playing Moscow off against Washington so that Turkey can no longer be taken for granted by either. The move is designed to increase Turkey’s options. In the United States it is uniformly described as a blunder of monumental proportions. How history will actually judge the move remains to be seen. At a minimum, the West should weigh its responses very carefully. Nothing less than Turkey’s Western orientation hangs in the balance.

The S-400 crisis comes at a moment when tolerance for the government of President Erdoğan is in very short supply. In Washington, it will doubtlessly strengthen a dangerously self-fulfilling doctrine that took root several years ago among key constituencies, namely, that Turkey is no longer an ally. While the president and his advisors do not share this assessment, it is a virtual consensus in think tanks and on Capitol Hill, where people are commonly heard to remark that Turkey no longer belongs in the North Atlantic Treaty Organization (NATO).

When pressed to justify this position, they quickly tick off a list of sins of President Erdoğan: he’s a member of the Muslim Brotherhood, seeking to spread an intolerant conception of Islam around the Muslim world; he tacitly supported the Islamic State, allowing it to funnel recruits across Turkish territory; he’s an authoritarian demagogue, undermining democracy and promoting mob rule; he’s an enemy of the Kurdish people, ethnically cleansing villages in Syria; he’s an anti-Semite, dedicated to weakening or destroying Israel; and, under him, Turkey has become a Trojan Horse for Moscow inside NATO, as evidenced by his recent courtship of Russia.

This is a “witness for the prosecution” analysis of Turkish foreign policy. While some of the charges against Erdoğan are not entirely groundless, they are invariably presented without context and analysis. Erdoğan is cast as a black-and-white villain rather than as one actor, albeit a leading one, in a complex story. Lost in the simplification are key questions about the relationship between Turkey and the West. What is Erdoğan trying to achieve with his troubling tactics, and how incompatible are his strategic goals from those of the Western alliance? Why are American policies so much more unpopular in Turkey than Erdoğan himself?

Germany has been wrestling with these questions for years, if not decades. The idea that the Turkish alliance is dispensable is not shared by official Germany. It recognizes that a difficult ally is eminently preferable to a disillusioned foe, especially one that sits astride the crossroads between East and West. Germany is prepared to support a sustained American effort to understand and ameliorate Turkey’s key grievances—an effort, if conducted thoroughly, that may yet bear fruit.

Such an effort would constitute a positive, common agenda for the United States and Germany in an era of deep disagreements. As transatlantic waters grow ever more turbulent, this is no small matter. There are few areas in which President Donald Trump and Berlin are as closely aligned as in their assessment of the alliance with Turkey as “Too Big to Fail.” Germany can play an important role in countering the prevailing view of U.S.-Turkish relations as doomed and can help guide the U.S. as it seeks to manage the fallout from the S-400 crisis. In the process, it can remind both American and German policymakers of the value of the other.

It is hard to defend Recep Tayyip Erdoğan’s record. Crackdowns on the press and political opponents have marked his nearly two decades in power. The harsher side of Erdoğan’s authoritarian ways were on full display for Americans when he unleashed his bodyguards on peaceful protestors in Washington D.C. in May 2017. As a consequence, it is common today for American observers to roll their eyes in despair whenever Erdoğan’s name is mentioned. It’s easy to forget that, not that long ago, many of those same Americans regarded Erdoğan as the great white hope of the Middle East.

In the aftermath of 9/11, the U.S. cast about for allies in the project of Islamic modernization—and quickly landed on the promising mayor of Istanbul. A pious Muslim from a working-class district of Istanbul, Erdoğan appeared to be the poster boy for enlightened Middle Eastern leadership. In 2002, as he rallied his Justice and Development Party (AK) to victory, he spoke devoutly of his desire to lead Turkey into the European Union (EU). The United States could hardly believe its luck. “When looking for hopeful signs that Islam and democracy can indeed coexist, the international community turns to Turkey,” the New York Times editorialized in 2004. By 2012, President Obama was listing Erdoğan as one of five international allies he trusted most.

How quickly attitudes change. It is hard to escape the feeling that Americans feel betrayed by Erdoğan because they expected too much of him to begin with. Erdoğan was never going to lead America’s effort to democratize the Middle East. He couldn’t do so even if he wanted to. He is the leader of a complex country with its own unique history and challenges. The idea that Turkey it is no longer an ally is, in part, the product of unrealistic expectations.

Furthermore, it equates a complex society with just one man. To be sure, Erdoğan is a uniquely powerful and influential actor in Turkish politics, but his power is hardly absolute, as the reversal he recently suffered in the Istanbul mayoral election reminds us. Battered though it may be, Turkish democracy is more resilient than some analysts suggest. Today, the popularity of the ruling AK Party has crested; Erdogan, one day, will step aside. When he does, what state will American-Turkish relations be in? Very bad, if public opinion surveys are anything to go by. Polls indicate that the vast majority of Turks now regard the United States as a hostile power. Erdoğan’s approval, by contrast, fluctuates between 40 and 50 percent—meaning that distrust of America is commonplace, and by no means limited to Erdoğan supporters. American decision-makers should worry as much if not more about this broad distrust than they do about Erdoğan’s challenging characteristics.

The roots of Turkish disaffection are easy to identify. For the last eight years Turks have been developing their own “witness for the prosecution” list of American misdeeds. It begins with the failure of the United States to aid Turkey in securing its border during the worst of the Syrian civil war. In June 2012, a Syrian ground-to-air missile shot-down a Turkish reconnaissance plane and, in November 2015, a Turkish fighter jet downed a Russian warplane that had crossed into Turkey. In the period between these episodes, Syrian forces repeatedly violated Turkish territory. The most alarming incident took place in October 2012, when the Syrian army fired an artillery shell into Turkey, killing five people and wounding at least ten more.

Today’s S-400 crisis has roots in American decisions taken during this period. The United States chose to treat these border clashes more as a disinterested bystander than as the ally of Turkey. The aloof American attitude contrasted sharply with that of Russia, which staunchly supported its Syrian client and aggressively sought to tilt the regional balance of power to its advantage. The failure of the United States to treat Turkey in a comparable manner was especially noteworthy after the shoot down of the Russian warplane in 2015. The Russian Air Force had long been testing the limits of American deterrence all along the Russian-NATO frontier, so the episode offered a perfect opportunity to demonstrate resolve—and, in the process, to keep Turkish security policy anchored to the West.

The anemic American response gave Erdoğan no choice but to address the challenge that Russia posed on the Turkish-Syrian border through bilateral negotiations with Moscow that sidelined the U.S. Even worse, it strengthened the voices of those Turks arguing for a policy of playing Moscow off against Washington. In short, American influence suffered.

The second item on the Turks’ list of American misdeeds is the harboring of Fethullah Gülen, the 78-year old cleric living in exile in the Pennsylvania Poconos. According to Erdoğan, the rebels who carried out the foiled coup attempt of July 2016 “were being told what to do from Pennsylvania.” Even Erdoğan’s political foes concede that Gülen’s organization was behind the coup. Evidence of Gülen’s direct involvement may be hard to produce, but Turks with knowledge of the inner workings of this secretive, hierarchical organization reasonably assume that such a consequential operation would require a personal order from its charismatic founder. Turks, therefore, do not understand why the United States has failed to respond favorably to their request for Gülen’s extradition.

In their most suspicious moods, they wonder out loud whether the United States government might actually be using Gülen to topple Erdoğan and destabilize Turkey. It was not that long ago when such conspiratorial thinking was relegated to the fringes of Turkish politics. Today it is much more mainstream.

The third and by far the most important item on the Turks’ list of American misdeeds is U.S. support for the People’s Protection Units (YPG), the Syrian Kurdish organization that Washington turned into its primary partner in defeating the Islamic State in Syria. The YPG is the Syrian wing of the Kurdistan Worker’s Party (PKK), the Kurdish separatist organization in Turkey that most Turks regard as a mortal enemy. In the long war with the PKK, some 30,000 lives have been lost. By mid-century, Kurds are estimated to make up over one-third of Turkey’s population. The Kurdish question, therefore, is existential for the Turkish Republic. By entering into this partnership, the U.S., in Turkish eyes, betrayed a treaty ally. Can a fair-minded observer dismiss the point?

The American alignment with the YPG has weakened under Trump somewhat, but it has not ended, and it has done more than anything else to drive Turkey toward Moscow. It has even led Turks to wonder whether the U.S. has a plan to break up Turkey. To Americans with knowledge of how the YPG alliance developed, such conspiratorial musings sound absurd. The U.S., they understand, has been confused now for many years about its role in the Middle East. In the absence of a clear strategic plan for the region, counterterrorism—the narrow fight against, first, al-Qaeda and, later, the Islamic State—has become a substitute for sound strategic thinking. It was a set of purely tactical considerations based on a counterterrorism mindset that led to the alliance with the YPG, not some sinister design against Turkey.

Be that as it may, Turkish suspicions of American intentions are anything but groundless. They are, moreover, a potent reality that explains much about the decision to acquire the S-400s. Turkish officials justify the deal to their American counterparts on the basis of practical calculations, emphasizing costs, terms of service, and delivery dates, as if it is a purely commercial transaction with no broader significance whatsoever. But it is clearly a power play. The goal of the exercise is to prove to Washington that Turkey will not be taken for granted—that it intends to demand satisfaction on the Gülen and, especially, the YPG questions, or it will reconsider its fundamental alignment in international politics. “We have other options,” Erdoğan is signaling to Trump.

One can argue that this is an unwise message, that it is counterproductive and will make it harder, not easier, for Erdoğan to achieve his aims. It is a message, however, that resonates not just with Erdoğan’s staunch political followers but also with a broad range of Turks. Dealing with that resonance, not with the prickliness and unpredictability of the president of Turkey, is the true challenge that stands before America and the West today.

How the United States responds to this challenge will shape U.S.-Turkish relations for decades to come. Erdoğan has taken delivery of the S-400s at a moment when Turkish and American negotiators are working on a “safe zone” for Turkey’s southern border. This is one of the most consequential issues in the Middle East today—but one whose importance is not fully recognized among the policy community in Washington. At stake is not just the narrow question of whether a stable arrangement can be found between Turkey and the YPG-controlled areas in Syria, but the larger strategic question of who will be the primary arbiter of that arrangement: the United States or Russia (and, with Russia, Iran).

The negotiations are being conducted under the clear desire of the Americans to withdraw forces from Syria. Although the current American policy, formally, is to keep forces in Syria indefinitely, the U.S. is drawing down their numbers rapidly while seeking to find European partners to fill the gap; meanwhile, Trump has repeatedly stated his intention to withdraw. If the U.S. were to retreat before a stable arrangement is concluded, the Russians will work to scoop up the YPG as an ally, thus becoming the primary arbiters of the Kurdish-Turkish negotiations and accruing in the process direct leverage over Ankara. As for the Turks, the rise of an autonomous Syrian Kurdish statelet run by an arm of the PKK would be a threat both foreign and domestic. If Ankara were to manage it through Moscow, Turkey would move closer to Russia in general, and ever farther away from Turkey’s NATO partners.

The implications for stabilizing the Middle East in a manner conducive to Western interests are grave—and they point to the most glaring flaw in the “Turkey is not an ally” doctrine. Proponents of the doctrine start from the assumption that, the Cold War being a thing of the past, Turkey is not as important to Western strategy as it used to be. In fact, the exact opposite is true. Turkey is more important than ever. Recent history has taught us two irrefutable but competing facts: the American public has no appetite for large-scale military operations in the Middle East; and yet, a precipitous withdrawal from the region will create disorder that will rebound to the disadvantage of both Europe and the U.S. The only way to balance these two facts is by relying more on allies.

Historically, Turkey has been among the most stable and reliable allies of the West, and it has been indispensable in shielding Europe from the worst aspects of Middle Eastern power politics. There is no reason that it cannot continue to play that role. Convincing it to do so, however, will require paying deference to its major strategic concern, namely, its fear of a PKK-safe haven in Syria. This is hardly a frivolous or, as many in the U.S. suggest, a bigoted fear. It is merely the common sense of an informed people.

There is no doubt that the Trump administration takes this fear seriously and has been working to come to an agreement on the Syrian safe zone. Negotiators claim that progress has been made but that challenges remain. On the basis of published accounts, it is hard to discern exactly what disagreements remain and how deep they are.

But one suspects that they are more fundamental than negotiators will allow. The Turkish strategy is designed to wait out the Americans. The presence of U.S. forces in Syria represents the main obstacle to Turkey achieving its core interests in northern Syria, namely, preventing the rise of an autonomous YPG-led Kurdish statelet, and creating a buffer zone, which, by stretching along the entire Syrian-Turkish border, would prevent YPG forces from having easy access to Turkish territory at any point. Given Trump’s obvious desire to withdraw troops from Syria, Erdoğan sees no reason to cut a deal with the Americans now, if it means compromising on these core interests.

Turkey’s S-400 deal is a hedge toward Russia that readies Turkey for the two most likely eventualities. On the one hand, if the Americans were to withdraw their forces from Syria before a final settlement to the civil war, then any agreement with Washington would be rendered worthless. Russia, in this scenario, would become the main arbiter of a settlement in northeastern Syria. Putin would position himself as the main intermediary between, simultaneously, the Assad regime and the YPG, the Turks and the YPG, and the regime and the Turks. The S-400 deal, in that case, would become the first step toward a new era of Russian-Turkish understanding.

On the other hand, if the Americans, despite their obvious impatience to withdraw from Syria, decide to station forces in the country indefinitely, then Erdoğan’s goal is to force Washington to move away from its current pro-YPG position and to become more deferential to Ankara. In this scenario, the S-400s will serve as a goad to push the Americans to settle northern Syria on Turkish terms. From the point of view of the Trump administration, Erdoğan’s calculations look woefully shortsighted and counterproductive. “Wouldn’t you prefer to work with us than the Russians to secure your border?” the Americans ask the Turks, failing to recognize a simple fact: Russia has made it clear that it is in Syria for good, whereas America looks ever prepared to race for the exits.

In short, until the U.S. adopts a long-term strategic posture designed to safeguard Turkey’s core interests, Erdoğan intends to play Moscow off against Washington. The White House appears prepared to take this reality in stride—or so one might conclude from the remarks of Donald Trump at the G-20 in Osaka. Trump evinced a sympathetic understanding of Erdogan’s decision to take delivery of the S-400s, blaming the Obama administration for creating the “mess” in the first place by, supposedly, not allowing Turkey to purchase Patriot missiles. “It’s a problem, there’s no question about it,” he conceded. “We’re looking at different solutions,” he continued, but then quickly changed the subject to bilateral Turkish-American trade, expressing a desire to quadruple it to $100 billion per year.

The size of the number came as a relief to the Turks. Let’s not quibble about whether it is actually a realistic target. The Turks interpreted the large number, no doubt correctly, as a statement of intention to avoid punishing Turkey economically for the S-400 deal. With the Turkish economy already in recession and foreign currency reserves at very low levels, Turks feel especially vulnerable to American sanctions. Trump’s goal, we can infer, is to land a blow that will be corrective to Turkey and instructive to other countries contemplating similar deals but not so broadly and deeply damaging that it will drive Turkey further into the arms of Moscow. He is well aware that if he cuts Turkey off from Western defense supplies he will simply provide the Russians with an opportunity to supplant the West. He is also aware that if sanctions are too draconian, he will alienate a younger generation of Turks who are broadly pro-Western but also intensely nationalist. It is this audience that Americans and Europeans should hold squarely in their sights.

Trump’s goals are the correct ones, but there is a fine art to being just tough enough to send the right message but not so tough as to drive the Turks away. And it is especially difficult to deliver when, on Capitol Hill and in the policy world, there are many who think that the time has come to teach Turkey a lesson.

More than any other partner of the United States, Germany has a key role to play in helping Trump to get the balance right. This is true for two reasons: of all the countries of Western Europe, Germany is the most familiar with, and exposed to, all things Turkish. If the Turkish-American alliance is a one-lane freeway of security issues handled by the Pentagon, the Turkish-German relationship is a multi-lane highway of crisscrossing issues affecting all segments of society.

Germany has not entertained illusions about Turkey as a beacon of democracy to the same extent as the United States, thanks to the breadth and depth of its ties to the country, which date back decades. Those ties have brought Turkey, in all of its complexity, closer to the German than to the American people. In Berlin, the future of Turkey is not merely debated in erudite journals but by the man in the street.

Beginning in the 1960s, hundreds of thousands of Turkish guest workers moved to Germany, forming the backbone of the over three million ethnic Turks, including hundreds of thousands of Kurds, who live in the country today. Over time, these ties have flourished into a major trading relationship. Germany has made huge foreign direct investments in Turkey, setting up or investing in over 7,300 business; moreover, at nearly 38 billion euros annually, Germany is Turkey’s largest trading partner. Since 1995, Turkey and Germany are linked through a customs union agreement, which covers all industrial goods.

So close are the relations that Turkey’s internecine conflicts recur in German society. While the PKK is banned as a terrorist organization in Germany, for example, its sympathizers and other Kurdish groups often march in major cities. Germany is also regularly pulled into the vortex of Turkish politics. Erdoğan and his ministers have campaigned aggressively in Germany in the lead-up to elections, angering many Germans in the process. When Turkey brawls, it is Germany that often catches a black eye.

The relationship with Turkey is too big to fail for another reason, however. Turkey plays a special role in insulating Germany from the worst aspects of the Middle East. Germany is an economic powerhouse but, for historical reasons, has no appetite for military leadership. Thus, in early July it declined an American request to deploy ground troops in northern Syria. At the same time, however, the stakes for Germany in Syria could not be higher. In the fall of 2015, hundreds of thousands of Syrian Arab refugees flooded Europe, and especially Germany, roiling the country in the process. While Germany will not take a direct role in the security arrangements on the Turkish-Syrian border, it will be more influenced by developments there than any other European country.

In retrospect, the fall of 2015 is a watershed moment in German politics. The refugee crisis damaged the establishment center and supercharged the populist right. To arrest this trend, the German government turned to Turkey. In March 2016, the EU, led by Germany, and Turkey struck a deal to stop the flow of migrants into Europe in exchange for billions of euros in aid. Despite enormous strain, the agreement has held to this day: Turkey offers protection to approximately 3 million refugees, whose wellbeing is financed in large part by German taxpayers.

For the German government, it is essential to keep Turkey in the Western fold. Unwilling to deploy force itself but deeply invested in the future of the Middle East, it must rely on allies to secure its interests. This perspective puts it in natural alignment with the Trump administration. To date, however, the United States and Germany have moved in parallel rather than in combination in their diplomacy with Turkey. An integrated strategy has not been tried.

Germany has already made clear that it will not help adjudicate the future of northern Syria, which requires the willingness to deploy military assets. This duty is more properly understood as the domain of the United States, but Germany has major economic tools in its arsenal that it can contribute. It can help demonstrate to Turkey that its future in the West will be far more prosperous than any alternative. At a time when U.S.-German relations are strained over so many issues, including trade policy, Iran, NATO contributions, and populism, Turkey offers an opportunity for Germany to work closely with the Trump administration.

This requires the type of steady, dogged diplomacy in which Germany prides itself. Berlin should exercise its diplomatic muscle on two fronts. In Ankara, it should use its weight and ties to counterbalance Turkey’s worst inclinations. If Germany’s efforts are understood to include close coordination with America, the opportunity for success will increase markedly. But in Washington, too, German should be driving the message that Turkey is too big to fail, and that it has not, in fact, abandoned the West.

At the deepest level, the differences that have emerged between Turkey and its Western allies are not the product of any individual leader or set of leaders. They are in fact a consequence of the fact that neither the United States, nor the Western powers, nor Turkey have a clear vision of the new Middle East order they seek to build. With no shared plan, they are groping around in the dark, blaming each other for the resulting collisions. If the necessary vision ever does arise, it will not come quickly and it will not emanate from the mind of any one leader. It will be, rather, an act of co-creation. What is needed most at this stage is a firm commitment to work together closely, in the expectation that a shared vision of regional order will eventually emerge.

Indeed, a viable new regional order is precisely what is at stake. Those in America who argue that we have already lost Turkey and that devoting time to courting an unpredictable leader like Erdoğan will simply empower his worst inclinations seem to assume that Turkey can be banished from NATO or simply treated as a second-class member of the alliance with no adverse consequences for the West. This is a monumental failure of the imagination. It is, in addition, a failure to recognize that Turkey, so far, has acted with restraint as the United States and other members of the Western alliance have empowered Turkey’s most feared enemy.

Imagine if Turkey were to lose that restraint. At the most unrestrained end of the spectrum, Turkey could align with Russia and Iran and actively seek to undermine the Western alliance in the Middle East. Mustafa Kemal Pasha, the founder of modern Turkey who is now known to the world as Atatürk, did just that in 1919-21, during the Turkish war of independence. While repelling the Greek invasion, and in an effort to prevent the British and French from using the invasion to partition Turkey, he aligned with Moscow and supported jihad against the Western powers throughout the Arab world. Yes, Mustafa Kemal, the founder of secular Turkey, aligned with the nascent Soviet Union while simultaneously supporting anti-Western jihad—because the national interest, at that moment, called for such methods.

The support that the Western powers give to the YPG in Syria today once again raises the specter of partition in the Turkish psyche. It is highly unlikely that relations with the West will deteriorate to such the point that Turks would provoke an all-out effort to undermine the Western order in the region. Turkey is too tied to the West economically and culturally, and it is too threatened by Russian encroachment to embrace a full-blown anti-Western policy. But such a possibility should not be beyond the realm of our imaginations. More to the point, there are many gradations of opposition to the West between Erdoğan’s current policy and a policy of total resistance. Any number of points along with the scale would make it nearly impossible for the West to stabilize the Middle East.

Let’s tread carefully—and let’s tread together—lest the chant, “Turkey is not an ally,” becomes a self-fulfilling prophecy.