The results of Egypt’s presidential election this month were about as surprising as the sunrise. President Abdel Fatah al-Sissi, who came to power in 2013 in a coup, won reelection with 97 percent of the vote. Of course, Egyptians didn’t really have other options: Since the coup, Sissi has embarked upon a brutal campaign of repression, and NPR reported that six potential opponents were detained or pressured by the government to withdraw their candidacies. Still, elites, especially business elites, have largely welcomed the new president, according to H.A. Hellyer of the Atlantic Council; Sissi has served as an antidote to a government backed by the poor and Islamists.

Sissi’s consolidation of power, as perhaps the most dominant military ruler in Egypt in decades, would have been shocking only 10 years ago, when militaries were largely retreating from politics and democracy seemed to be thriving globally. In the 1990s and much of the 2000s, the idea that military officers would again seriously erode civilian rule and take control of governments around the world — and even be welcomed at the helm by citizens — seemed outlandish. Although coups and military meddling were common during the Cold War, they became rare after 1989. From Indonesia to Brazil to Thailand to Chile, the armed forces grudgingly turned over power to elected officials. In many of these countries, younger army leaders vowed to be truly apolitical, and the public enthusiastically rejected army influence in politics as well as outright coups.

But over the past decade, the flow of power has switched direction. In many democracies, such as Hungary, Italy, the Philippines, Poland and possibly the United States, norms and institutions are faltering as voters turn to populists. In the most dire cases — first in places with weak democratic systems, like Turkey and Egypt, and then even more in vibrant democracies like Brazil and Indonesia — military power is on the rise, and citizens, particularly the middle classes, have embraced it.

The reasons are familiar. Where voters believed that political reform would bring growth and development, rising global inequality has led to disillusionment. Sweeping technological, economic and cultural changes — such as migration to Central and Western Europe, and austerity policies in places like Thailand — have unsettled populations, providing opportunities for illiberal populist parties and strongmen such as Hungary’s Viktor Orban and Thailand’s Thaksin Shinawatra. Increasingly influential authoritarian states, like China and Russia, have exerted power over their neighbors.

But the military medicine voters are imbibing in a startling number of countries speeds up democratic sickness, leaving nations worse off than before. Civilian leaders become even weaker, and countries with coups are prone to repeat them in a never-ending cycle of military intervention.

In some of the world’s biggest and most dynamic democracies, recent shifts in public opinion on the military’s role in politics are striking. Among American millennials, only 19 percent believe that a military regime would be an illegitimate form of government, according to research from Harvard lecturer Yascha Mounk and University of Melbourne lecturer Roberto Foa, who studied generational views of government. They found that more than twice the percentage of Americans in their study thought military rule would be a “good” or “very good” type of regime as they did 20 years earlier. And younger people across Europe were less likely than older Europeans to disapprove of a military takeover: Thirty-six percent of millennials considered such a takeover illegitimate, while 53 percent of older Europeans did.

Even in regions where the scars left by juntas are still somewhat fresh, the military appears to be eroding civilian democracy without much pushback or panic. In Brazil, where a brutal military regime governed between 1964 and 1985, but in recent years democracy seemed to have become entrenched, the army has edged back into political life. The government has called up the armed forces to take over security in crime-hit Rio de Janeiro, worrying political activists and some poor residents, who have often been targeted by abusive state security forces; but the poor have also borne the brunt of the brutal crime wave, and many apparently favor the military’s return. The leader of the Rio operation has said troops might be called into other cities, and right-leaning Brazilian politicians are openly suggesting that the armed forces should return to political roles. A leading presidential candidate, Jair Bolsonaro, for instance, has lavished praise on the former military regime and played down its abuses, which reportedly included the crucifixion, electrocution and torture of thousands of dissidents, among other horrors. At times, Bolsonaro, a former officer, has called for a return to military rule.

The intervention in Rio seems to enjoy middle-class and upper-class support, too. Amid massive corruption scandals and economic stagnation, authoritarian nostalgia is in vogue nationally, according to Vanessa Barbara, a columnist for the Brazilian newspaper O Estado de São Paulo, who notes that a majority of Brazilians believe the country was safer when the army was in charge. Roughly 43 percent of Brazilians now want temporary military control of the government, according to a poll last year, an increase from 35 percent who favored such a takeover in 2016.

Brazil is not unique. There are multiple reasons that people in democracies, especially the middle and upper classes, increasingly think that army interventions could be acceptable — and that the military could preserve liberal norms or hamper illiberal populists. Disillusionment with democratic government in a number of places has fostered a willingness to consider authoritarian alternatives. Philippine President Rodrigo Duterte and former Egyptian leader Mohamed Morsi, for instance, have had little time for civil rights or independent courts, prompting army leaders in those countries to present themselves as guarantors of stability and constitutional values. In many democracies, like Indonesia, decades have passed since the era of military rule, and past military abuses have not been widely commemorated or taught in schools, allowing for public amnesia. And in many countries, the middle and upper classes may fear a loss of wealth and power.

In Thailand, where the populist Pheu Thai party and its earlier incarnations have won every election since 2001, many urban and wealthier Thais, who once played central roles in the country’s democratic transition, have embraced the military as a bulwark against Pheu Thai’s populist economics and sometimes illiberal tendencies, such as former prime minister Thaksin Shinawatra’s hounding of the press and his opponents. In 2013 and early 2014, street demonstrators in Bangkok called for the ouster of Pheu Thai’s elected government and often encouraged a coup, which happened in May 2014.

In the Philippines, where Duterte increasingly threatens rights advocates and opposition leaders and has unleashed a brutal drug war, academics, writers and other civil society leaders have highlighted the army as a force keeping the mercurial president from doing his worst, including possibly halting him from instituting martial law nationwide. (The Philippine military, which supported the dictatorial Ferdinand Marcos regime for nearly 15 years, has been accused of massive rights abuses.)

In some of the weakest democracies, these attitudes have energized the armed forces to clamor after power again. In Egypt, middle-class and elite tolerance for a military takeover facilitated the 2013 coup that installed Sissi. In Indonesia — perhaps the most impressive democratic success story in southeast Asia this century — army officers have been maneuvering to increase the military’s political power, in part by trying to gain more control over matters such as counterterrorism and diplomatic relations, according to veteran Indonesia correspondent John McBeth. To keep the armed forces at bay, elected President Joko Widodo has tried to co-opt them, appointing current and former generals to many of the top positions in his government, which risks turning over the levers of power to them anyway. Some, like close presidential aide Wiranto, were allegedly linked to major rights abuses during Indonesia’s authoritarian past.

In Burma, where the 2015 election of Aung San Suu Kyi’s National League for Democracy party seemed to herald a dramatic shift from decades of military rule that made the army a hated institution, the armed forces are now increasingly popular with citizens of all classes among ethnic Burmans, the majority. The military has portrayed itself successfully as the defender of stability and nationalism, even as it oversees ethnic cleansing in western Rakhine state. Some Burmese political analysts believe the current army leader, Senior Gen. Min Aung Hlaing, will run for president in 2020. If he does, he may enjoy strong backing from Burmans.

Even in the United States, where there is little threat of a military takeover, Americans have become shockingly tolerant of generals at the highest levels of civilian control. Before the Trump presidency began, news outlets and members of Congress were portraying incoming Defense Secretary Jim Mattis as a restraint against democratic backsliding. In a Politico essay, Patrick Granfield, a former speechwriter for Defense Secretary Ash Carter, praised “the generals guarding American democracy” from the new Trump administration, including Mattis and now-Chief of Staff John Kelly. The Atlantic noted in January 2017 that “the generals seem to provide one of the few constraints on Trump’s moves” to undermine democracy. When the president appointed H.R. McMaster as his national security adviser, Democratic members of Congress, such as Rep. Adam Schiff (Calif.), praised McMaster for his forthright nature and expected him to stand up for American values.

But bringing the men in green to power — or even giving them partial power — further ensures a country’s democratic decline. For one, as data scientist Jay Ulfelder and others have noted, countries that have a coup attempt are more likely to have another in the next five years. Militaries, emboldened by their elevation in politics, can burrow into political systems while they breed a kind of “coup culture ” in their ranks, according to scholar Nicholas Farrelly. In those cases, senior officers teach younger ones that army interventions are okay. In Thailand and Pakistan, where militaries intervene time and time again, officers learn that a coup is the appropriate default way to resolve any political stalemate. (To be sure, in rare cases — such as in Zimbabwe, a longtime autocracy with no obvious political exit route — a military coup can lead to a positive democratic outcome if its leaders create a framework for elections and democratic rule.)

There is also no evidence that placing more political power in military hands can promote the rule of law and constitutional liberalism. In an analysis published in The Washington Post two years ago, political scientists Joseph Wright, Erica Frantz, Barbara Geddes and George Derpanopoulos found that, since the end of the Cold War, “the most common outcome [of coups] is still the replacement of one dictatorship by a different group of autocrats” — and that coups spark increases in repression in the year afterward. In Thailand and Pakistan, the army has often taken power vowing to clean up corruption, but there is little proof that junta rule is a check against graft. Thailand’s current junta, which criticized the previous elected government for alleged corruption, now faces corruption scandals of its own.

Finally, putting hope in the military as a counterforce to illiberal but elected governments creates a dangerous distraction from the real ways citizens can work against illiberal democracy and further undermines civilian rule. Voters and their parties can develop more appealing political platforms or use protests to protect actual democratic institutions like the judiciary. Once a country elevates the military as the ultimate guardian of norms and institutions, it is hard to persuade the men in green to ever stand down.

Twitter: @JoshKurlantzick

Read more from Outlook and follow our updates on Facebook and Twitter.