A Baku resident removes a portrait of Vladimir Ilyich Lenin in Azerbaijan, shortly after the country’s declaration of independence in 1991. (ANATOLY SAPRONENKO/Agence France-Presse/GETTY IMAGES)

AFTER THE Cold War it seemed that democracy was spreading, dictatorships were tumbling and capitalism ascendant. Today, democracy is in retreat. Liberal values such as transparency, rule of law, accountability and respect for human dignity are being widely trampled. Autocrats and even some Western politicians openly traffic in fear, xenophobia and paranoia. The enemies of democracy are growing bolder by the day. The United States is partly responsible for letting this happen. It should step up to the autocrats of the world and confront their dangerous illiberalism.

A remarkable wave of democratic change that began in the mid-1970s climaxed after the Cold War. According to a new book, "Authoritarianism Goes Global," from 1990 to 2005, the number of countries identified by Freedom House as "electoral democracies" grew from 76 to 119. During the same period, the number of countries rated "free" expanded from 65 to 89. In the January issue of the Journal of Democracy, Christopher Walker writes that a central assumption during these golden years was that authoritarian regimes would change if only they were engaged by democracies and shown the way. But they did not. In its latest annual survey, Freedom House found 2015 to be the 10th consecutive year of decline in global freedom. "Rather than reforming, most of these repressive regimes have deepened their authoritarianism," Mr. Walker writes.

The tyrants of today are more sophisticated than those of the past; rather than outright totalitarianism, they erect a facade of democracy and subvert it from within. They hold elections that are not competitive, use government-approved shell groups to edge out genuine civil society, pass laws outlawing free association and speech, and force the news media into submission by pulling the strings of the owners and editors. They brand as a "foreign agent" any group receiving money from abroad. Recently in Moscow, a center that for 20 years has been helping refugee children was closed down after being declared a foreign agent.

Just as worrisome, resurgent authoritarians are pushing beyond their borders. China is putting a huge swathe of sea under its military control, ignoring the competing claims of its neighbors. In recent years, Russia and China have started to master the “soft power” techniques previously practiced by democracies, using broadcasters to spread their anti-democratic views. Even the pitiless Islamic State, perhaps the most illiberal regime on the planet, has figured out how to wield soft power to recruit and terrorize.

Autocrats are also corralling the Internet, if not controlling it. Ron Deibert, director of the Citizen Lab at the Munk School of Global Affairs at the University of Toronto, wrote last summer that "far from being made obsolete by the Internet, authoritarian regimes are now actively shaping cyberspace to their own strategic advantage," imposing controls and sharing techniques with each other. Bloggers and digital revolutionaries all over the world have been at the vanguard of free speech, but they also suffer arrests and jailings for something as simple as a tweet. Mr. Deibert noted that in Egypt, President Abdel Fatah al-Sissi has cracked down on digital dissidents. "The aftermath of the Arab Spring is looking more like a cold winter," he writes, "and a potent example of resurgent authoritarianism in cyberspace."

Even in the United States, Republican presidential candidate Donald Trump is embracing illiberalism. He is stoking fear of Muslims; threatening retaliation against the media; and promising to embrace strongmen like Vladi­mir Putin and bring back and enhance the use of torture against suspected terrorists.

Democracy has had some bright spots. Recent elections have brought about promising change in Burma, Argentina and Venezuela and a peaceful transfer of power in Nigeria. Unseen individuals everywhere continue to risk life and limb to stand up for liberal values, such as journalist Khadija Ismayilova, who has now served more than a year in prison in Azerbaijan for committing revelatory journalism.

Why is democracy in retreat? The Great Recession and economic dislocations of recent years, including the plunge in oil prices, shook authoritarian regimes and prompted repressive measures to head off popular unrest. The Arab Spring collapsed a rotten autocratic order in the Middle East, but with the exception of Tunisia, democratic forces were not ready to fill the vacuum; the result was civil war or restored dictatorships. The troubled U.S. democracy-building projects in Iraq and Afghanistan discouraged attempts elsewhere.

It also seems clear, in retrospect, that not enough was done to build and sustain democracy in the vast corners of the former Soviet bloc after 1991. China’s model has proved attractive to some authoritarians, who think they can impose political repression without sacrificing economic growth.

Lack of attention from the United States has played a role, too. No other nation can match the power of the United States in advancing liberal values. The past decade has been marked by a crisis of confidence, a feeling of fatigue and withdrawal from the world. Unfortunately, there is a chance that America’s lethargy will worsen — Mr. Trump and Democrat Bernie Sanders are promising a further retreat from international commitments. Those who hope for a resurgence of freedom around the world can only hope that voters elect a president who will reinvigorate U.S. democratic leadership.

The Post’s View: No, this is the truth about Azerbaijan’s repression

Colbert I. King: Women are getting things done while our male GOP leaders continue to bluster

Mort Abramowitz and Eric Edelman: Turkey’s Erdogan must reform or resign

Robert Kagan: To Republicans afraid to take a stand against Donald Trump: Grow up

Ludmilla Alexeeva: In Russia, human rights groups need Western aid more than ever