Turkish President Recep Tayyip Erdogan adresses the crowd after the funeral service for victims of the thwarted coup | Burak Kara/Getty Images Erdoğan’s ‘Reichstag fire’ Europe and America grapple with the fallout from a failed putsch in Turkey.

BERLIN — Even before the last shots were fired in the small hours of Saturday, it was clear that President Recep Tayyip Erdoğan wouldn’t let a coup attempt go to waste.

Whatever faint hopes there may have been in Washington and Europe that he would capitalize on the outrage over the attempted putsch among the Turkish population and the political opposition to show a commitment to democratic ideals quickly faded, however.

Within hours, the purges of the judiciary and military had begun. While it could take months to determine what this “cleansing” will mean for the future of Turkey, this much is certain: Ankara’s fraught relations with the West just got a lot more complicated.

“He had a golden opportunity to change the narrative,” said Jonathan Eyal, associate director at the Royal United Services Institute, a U.K. think tank. “Instead, he chose the path of vengeance and score-settling. That will make it far more difficult for Western allies to stand by him.”

“There is no doubt that we are witnessing the consolidation of a new form of authoritarian regime with a populist streak” — Ayşe Kadıoğlu, professor at Sabancı University

Erdoğan has been at odds with the West over a range of issues recently, from Ankara’s crackdown on the Kurds, to Syria and the refugee crisis. What has strained relations most is the president’s increasingly authoritarian rule, in particular his assaults on critical media and the opposition, a crackdown many fear has put Turkey on course toward full-scale dictatorship.

Some Western officials and analysts predict the thwarted coup will become Erdoğan’s “Reichstag fire,” a reference to the 1933 arson in Germany’s parliament that served as Hitler’s justification for suspending civil liberties, the beginning of the Nazi dictatorship.

“There is no doubt that we are witnessing the consolidation of a new form of authoritarian regime with a populist streak,” said Ayşe Kadıoğlu, a professor at Istanbul’s Sabancı University, in an essay for Open Democracy.

“With the crackdown on media, academic freedoms, random arrests, and the increasing violence in the southeast provinces, citizens in Turkey have been facing major limitations on their basic freedoms for the past few years. The attempted coup d'état of July 15 is like the last nail in the coffin.”

As with the Reichstag fire, which the Nazis blamed on a Dutch anarchist, it may prove impossible to say with certainty who was behind the weekend coup attempt. If the Turkish leadership uses the event to amend the constitution to give Erdoğan sweeping authority, as now seems likely, that may not matter in long run.

Confident in the knowledge that the West needs his help in the fight against the so-called Islamic State and to harbor refugees from Syria, Erdoğan has largely ignored the criticism from Europe and the U.S.

Threats of 'a serious war'

The signals out of Erdoğan’s camp in the aftermath of the coup attempt suggest the troubled relationship is going to become even more transactional.

Even though President Barack Obama denounced the coup attempt before the outcome was clear, and made it clear the U.S. stood behind Erdoğan, the Turkish leadership accused Washington of helping to plot it.

Turkish Prime Minister Binali Yıldırım went so far as to suggest the U.S. would be “engaged in a serious war” with his country if it didn’t hand over Fethullah Gülen, the U.S.-based Muslim cleric Ankara sees as the mastermind of the plot.

The accusations directed at Washington, unprecedented from a NATO ally, prompted an angry response from Secretary of State John Kerry.

“Public insinuations or claims about any role by the United States in the failed coup attempt are utterly false and harmful to our bilateral relations," he said.

A report in Turkish media on Sunday that Erdoğan would meet Vladimir Putin next month will do little to calm the waters.

While Washington, which relies on Turkey’s Inçirlik air base to launch attacks against ISIL in Syria, has much to lose from a deterioration in its relationship with Ankara, Europe may have even more at stake.

Refugees vs Visas

Erdoğan’s agreement to harbor millions of Syrian refugees and prevent them from traveling into the EU defused a major political crisis that has divided Europe like nothing else in its postwar history.

In return for Turkey’s help, the EU agreed to send billions in aid and, crucially, to extend visa-free travel to Turks.

Erdoğan has threatened to pull out of the refugee deal if Europe doesn’t lift the visa requirement this year.

Europe is demanding Turkey meet a long list of democratic requirements, including an independent judiciary, before visa liberalization takes effect. But after Erdoğan fired thousands of judges over the weekend, including members of the country’s highest court, it will be impossible to argue that the country meets that test.

Another hurdle is Erdoğan’s controversial anti-terror laws, which allow the government to severely restrict media freedoms and detain activists.

“A democracy that respects the rights of all and protects minorities is the best foundation for doing so” — Angela Merkel

In the wake of the coup attempt, there’s little chance Turkey will agree to water down the legislation.

Indeed, comments over the weekend from senior Turkish officials, including suggestions the country reintroduce the death penalty, indicate the country is moving in the opposite direction.

German leader Angela Merkel, who like Obama denounced the putsch attempt and supported Erdoğan, made a plea for Turkish democracy.

Saying she hoped Turkey could overcome the violence, Merkel said: “A democracy that respects the rights of all and protects minorities is the best foundation for doing so.”

Erdoğan’s relations with Berlin of late have been even more troubled than those with Washington. A recent resolution by the German parliament declaring the Ottoman Empire’s massacre of Armenians in 1915 a genocide triggered an angry response from the Turkish leadership.

Since the vote, Ankara has barred German MPs from visiting their country’s Turkey-based troops. Merkel raised the issue this month with Erdoğan at the NATO summit in Warsaw but he refused to back down.

Such tensions aside, the question now is how far Europe is willing to go to keep the refugee pact alive.

One theory is that Erdoğan, unwilling to make the concessions necessary to win the visa waiver, will accept more money instead. Europe, which still has deep qualms about granting Turks travel privileges, might be happy to agree.

“No one has an interest in seeing this deal fully applied or in seeing its collapse,” Eyal of the Royal United Services Institute said.