SAN SALVADOR — It looked like a scene from the 1970s: armed soldiers marching into El Salvador's congress as lawmakers considered a presidential request.

The show of force this week has fueled an outcry over the increasingly visible role of the military in Latin America’s nascent and, in some cases, fragile democracies.

As political protests have spread through the region, the leaders of Chile, Ecuador and Honduras have surrounded themselves with uniformed officers as they have spoken before TV cameras. In Bolivia, the commanders of the military and national police called on President Evo Morales to step down after a flawed election. He quit and called it a coup.

In a region that long suffered from military dictatorships, the assertiveness by the armed forces is raising fears that democracy is taking a step backward.

“In a lot of countries, these classic images of stern-faced soldiers with rifles overseeing politics had become taboo, really, over the course of 30 years,” said Brian Winter, editor in chief of Americas Quarterly. “Now it’s somewhat suddenly acceptable again.”

El Salvador’s standoff between the military and lawmakers has ended peacefully — for now. The government sent soldiers into the congress on Sunday as President Nayib Bukele sought to pressure legislators to approve a $109 million foreign loan for security equipment. But only 22 of 84 lawmakers showed up for the session, short of a quorum.

Bukele, the charismatic 38-year-old who took office in June, told reporters he could dissolve the legislature: “If we wanted to press the button, we would press the button.” But he said he’d postpone the session instead.

The deployment of the soldiers — with the open support of the defense minister — sent tremors through El Salvador. Its U.S.-backed military fought a bloody war against leftist guerrillas from 1980 to 1992, and led governments for much of the 20th century.

“The president is forgetting history,” said Manuel Escalante, deputy director of the Institute of Human Rights at the University of Central America. “The people who forget their story are condemned to repeat it.”

Analysts say there’s little chance of a broad return to the kind of military dictatorships common in Latin America in the 1960s and 1970s, when generals ruthlessly suppressed civil liberties.

And there is considerable variation among countries; some give more power to the military than others. But Adam Isacson, director for defense oversight at the Washington Office on Latin America, said there remains a risk that some democracies could weaken to the point where “armed forces keep the civilians on a very short leash.”

Analysts say the growing tendency of political leaders to turn to the military to assert their power reflects a mounting frustration with democracy.

After years of strong growth, many Latin American economies have slowed, and citizens are sliding back into poverty. Some countries, such as Mexico and Brazil, have been plagued by violence. Corruption is more visible than ever, thanks to a freer media and more robust civil society organizations.

Satisfaction with democracy in Latin America fell from 44 percent in 2008 to 24 percent a decade later, according to polling by Latinobarómetro, a Chilean-based firm.

The military is often viewed as less corrupt, more patriotic and better able to restore order than politicians. Presidents turn to the armed forces to give luster to their governments or legitimacy to their decisions.

President Jair Bolsonaro of Brazil, for example, a former army officer himself, has filled his cabinet with military brass; about one-third is retired or active-duty members of the armed forces.

Presidents might also be relying on the military because they’re less likely to be criticized by Washington than in the past.

“I cannot remember in the last 25 years a U.S. administration that did not put democracy explicitly at the center of its policy,” Winter said. “Lots of people in the region have questions about how committed Washington is to that right now.”

While President Trump has condemned authoritarian governments in communist Cuba and socialist Venezuela, Winter said, his administration “has been less clear about what it thinks of emerging authoritarianism on the right.”

The Trump administration has largely backed governments such as Chile’s and Colombia’s in recent months as they have dispatched troops to respond to protests.

The State Department declined to comment Tuesday. Secretary of State Mike Pompeo tweeted last month that “We commit to promoting a Hemisphere of Freedom, where governments adhere to the rule of law.”

In some cases, politicians view the military as the only institution capable of maintaining security. In Mexico, President Andrés Manuel López Obrador has dispatched his new National Guard, composed mainly of former soldiers and marines, on missions ranging from pursuing narcotraffickers to stopping and detaining migrants. While Mexico has a long history of military subordination to the civilian government, López Obrador could wind up “in debt to the generals for helping him,” political scientist Denise Dresser wrote in a column in the daily Reforma.

Bukele is perhaps Latin America’s best-liked leader, with approval ratings approaching 90 percent. A political maverick, with the right- and left-wing parties that control congress, complaining that they are corrupt and fail to serve the people.

His critics, he said in a tweet on Monday, “care more about some lawmakers feeling ‘offended’ than they do about the thousands of Salvadorans killed” in gang violence.

Legal experts and human rights activists said it was unacceptable for Bukele to use El Salvador’s homicide rate to justify skirting democratic norms.

“If he needs the approval of a loan, he has legal resources at his disposal and he has to take the judicial route,” said Claudia Paz y Paz, a prominent lawyer and former attorney general of Guatemala.

The U.S. ambassador to El Salvador, Ronald Johnson, wrote in a tweet on Monday that “I don’t approve of the presence” of soldiers in the congress. “I felt relieved this tense situation ended without violence,” he wrote.

But El Salvador’s political warfare is hardly over. On Monday, legislators voted to denounce the president’s stationing of the military in parliament. For his part, Bukele vowed to push out lawmakers in congressional elections next February. “All these scoundrels are heading out the door,” he said.

Sheridan reported from Mexico City.