The repression of media is part of a disturbing trend in Turkey. (Dado Ruvic/Reuters)

A CRUCIAL election is approaching in Turkey, so it is sadly unsurprising that social media are once again coming under government pressure. This week authorities blocked more than 100 Web sites, including Twitter, Facebook, Google and YouTube, until they agreed to remove images of a Turkish prosecutor being held hostage by gunmen. The government was claiming credit for having killed the terrorists, while glossing over the fact that the prosecutor died as well; so the photographs had to go.

As Turkish President Recep Tayyip Erdogan steadily concentrates power, Turkey has become one of the most difficult places in the world for social media to operate. Twitter reports show that 60 percent of the requests it received to remove content in the second half of 2014 came from Turkey; restrictions of content on Facebook in Turkey doubled during the same period. Turkey’s domestic media have been cowed with prosecutions of journalists on trumped-up charges and forced sales of outlets to government-friendly investors.

The repression of media is part of an even more disturbing trend. Mr. Erdogan, who came to power in 2002 as a reformer and once was hailed as a model for Muslim democrats, now increasingly is described with terms such as sultan and even caliph by his supporters. Forced by term limits to give up his post as prime minister, he won election to the presidency last summer and now is seeking to convert what has been a position with limited powers into an authoritarian stronghold.

Already, Mr. Erdogan has chaired cabinet meetings in disregard of the constitution and attempted to intimidate the governor of the Central Bank. He has tried to interfere in negotiations between Prime Minister Ahmet Davutoglu’s administration and a Kurdish rebel group, prompting complaints from senior members of the ruling AK Party.

The power-grabbing campaign will come to a head with scheduled parliamentary elections on June 7. Mr. Erdogan is hoping the AK Party can win a two-thirds majority in parliament, allowing him to rewrite the constitution to his requirements. Opposition parties remain weak, so the contest may swing on whether a Kurdish party sympathetic to the rebels wins enough votes to take a bloc of parliamentary seats. Turks hoping to rescue democracy must hope that Kurdish leaders or liberal members of the AK Party ultimately demand that any constitutional reform retain checks and balances on the presidency.

Mr. Erdogan’s conversion into a Putinesque strongman would be a disaster for the NATO alliance, which in recent years has strongly identified itself as a pact of democracies. But NATO’s leader, the United States, has made no visible effort to check Mr. Erdogan’s ambitions. After ignoring the Turkish leader for six months, President Obama called him late last month, prompting talk of an improvement in relations. The United States could certainly use Turkey’s help in defeating the Islamic State in Iraq and Syria — a subject of Mr. Obama’s call. But if Turkey becomes a country where democracy and free media no longer function, what has been a valuable long-term alliance is bound to wither.