IN A glass case at the Diyarbakir Bar Association are a striped shirt, dark coat and coiled belt. They belonged to the former chairman, Tahir Elci, a lawyer who was murdered in 2015 amid clashes between the Turkish army and Kurdish separatists. He was standing by the Four-Legged Minaret, a 500-year-old landmark in the ancient city, calling for peace. Someone shot him in the head. No one knows who killed him. The government blames Kurdish terrorists. Many Kurds blame the government. After Elci’s death, the army pounded the rebel-held part of Diyarbakir to rubble. The debris, including body parts, was heaped onto trucks and dumped by a river. Locals are scared to talk about any of this.

Barely a decade ago, Turkey was a budding democracy and aspired to join the European Union. Now it is galloping towards dictatorship. In 2016 army officers tried to mount a coup, putting tanks in the streets, bombing parliament and nearly assassinating the president, Recep Tayyip Erdogan. It was quickly scotched. Mr Erdogan launched a purge. Over 200,000 people, mostly suspected members of the Gulen movement—the Islamist sect said to have led the failed putsch—were jailed or sacked. Anyone could be arrested for having attended a Gulenist school, holding an account at a Gulen-owned bank, or even possessing $1 bills, which the government says were a mark of Gulenism.

Millions of Turks are now terrified of their president. However, plenty admire him for protecting them from the Gulenists. Adem, an estate agent in Istanbul, congratulates Mr Erdogan for “cleaning away the enemies within”—echoing a government slogan. He says, of the purge’s victims: “They’ve been arrested because they’ve done something wrong.” He adds: “In America if you steal state secrets they put you in the electric chair, don’t they?”

At an election on June 24th, Mr Erdogan is expected to consolidate his power. Despite double-digit inflation and a tottering currency (see article), he is likely to win re-election (though his party may struggle). And his office will become much more powerful, thanks to a constitutional change he pushed through last year. As “executive” president, he will be able to issue decrees with the force of law and pack the judiciary with loyalists.

Turkey exemplifies a dismal trend. The world has grown far more democratic since the second world war. In 1941 there were only a dozen democracies; by 2000 only eight states had never held a serious election. But since the financial crisis of 2007-08, democracy has regressed.

Most watchdogs concur. The latest survey by Freedom House, an American think-tank, is called “Democracy in Crisis”. In 2017, for the 12th consecutive year, countries that suffered democratic setbacks outnumbered those that registered gains, it says (see chart 1). According to the Democracy Index from The Economist Intelligence Unit, a sister company of The Economist, 89 countries regressed in 2017; only 27 improved. The latest “Transformation Index” from the Bertelsmann Foundation, another think-tank, which looks at emerging economies, finds that the “quality of democracy…has fallen to its lowest level in 12 years.” What these indices measure is not simply democracy (ie, rule by the people), but liberal democracy (ie, with a freely elected government that also respects individual and minority rights, the rule of law and independent institutions).

This distinction is important. In “The People v Democracy”, Yascha Mounk of Harvard University stresses that liberalism and democracy are separable. Voters often want things that are democratic but not liberal, in the most basic sense, which has nothing to do with left- or right-wing policies. For example, they may elect a government that promises to censor speech they dislike, or back a referendum that would curtail the rights of an unpopular minority. At the same time, plenty of liberal institutions are undemocratic. Unelected judges can often overrule elected politicians, for example. Liberals see this as an essential constraint on the government’s power. Even the people’s chosen representatives must be subject to the law. In a liberal democracy, power is dispersed. Politicians are not only accountable to voters but also kept in line by feisty courts, journalists and pressure groups. A loyal opposition recognises the government as legitimate, but decries many of its actions and seeks to replace it at the next election. A clear boundary exists between the ruling party and the state. This system is now under siege. In many countries, voters are picking leaders who do not respect it, and gradually undermine it, creating what Viktor Orban, Hungary’s prime minister, proudly calls “illiberal democracy”. Eventually, when enough checks and balances have been removed, a would-be autocrat finds it easier to neuter democracy itself, by shutting down the opposition (as in Turkey) or neutering the legislature (as in Venezuela, where the government staged a sham election on May 20th). The mature democracies of the West are not yet in serious danger. Donald Trump may scorn liberal norms, but America’s checks and balances are strong, and will outlast him. The real threat is to less mature democracies, where institutions are weaker and democratic habits less ingrained. Nonetheless, what happens in the West affects these places. America once inspired subjugated people and sought to promote democracy. It now has a president who openly admires Vladimir Putin and claims a “special bond” with Kim Jong Un.

Meanwhile, China supplies an alternative model. Having grown much less dictatorial after the death of Mao Zedong, it is reconcentrating power in one man, Xi Jinping, whose term limits as president have just been removed. Some would-be autocrats cite China as evidence that authoritarianism promotes economic growth—though what they often mean is that they too want to be presidents for life.

Globally, public support for democracy remains high. A Pew poll of 38 countries found that a median of 78% of people agreed that a system where elected representatives make laws was a good one. But hefty minorities approved of non-democratic alternatives. A worrying 24% thought that military rule would be fine, and 26% liked the idea of “a strong leader” who “can make decisions without interference from parliament or the courts” (see chart 2). In general, autocracy was more popular among the less educated.

With such large majorities favouring it, leaders cannot openly admit that they plan to abolish democracy. However, many have grown adept at subverting its essence while maintaining its outward appearance. The details vary from country to country, but it is striking how much the new autocrats have in common and how attentively they learn from each other. To oversimplify, a democracy typically declines like this. First, a crisis occurs and voters back a charismatic leader who promises to save them. Second, this leader finds enemies. His aim, in the words of H.L. Mencken, a 20th-century American wit, “is to keep the populace alarmed (and hence clamorous to be led to safety) by an endless series of hobgoblins, all of them imaginary.” Third, he nobbles independent institutions that might get in his way. Finally, he changes the rules to make it harder for voters to dislodge him. During the first three stages, his country is still a democracy. At some point in the final stage, it ceases to be one. All four stages are worth examining. In Hungary, two shocks undermined faith in the old order. First came the financial crisis. Before it, many Hungarians took out absurdly risky foreign-currency mortgages. When the Hungarian forint crashed against the Swiss franc and they lost their homes, they were furious. Fidesz, a party that was once quite liberal but has become dramatically less so, won an election in 2010 by blaming the previous government and vowing to make borrowers whole. The second shock was the Syrian refugee crisis of 2015-16. Hardly any Syrians settled in Hungary, but thousands passed through on the way to Germany, so Hungarians saw them on television. They gave Fidesz’s leader, Mr Orban, two handy enemies: the Muslim hordes and the liberal elite who wanted to let them in.

Mr Orban built a fence that largely stopped the flow of refugees. But still, he continued to play up the threat. His government ordered a poll asking voters what they thought of a fictitious plan by George Soros, a Hungarian-American billionaire, to bring 1m Middle Eastern and African migrants to Europe. A campaign poster showed Mr Soros grinning evilly and embracing opposition leaders holding wire cutters. “They would remove the fence together” ran the slogan. On April 8th Mr Orban’s party was re-elected with a thumping majority. In May Mr Soros’s foundation closed its office in Budapest. “Hungary disproves the notion that when you reach an income per head of $14,000 your democracy is safe,” says Mr Mounk of a theory popular with political scientists.

Picking the right enemies is crucial. Migrants are good, because they cannot vote. Mr Soros is even better, because he is rich, funds liberal causes and is, you know, Jewish. He can be painted as all-powerful; but because he is not, he cannot harm the demagogues who demonise him.

Stirring up ethnic hatred is incredibly dangerous. So rabble-rousers often use dog-whistles. South Africa’s former president, Jacob Zuma, denounced “white monopoly capital” rather than whites in general. Many leaders pick on small, commercially successful minorities. Zambia’s late president, Michael Sata, won power after railing against Chinese bosses.

Criminals make ideal enemies, since no one likes them. Rodrigo Duterte won the presidency of the Philippines in 2016 on a promise to kill drug dealers. An estimated 12,000 extra-judicial slayings later, the country is no safer but his government has an approval rating of around 80%.

Would-be autocrats need a positive agenda, too. Often they pose as defenders of an identity that voters hold dear, such as their nationality, culture or religion. Poland’s ruling party, for example, waxes lyrical about the country’s Catholic way of life, and lavishes subsidies on big families, who are likely to be rural and religious.

Parties of the nationalist right have learned from the left how to exploit identity politics. Both sides tend to favour “group rights” over those of individuals. The “Hungarian nation is not a simple sum of individuals,” Mr Orban said in 2014, “but a community that needs to be organised, strengthened and developed.” Steve Bannon, Donald Trump’s nationalist guru, calls him “a hero”.

To remain in power, autocrats need to nobble independent institutions. They do this gradually and quietly. The first target is often the justice system. Poland’s ruling party passed a law in December forcing two-fifths of judges into retirement. On May 11th Mr Duterte forced out the chief justice of the Philippines, who had objected to his abuse of martial law.

The media must be nobbled, too. First, an autocrat in waiting puts his pals in charge of the public broadcaster and accuses critical outlets of spreading lies. Rather than banning independent media, as despots might have done a generation ago, he slaps spurious fines or tax bills on their owners, forcing them to sell their businesses to loyal tycoons. This technique was perfected by Mr Putin in Russia, and is now widely copied. In Turkey, the last big independent media group was in March sold to a friend of Mr Erdogan.

Getting the security forces on side is essential. Robert Mugabe, Zimbabwe’s former president, took their loyalty for granted and was thrown out. Other strongmen are less complacent. To keep the men with guns happy, Venezuela’s president, Nicolás Maduro, lets them loot the national food-distribution system. Abdel-Fattah al-Sisi, the president of Egypt, who won 92% of the vote in March, lets the police top up their salaries by robbing civilians.

With the courts, press and armed forces in his pocket, a strongman can set about neutering every other institution that counts. He can sideline parliament, redraw the electoral map and bar serious opponents from politics.

Whatever ideology they profess, autocrats are often opportunistic. President Daniel Ortega in Nicaragua started as a revolutionary Marxist, seizing power in 1979. He lost an election in 1990 partly because he was anti-Catholic. So he rebranded himself as a devout Catholic—pushing a ban on abortion even if the mother’s life is at risk—and was re-elected in 2006 against a divided opposition. Last year his wife, Rosario Murillo, became vice-president, thus establishing a dynasty resembling the dictatorship he once overthrew.

Mr Ortega and his Sandinistas have commandeered the supreme court, which abolished presidential term limits, and created shell “opposition” parties to simulate choice while repressing genuine opponents. Critical media find themselves under new ownership, often that of Mr Ortega’s family.

None of this chipping away at democracy sparked unrest. It was only when Mr Ortega tried to grab Nicaraguans’ pensions that they rioted. The ruling Sandinistas’ mismanagement and graft has left the public-pension pot all but empty. Mr Ortega told workers to top it up. In response, tens of thousands took to the streets in April and tore down hideous statues erected in honour of Ms Murillo. The regime has clung to power only by shooting people.

Autocrats who plan to stay in power for ever need to indoctrinate children. “Most countries don’t have events from two years ago in their school history books. We do,” says a Turkish liberal, aghast that Turks as young as four are taught that their president saved the nation from the Gulenists. Venezuela’s Bolivarian University offers free tuition to students who submit to lectures blaming America for food shortages.

Liberalism and its discontents

Much has been said about the failures of liberal democracies. Although they are typically rich and peaceful, many of their citizens are disgruntled. Globalisation and technology have made them fear for their jobs. The culture wars ensure that more or less everyone feels disrespected by someone. The rise of autocracy is in part a reaction to these big historical trends. But it is also because power-hungry leaders have learned how to exploit them. You cannot have autocracy without an autocrat.

Many people crave power. Some, because they want to change the world. Some, for its own sake. Some, because power brings adulation, money and sex. Many who attain power have all these motives. Small wonder they cling to it.

Most authoritarian regimes are filthy. Of the countries and territories in the dirtiest third of Transparency International’s corruption perceptions index, not one is rated “free” by Freedom House. Of those in the cleanest 20, only Singapore and Hong Kong fail to qualify as free.

Autocracy and graft create a vicious circle. Power with few constraints enables those who wield it, or their friends, to get rich. The more they steal, the more incentive they have to rig the system to remain in charge. If they lose power, they risk prosecution, as Mr Zuma is discovering in South Africa. Thus, whenever an autocrat makes a stirring speech about national pride, his real aim may be to deflect attention from his own skulduggery. Mr Orban’s opponents would love to discuss why his friends are now among the richest people in Hungary, or why there is a huge football stadium in his tiny hometown. But his friends control the media, and would rather talk about immigrants.

Democrats can fight back. Five recent examples stand out. In Sri Lanka, the opposition united to beat a spendthrift, vicious autocrat. In the Gambia, the threat of an invasion by neighbouring countries forced a strongman to accept that he had lost an election. In South Africa, an elected leader who subverted institutions and let cronies loot with impunity was tossed out by his own party in January. In Armenia, an autocrat was ousted in April by mass protests.

And in Malaysia, the prime minister, Najib Razak, tried to steal an election in May but failed. Despite gerrymandering, censorship and racist appeals to the Malay majority, voters dumped the ruling party of the past 61 years. Its sleaze had grown too blatant. America’s justice department has accused Mr Najib of receiving $681m from 1MDB, a state fund from which $4.5bn disappeared. He says the money was a gift from an unnamed Saudi royal. The opposition gleefully contrasted the vast sums Mr Najib’s wife spends on jewellery with the difficulty ordinary folks have making ends meet. “Najib just makes up his own rules,” says a taxi-driver who switched sides to back the new government.

That strongmen make up their own rules is why liberal democracy is worth defending. And in the long run, it seems to deliver better material results. A study by Daron Acemoglu of the Massachusetts Institute of Technology found that switching from autocracy to democracy adds 20% to income per head over 30 years, though some economists dispute these findings. Guillermo Vuletin of the World Bank argues that autocrats fall when economies slump, and the democrats who succeed them take credit for the inevitable recovery.

What is certain, however, is that freely elected governments bound by the rule of law have less power to abuse citizens. “Little by little they took away our rights,” says a journalist in Diyarbakir, who was recently arrested for five innocuous tweets. “Every day I check the news to see which of my friends has been detained.”