"Democracy is like a streetcar," said Recep Tayyip Erdogan when he was the mayor of Istanbul in the 1990s. "When you come to your stop, you get off."

Erdogan got off the democracy streetcar quite a few stops back. As the leader of an Islamist political party, the AKP, Erdogan was careful to demonstrate a commitment to democratic norms when he first won office as prime minister in 2003. But the more entrenched his power has grown -- the AKP won general elections in in 2007 and 2011, and Erdogan was chosen as president in 2014 -- the further those democratic norms have receded.

With the collapse of the attempted military coup last weekend, they are now receding even further. Turkish newspapers hailed the suppression of the revolt as "Democracy's Victory." It was anything but.

Erdogan's crackdown has been swift and ruthless. The botched coup, he gloated, was "a gift from God" that would free him "to cleanse our army." The "cleansing" began immediately, and went far beyond the military officers who had sought to force him from power.

Lists of people to be purged, it is now clear, had been compiled by Erdogan loyalists in advance. Within 48 hours, at least 35,000 individuals were rounded up or dismissed from their positions. Among those expelled: more than 6,000 soldiers, 9,000 police officers, and 1,500 Finance Ministry staffers. Thirty regional governors and more than 50 high-ranking civil servants were also fired. On Tuesday, more than 15,000 education ministry personnel were sacked, along with 1,577 university deans. Especially ominous was the rapid arrest of nearly 3,000 judges and prosecutors, including two justices of the country's highest court.

Little remains of democratic liberty, the rule of law, or political checks and balances in Turkey. Even before the uprising, the country was well on its way to becoming a full-blown Islamist autocracy. In its latest global survey, Freedom House rated Turkey only "partly free," citing the government's "intense harassment of opposition members and media outlets" and the "violence and intimidation" faced by opposition parties. According to another watchdog organization, the Committee to Protect Journalists, Turkey imprisons more journalists than any nation on earth. Publicly expressing an opinion deemed "insulting" to Erdogan is a felony in Turkey, one for which even a high school boy and a former Miss Turkey have been arrested.

In a prescient post four months ago, the American Enterprise Institute's Michael Rubin speculated that Turkey was ripe for a coup. He cited the spreading sense that Erdogan, more paranoid than ever, was out of control. "He is imprisoning opponents, seizing newspapers left and right, and building palaces at the rate of a mad sultan or aspiring caliph," Rubin wrote. Even Erdo─čan's "most ardent foreign apologists" were coming to recognize "the depth of his descent into madness and autocracy."

gish megalomaniacs are not a new problem in the Middle East -- think of Saddam Hussein or Bashar al-Assad -- but Turkey is a member of NATO. There is no room in the Western alliance for an Islamist dictatorship, yet increasingly that seems to be where Erdogan is determined to drive Turkey. Jihadist sentiment in the country is on the rise, fueled by Erdogan's promotion of Sunni Islamism in public schools. His government supports Hamas and regularly cooperates with ISIS. In the words of one analyst, Efraim Inbar of the Begin-Sadat Center for Strategic Studies, Erdogan's Turkey is a "Trojan horse" that undermines NATO and can no longer be trusted as an American ally.

Washington and NATO aren't about to unilaterally dump Turkey. During the coup, the White House issued a formal statement professing "unwavering support" for the "democratically elected civilian government" in Ankara. But Erdogan's sweeping crackdown has alarmed Western leaders. Secretary of State John Kerry issued a veiled reminder that non-democratic regimes are not eligible for NATO membership. His spokesman pointedly added that "it's too soon to say that [Turkey's] membership is at risk" -- implying thereby that it may not be too soon.

Americans tend to assume that the only good military coup is a failed military coup. But Turks might have been better off if last week's coup had succeeded. Erdogan, already a dangerous strongman, is now more unfettered than ever. That is bad news for Turkey, and for us.