TURKISH PRIME Minister Recep Tayyip Erdogan tried and failed to shut down Twitter in his country last week. Half a million tweets from Turks were recorded in the first 10 hours after the attempted ban, including one from President Abdullah Gul. On Sunday, the Turkish military had better luck in targeting two Syrian MiG-23 planes that Turkey said briefly penetrated its airspace: One that failed to heed warnings to turn around was shot down.

Perhaps it’s unfair to suggest, as many in Turkey have, that the downing reflected Mr. Erdogan’s attempt to regain his dignity and change the subject following the Twitter debacle. Then again, the prime minister announced the downing of the MiG in the same context in which he vowed to “exterminate” Twitterat a political campaign rally.

The truth is that Mr. Erdogan is engaged in an ruthless campaign to maintain his hold on power — a campaign that is dangerous to opponents both at home and abroad. With local elections scheduled for March 30 and a presidential election for later this year, the Turkish leader is attempting to reverse his declining political fortunes with crude measures of force. The casualties are not just the assets of Syrian dictator Bashar al-Assad, who deserves no sympathy, but also a Turkish democratic system that was once considered a potential model for the Arab Middle East.

Though his party has won three national elections since 2002 and still enjoys substantial support, Mr. Erdogan has two intertwined problems. One is corruption investigations that have revealed deep rot in his government and extend to his own family. An audio recording posted online allegedly captures Mr. Erdogan ordering his son to hide illicit cash. The other difficulty is that Mr. Erdogan’s mandate expires in 2015, and self-imposed term limits mean that he must either give up power — perhaps putting himself at the mercy of prosecutors — or attempt a Putinesque maneuver of switching to the presidency while enhancing its powers.

The result has been an autocratic tear that even Russia’s autocrat might find impressive. Mr. Erdogan has fought the criminal allegations by firing scores of prosecutors and police and by attempting to gain control over the judiciary. He has tried to intimidate and silence critical media in a country where dozens of journalists are already in prison. The leaking on Twitter of recordings of his imperious phone calls to editors and his son (a reaction to his shutdown of legitimate investigations) triggered his attempt to block the service — although many of its 12 million Turkish users have been able to get around the ban.

That Twitter attack prompted a round of criticism from European governments and the Obama administration, which once regarded Mr. Erdogan as a favored White House friend and had been conspicuously silent about his abuses. But the Turkish leader, who had already embraced anti-American demagoguery, is unlikely to pull out of his downward authoritarian spiral. It will be up to Turks to rescue their democracy through their votes in the upcoming elections and, if that fails, by organizing peaceful resistance. As the Twitter episode has demonstrated, it is easier for Mr. Erdogan to order a plane shot down than to silence an engaged and mobilized citizenry.