AS SURVEYS by Freedom House have persistently reported, democracy has been on the retreat around the world for the past few years. That’s particularly true in Southeast Asia and Eurasia, where China and Russia appear to offer workable models of 21st-century dictatorship. So mass uprisings against corrupt and autocratic rulers last week in both Armenia and Malaysia ought to be celebrated as badly needed good news.

On Tuesday, the Armenian parliament voted to make opposition leader Nikol Pashinyan prime minister even though his supporters hold just nine of 105 parliamentary seats. The legislature was forced to act after hundreds of thousands of people thronged the streets of Yerevan, the capital. Mr. Pashinyan unabashedly called his victory a “velvet revolution,” a term that is anathema to Russian ruler Vladi­mir Putin. Yet Mr. Putin, whose regime has long had a chokehold on Armenia, felt obliged to offer Mr. Pashinyan his congratulations.

The next day brought another shock. An election in Malaysia that had been heavily rigged in favor of the ruling party nevertheless resulted in victory for an opposition coalition led by a 92-year-old former prime minister and his imprisoned coalition partner. Prime Minister Najib Razak, who appeared all but certain to hold power despite allegations of epic corruption, was ousted — and Malaysia saw its first change of ruling parties since its independence in 1957.

After weeks of peaceful protests, Armenia elected a new leader to power. Parliament selected protest leader Nikol Pashinyan as prime minister on May 8. (Reuters)

The events resemble the democratic breakthroughs of the 1980s and ’90s, when “people power” revolutions drove some dictators from their palaces, while others fell after underestimating the unpredictability of elections. They will surely alarm the rulers of neighboring countries — from Azerbaijan to Thailand — that thought their repression of nongovernmental groups and independent media could prevent such upheavals.

Despite his low-key reaction, Mr. Putin has cause for alarm: Any victory for democratic rule in the countries of the former Soviet Union offers an example of how Russia could change. Mr. Pashinyan, 42 , a former journalist and political prisoner, stirred rebellion by walking across Armenia to protest the attempt by former president Serzh Sargsyan to retain power by switching to the post of prime minister, a maneuver pioneered by Mr. Putin. The dissident-turned-leader says he will preserve Armenia’s alignment with Russia. But his vows to fight corruption and hold democratic elections are intrinsically at odds with Putinism.

Malaysia’s turnabout is still more dramatic. The prime minister sworn in Thursday is Mahathir Mohamad , who ruled the country from 1981 to 2003 and who turned on Mr. Najib because of allegations that he and cronies looted a government investment fund of $4.5 billion. In his day, it must be said, Mr. Mahathir ruled without much respect for democratic norms, but last week he partnered with the opposition movement led by Anwar Ibrahim, a leading advocate of liberal democracy in the Muslim world, who has been imprisoned twice on trumped-up sodomy charges — once by Mr. Najib, once by Mr. Mahathir himself. Mr. Anwar has been promised a pardon and succession to Mr. Mahathir as prime minister within two years. If he and Mr. Pashinyan can survive and prosper, that offers a ray of hope in this dark political era.

Read more on this issue: