If America thought Turkey’s president was difficult to work with before, wait 'til it gets a load of him now.

Hours after a failed coup, evidently planned and carried out by elements in the Turkish Air Force, Recep Tayyip Erdogan returned from his holiday on the Aegean coast to a roaring crowd in Istanbul. He claimed to have survived an assassination attempt while he was in the resort town of Marmaris, and he thanked God for the “gift” that a night of chaos, helicopter strafing and parliamentary attentat had afforded him. He was finally going to do unto his enemies and ill-wishers what he had long sought to do. The message was clear: No More Mr. Nice Sultan.

And it was aimed squarely at the United States as much as the officers attempting to oust him. Erdogan blames a 75-year-old reclusive religious leader, Fethullah Gülen, for orchestrating the coup using loyalists embedded in Turkey’s military, police, judiciary and schools. And Gülen lives in the Poconos, which is why Erdogan made a bizarre reference to Turkey’s not being “run from a house in Pennsylvania” at his hastily arranged presser at Ataturk International Airport last night. “Turkey is not a country that can be bought or sold cheaply.”

He’s certainly right about that last point; buying the country has proven a costly affair.

Erdogan and Gülen had formerly been aligned in an awkward, decade-long attempt to marry a Muslim Brotherhood-style Islamism with Kemalist democracy—until, that is, corruption scandals began plaguing then-Prime Minister Erdogan and his inner circle in 2013 and he blamed Gülen for inventing them. There were embarrassing audio recordings, too, one being a remarkable phone call in which Erdogan can be heard instructing his 33-year-old son Bilal to squirrel millions in cash out of their jointly owned private residence. Many called for him to resign after that. He responded by sniffing a Gulenist provocation and shutting down even more of Turkey’s independent press.

Erdogan had always justified his creeping autocratic behavior as a necessary bulwark against wreckers and plotters and fifth columnists. Now he’ll absolutely believe he didn’t go far enough.

This morning, the newish Turkish Prime Minister Binali Yildirim made it plain that Gulen’s continued exile in the Keystone State was barely short of an American declaration of war. This threat should not be taken lightly.

In March, rumors were rife within Erdogan’s ruling Islamist Justice and Development Party (AKP) that a coup was in the offing and that Gülen’s partner in putsch was none other than Barack Obama. At the State Department, Ilhan Tanir, a Turkish journalist based in Washington, D.C. who is critical of AKP and has written for The Daily Beast, even put it to spokesman John Kirby whether or not it was true that the American commander-in-chief was looking to unhorse his Anatolian counterpart, as so many pro-government outlets had suggested. “Are we trying to overthrow the government of Turkey? Is that your question?” Kirby replied. “It is such a ridiculous claim and charge that I am not going to dignify it with an answer.”

Kirby may yet have to. Obama’s earlier unvarnished comments to The Atlantic’s Jeffrey Goldberg that he considered Erdogan, once his favorite foreign leader, a “failure and an authoritarian” (in Goldberg’s paraphrase) did little to temper what at the time seemed a feverish conspiracy theory that one NATO member might be planning regime change against another. Well, now the thousands of Erdogan supporters who took to the streets and sat atop tank turrets last night will judge that this conspiracy has indeed come to pass, and this will have broad repercussions for U.S.-Turkish relations, not to mention the war against ISIS, upon which those relations have faltered.

The effects can already be felt. According to the U.S. consulate in the southern city of Adana, Incirlik airbase has today been sealed and its electricity cut. Not only is this facility home to some 80 nuclear weapons, it has become a geographically vital launchpad for warplane and drone sorties into Syria. And it took months of exhaustive diplomatic wrangling to make it so.

Erdogan has famously de-prioritized the war against ISIS in favor of getting rid of Bashar al-Assad and installing a friendly Islamist government in Damascus in his place. Moreover, he is deeply wary of the Pentagon’s preferred ground proxy in routing the jihadists: marxisant Syrian Kurds aligned with the Democratic Union Party (PYD). The PYD is the Syrian sister of the Kurdistan Workers’ Party (PKK), which both Ankara and Washington have designated a terrorist organization, and against which Turkey is still actively at war.

Erdogan fears that the Kurds are constructing their own state upon the ashes of the Islamic one in northern Syria, courtesy of U.S. air power and embedded U.S. special forces, and that this represents a long-term national security menace to his country. (That view is actually shared by a wide sector of the Turkish security and military establishment, including, I’d wager, those who just tried to depose him.) It also represents, for him, a dark betrayal by a longtime ally. As one Turkish official not long ago phrased it to me: “How would America feel if we helped al-Qaeda build an autonomous zone at the Mexican border?”

All of which is to say that negotiating the terms of Turkey’s inclusion in Operation Inherent Resolve, as the anti-ISIS war is formally known, has been a near-run thing. Yet some progress had lately been made.

As the Wall Street Journal reported a day before the coup attempt, a meeting was held about two months ago at Incirlik at which U.S. and Turkish officials and representatives of the Syrian Democratic Forces, as the Kurdish-led proxy army is called. The discussion was over the logistics of the forthcoming liberation of Minbij, a crucial ISIS stronghold in Aleppo home to 100,000 Syrian Arabs. The Turks insist that Minbij not become a Kurdish fief after the head-loppers are gone. So the U.S. agreed to a blended composition of fighters to retake the town and to a mainly Arab-dominant military council to govern it once it was secure. The Turks also gave way on their “red line” that the Syrian Democratic Forces not cross the Euphrates River, thus allowing the Kurds to theoretically link up their cantons.

If, in his infinite paranoia, Erdogan now believes that America was in any way involved in trying to violently overthrow or kill him; or if he just considers America an accomplice after the fact by its continued hosting of the alleged coup-master, then he might easily decide to forswear this agreement with a lame-duck administration and turn quite nasty. Forget Minbij. Forget Raqqa.

Not for nothing was ISIS cheering last night as the gunship bullets tore through civilians and state buildings in Istanbul.