Turkey has recently reestablished closer relations with both Israel and Russia. But the events of July 15th — the attempted military overthrow of the democratically elected government of President Tayyip Recep Erdogan — has both Europe and the US searching deeply for a sustainable Middle East policy prescription. Without any hesitation, it has become abundantly clear that Turkey has suffered from a political earthquake. But Turkey was already a fractured society. It was fractured between its secular component and its religious one. Each of these two larger segments were fragmented as well.

Turkey has been a pro-Western bulwark of the Black Sea and Mediterranean coastline since 1952. It was at that time that Ankara first entered NATO and became an essential member of the Western alliance security system. Turkey’s value in terms of its geopolitical clout for NATO has been an important factor in denying direct access to the Middle East from any power outside this bloc. Turkey is also an essential element in the conventional land supremacy that NATO now holds over the Russian Federation. But it was only a few years ago that Turkey’s President Erdogan shocked Western observers by declaring to Russian President Putin that Turkey could be open to membership in the Russian-Chinese dominated Shanghai Cooperation Organization.

Modern Turkey has been changing from a secular, military-dominated model of politics to a variant of Political Islam for over three decades now. After suffering military coups to replace civilian governments during the 60s, 70s, and 80s, Turkey achieved a kind of stability under Turgot Ozal when economic policy shifted toward exports within a private sector mandate. This decade of transition (1983-1993) was followed by a period of political uncertainty after Ozal’s death in 1993. This was followed by the election of Turkey’s first Islamist government known as the Welfare Party. However, Turkey’s pro-Western military secularists once again used the formula of a coup to overthrow the elected civilian political party, albeit one with a specific Islamic hue.

Turkey’s initial Islamists were very careful not to embed themselves directly into politics. However millions followed the teachings and sermons of the moderate, Sufi-inspired leadership of the imam, Fethullah Gulen. Gulen preached a kind of synthesis between modernity and Islam. He established schools which emphasized science and technology. Hundreds of these schools sprang up across Turkey. They essentially became the base of the Gulen movement. Graduates were encouraged to go on to university, and from there, equal encouragement was given toward employment in government bureaucracies. Gulenism was not, however, a direct political movement. Instead, it was a kind of civil-religious betterment society with distant hopes for changing the extreme secular nature of the Turkish military and government establishment.

With the emergence of the Justice and Development Party and its election victory under Prime Minister (now president) Erdogan in the elections of 2003, Turkish politics began a gradual shift toward Political Islam. But Erdogan’s voting base was not the same as the intellectual cadres that encompassed the Gulenist movement. On the contrary, Erdogan had captured the vast voting potential of Turkey’s rural periphery. Most of these people were traditional Moslems and far removed from the urban base of either the Gulenists, the secular nationalist right-wing or the atheist far-left.

Erdogan and Gulen began as allies. And they remained allies for almost a decade. Erdogan needed the Gulenists because his political party was bereft of the human capital needed to run a civilian government. Erdogan borrowed that political capital from Gulen. Together the two leaders encompassed a kind of rainbow coalition of Islamists, from both the moderate camp of Gulen to less moderate Muslim Brotherhood types within the Justice and Development Party.

Gulen remained a spiritual leader and because of Turkey’s many military coups, asked for and was given residence in the US state of Pennsylvania. Erodogan bided his time, while expanding the liberal economic policies of Ozal. In turn, Turkey became an economic powerhouse as rural poverty was nearly completely extinguished. Erdogan’s popularity soared. He won reelection twice on the merits of his economic policies. Across the world, Turkey became the model for good Islamic-style governance. In the process, Erdogan’s international stature allowed him to confront the Turkish military and punish those secular officers who might attempt to overthrow his duly elected government.

It was the Turkish judiciary which eventually forced a split between Erdogan and Gulen. Erdogan was able to overcome the secular military with the help of the many judges within the Turkish court system. The Gulen movement had long embedded many university graduates into the high echelons of both the judiciary and the police. Some were also embedded within the military. Erdogan used a combination of his vast popularity among the religious underclass, along with a Gulenist-dominated legal system to defeat the secular military and send many coup plotters to jail. These trials (called Sledgehammer and Ergenekon) took place in the time period between 2010-2011. But in the aftermath, a kind of showdown took place over the judiciary’s demand that the head of the MIT (Turkey’s intelligence service), Hakan Fidan, testify in an inquiry involving the Kurdish separatist group PKK.

Fidan was Erdogan’s appointee, and the prime minister didn’t want the court system to make a “political football” out of his Kurdish foreign policy initiative. Gulen, unlike Erdogan, did not favor a peace initiative with the PKK. Gulen had non-secular followers at the highest levels of the security services, while Erdogan appeared to be in control of MIT intelligence. In the process of this titanic confrontation, the prime minister declared war against the Gulen movement. Similarly, Gulenist prosecutors within the judiciary accused the Erdogan family of corruption, and the die was cast for a serious blood feud between former allies and fellow Muslims. The rest is history.

On July 15th, a military coup was attempted with the goal of either killing or arresting the duly elected (four times) prime minister and president of Turkey. All political parties came out against the coup. Tens of thousands of Erdogan followers took to the streets as mosques and minarets urged resistance to the coup. In Pennsylvania, Fethullah Gulen claimed to have nothing to do with it. In the end, the coup failed because tens of thousands of average citizens would simply not allow an element of the military to seize power.

Meanwhile, President Erdogan has demanded the immediate extradition of Gulen by the US to stand trial in Turkey as a conspirator and traitor. A state of emergency has been declared and tens of thousands of government employees are now under investigation. Nearly one-third of the highest ranking officers in the Turkish military have been removed from their duties and are either under arrest or being investigated.

This takes us back to NATO. There is a line of thought in Washington that has postulated the proposition that if Gulen isn’t given a writ of extradition by US authorities, Turkey could leave NATO. This would mean the most serious geopolitical dilemma for the Western alliance security system since WWII. So far, this appears to be an extreme and unduly alarmist opinion. But it was the Russian military based in Syria which first warned the Turkish government of the impending coup. Once Erdogan and his array of vast supporters (along with the leaders of all the democratically-elected opposition) stood down the faction of the armed forces responsible for the attempted coup, President Vladimir Putin of Russia was the first foreign leader to call him with a message of strong support.

Putin invited the Turkish president for talks at the Kremlin the first week of August. This is truly astounding since it has been less than a month since Russian-Turkish relations had been practically severed. This relationship had suffered from deep recriminations over the shooting down of a Russian jet fighter on the Syrian-Turkish border last September. Erdogan finally apologized to Russia over the incident, but not until the Russian president proved that Moscow could make life very difficult for Turkey, especially with regard to the budding Kurdish autonomous zone just south of Turkey’s border with Syria. The Turks have also been extremely alarmed and angry with the Obama administration for its support of Syrian Kurdish forces in the coalition battle against ISIS.

All eyes will be on the Turkish leader’s trip to Russia this August. Putin will attempt to come to an understanding with Erdogan over the Kurds and the future of the Assad regime in Syria. How far afield these discussion will go is anyone’s guess. But the Turkish leadership is bitter toward both the US and the EU. EU ascension for Turkey is non-existent, while Turkey (like the rest of the Middle East allies of the US) is completely perplexed over the nature of the last seven years of Obama’s policy with regard to the region.

Turkey is not just a vital European power, but its geopolitical importance spreads into the Caucasus, central Asia and the Middle East. Turkey could shift the balance of power away from NATO and the West by dramatically tilting toward Russia and China. America’s think tanks have been agog with speculation over Ankara’s future course. Israel and its Sunni Arab neighbors rely on the support of the US. But a switch in the Turkish position would alter the perspective of the entire Middle East. This would have severe ramifications for US foreign policy from Israel to the Gulf and beyond the Caspian Sea (because of the oil sea lanes) all the way to Japan in the Far East.

The next president of the US must begin to reset his/her foreign policy toward both Europe and the Middle East. Donald Trump appears to think of foreign policy as a semi-isolationist and a nativist. Hillary Clinton, on the other hand, seems to be an old-line Cold Warrior without the political base to initiate such a policy. Neither US candidate shows much in terms of creativity or an understanding of either Ankara’s or Moscow’s overriding strategic concerns.

Putin initially wanted to be integrated into the West, but he was marginalized by Republican and Democratic US administrations alike. Erdogan wanted to be a part of the EU, but he was marginalized by Brussels. Meanwhile Ankara’s fear of a militarized Kurdish enclave in northern Syria is tantamount to an existential threat for the Turks. Might these two leaders, Erdogan and Putin, gravitate toward each other? It is not outside the realm of possibility.

All eyes will be on Turkey. Erdogan must determine where and how he wants to proceed. He can stay with the West or find a new Eurasian direction with Moscow and Beijing. From Jerusalem to Amman to Riyadh and Cairo — without a cogent alternative to the many mixed messages being sent to the region by official Washington — all Middle East policy options will remain fluid. Meanwhile, across the European continent, the era of post-Cold War optimism and economic unification appears to be in retreat. Turkey and/or Russia have always been the great Euro-Asian pivot nations. In the aftermath of the failed Turkish coup these two nations’ futures, and the futures of all nations within the world’s geopolitical alignment, have now become open questions.