There has been a curious reversal playing out in the days following last Friday’s coup attempt in Turkey. The coup failed, but Turkey’s ruling AK Party has acted in ways that bear an unsettling resemblance to those who have succeeded in a coup attempt.

Successful coups—the one in Pakistan in 1999, for instance, as well as the more recent Egyptian coup—have some common denominators: in the days that follow, the putschists stoke nationalist fervour to legitimize their rule. They flood the streets with supporters and fire them up with appeals to patriotic duty. They warn of an abundance of danger, both within and without, to justify the mass arrests that inevitably accompany a coup and the state of emergency that follows it.

Turkey’s President Recep Tayyip Erdogan has deployed all of these tactics so faithfully that it now appears two coups hit Turkey last week. One , the military version, failed spectacularly; the other, an institutional coup, appears to be a whopping success.

Erdogan’s critics are either detained, on the run, or laying low, hoping the storm passes. The media landscape, already crippled by years of government crackdowns, is all but broken. No one now dares engage in any semblance of critical debate, and if they do they risk their careers. According to Amnesty International, in the wake of the coup attempt more than 20 news websites have been blocked, another 25 media agencies have had their licences revoked, while an additional 34 individual journalists have had their press passes cancelled. All in less than a week.

Over that time, at least 2,475 judges have been suspended, another 2,277 detained; all of Turkey’s 1,577 university deans have been ordered to resign; and 15,200 personnel at the ministry of education, including thousands of teachers, have been suspended. And now a state of emergency has been introduced.

Neither Pakistan’s Pervez Musharraf nor Egypt’s Abdel Fattah el Sisi could accomplish so much in such a short period of time.

And yet, government officials continue to call the people to the streets to protect Turkish democracy, using every means at their disposal, including text messages (this reporter has received two so far, both sent under Erdogan’s name). Officials repeat the mantra of the people triumphing over traitors and terrorists (something successful coup plotters regularly do as well) while Erdogan has promised more arrests, telling Al Jazeera in a live interview broadcast on July 20 that Turkey has “not come to the end of it yet.”

He went on to cite the French government’s response to the terrorist attacks in Paris on Nov. 13, which led to a state emergency that was extended last week following another attack in Nice. “Did they not detain people en masse?” he said. “Did they not arrest people in very high numbers?”

The comparison, however, is far-fetched at best. According to a Feb. 3 Human Rights Watch report criticizing France’s abuses after more than 2½ months of emergency rule, 3,200 raids were conducted by French police and up to 400 people placed under house arrest, a far cry from the reportedly 60,000 people affected in less than a week by Turkey’s ongoing purges.

Still, Turkish officials can technically argue that Turkey remains a parliamentary democracy. Turkey’s elected parliament, which unanimously condemned the coup, is intact. Some experts, however, argue that in practical terms, the parliamentary system has been all but suspended. Under the state of emergency, the executive branch, headed by Erdogan, will rule by decree, using its constitutionally mandated emergency powers to pass laws without the usual judicial oversight. The parliament may overturn those laws, but it is dominated by members of Erdogan’s AK Party who are expected to support whatever their leader decides.

“In an ironic sense, declaring the state of emergency is a good thing,” says one expert in constitutional law, requesting anonymity because he currently teaches at a Turkish university and fears government reprisals. “It is a legal move within the legal framework of Turkey. For years, Erdogan has been operating outside the constitution. There are many articles that he has ignored.”

Turkey’s constitution sets out strict limits to what the government can now do, the expert adds. Fundamental rights, such as the freedom of religion, freedom from torture and the right to due process remain intact, despite the state of emergency. How many of those safeguards will be honoured remains to be seen. The early signs are worrying.

Even before the state of emergency was declared, photographs emerged of senior coup plotters shortly after their arrest and then days later, following questioning, showing clear signs of abuse in custody. Parents waiting for sons at Istanbul’s main courthouse said they had no idea what had happened to their children.

“I’ve been here two days and they have not told me anything,” Vali Balli, whose 19-year-old son was taken into custody during the mass arrests of military personnel following the failed coup, said. “We have no news, no phone call from him, nothing.”

The state of emergency, the constitutional expert says, will put a veneer of legality over constitutional abuses that have been committed by Erdogan for years. “He makes religious statements that ignore the secular nature of the country. He supports the mass purges of teachers and judges and even clerics, violating the principle of proportionality that underpins Turkey’s legal system.”

Below the surface, the failed military coup is being transformed into what Erdogan has called “a gift from God”—or, in secular parlance, a coup of his own.