Brazil just held a presidential election that has filled the international press with anxiety. The winner, right-wing congressman and former Army officer Jair Messias Bolsonaro, has made rude comments about women, blacks, and homosexuals that many news outlets equate with incipient fascism. Commentators naturally have compared Bolsonaro to Donald Trump, a comparison the Brazilian firebrand has embraced. His followers have taken up the slogan “Make Brazil Great Again.” The New York Times wonders if Brazil’s democracy can be saved. The Atlantic claims Brazilians, in their frustration, have turned their back on democracy.

The man whom The Guardian has called “dangerous” and the Washington Post believes imperils the planet has declared support for the former military dictatorship, which reigned from 1964 to 1985. His running mate, General Hamilton Mourão, suggested a Bolsonaro government would enact a self-coup “in a situation of anarchy.” The former president Fernando Henrique Cardoso recently warned that Brazil is demonstrating signs of “revolutionary” conditions.

Right-wing candidates always arouse the media’s ire. But in this case, the media might have a point. Certainly Bolsonaro’s support for the military dictatorship and its practice of torturing leftist guerrillas should give one pause. Many recall that in 1993, Bolsonaro had ominously declared, “We will never resolve our serious national problems with this irresponsible democracy.”

Yet the man whose middle name is “Messiah” defeated his leftist rival with 55 percent of the vote. Brazilians overlooked his seemingly tepid support for democratic institutions and his past endorsement of military rule. This election could stabilize the country after one of its most turbulent periods, but we cannot rule out that it might also endanger Brazil’s democracy itself.

In recent years, Brazil’s national aspirations have crashed to earth. Not long ago, many pundits considered Brazil an up-and-coming power. In 2001, Brazil was the “B” in the BRICs, one of the four most important emerging markets in the world. A stable, thriving democracy with a huge economy dominated by world-class industries, Brazil exported aircraft and led an important UN peacekeeping mission. It was developing one of the greatest offshore oilfields in the world. Brazil’s hour, seemingly, had come.

In 2010, I led a study evaluating Brazil as a rising power and its implications for the United States. One outside expert, a Brazilian American, objected that the report couldn’t contain any negative information that might call into question Brazil’s inevitable rise. Even among well-informed Latin America watchers, Brazil’s bright future was an article of faith.

But Brazil’s rise was a mirage. Its hosting of the Olympics in 2016, amid political turmoil and crime fears, couldn’t paper over the endemic problems. Shattered dreams set the stage for Bolsonaro’s win.

The economy slumped, and its major state oil industry Petrobras has been at the heart of a huge corruption scandal. One sitting president, Dilma Rousseff, was impeached; the once-popular former president, Luiz Inácio “Lula” da Silva, was jailed; and numerous politicians from the main parties were implicated in the Lava Jato (“Car Wash”) corruption scandal, now several years running. Another white elephant of Brazil’s state capitalism, the National Economy Development Bank (BNDES), fueled the scandal by reportedly loaning $37.5 billion to companies investigated in Car Wash.

Little wonder that Transparency International ranks Brazil 96 out of 150 countries, near ethically challenged Bosnia and Indonesia. And Brazil’s corruption extends across borders. One of its flagship companies, the international construction firm Odebrecht, has spread its infection like Typhoid Mary, bribing politicians throughout the hemisphere. Odebrecht is currently under investigation by several Latin-American governments for bribing senior officials.

Crime has also eaten away at the Brazilian façade. Last year, Brazil recorded an astonishing 63,000 homicides; the South American nation now registers 14 percent of all global homicides, according to a Brazilian think tank. One recent study estimated that crime costs Brazil $77 billion per year, or more than 4 percent of its GDP. In some cities, violent criminal gangs like the First Command of the Capital (CCP) resemble insurgent groups. Before the Rio Olympics, Brazilians made a massive effort to control the gangs in their signature city’s favela slums. Special police units kept the lid on for the games, but this year Rio authorities reinforced the police with Army special forces, a tacit admission that prior efforts had failed.

Many Brazilians seem disenchanted with their 30-year-old democracy. In a 2017 poll from the Pew Research Center, Brazil stood out with only 8 percent declaring a “very strong” commitment to representative democracy. The survey also highlighted how a relatively high percentage of Brazilians would welcome other forms of government, including authoritarian leadership. (This is not an uncommon result in Latin America, where the public is less impressed by democratic process and more by results.)

Enter Bolsonaro, known as The Legend (“O Mito”) to his legion of supporters. At least he is willing to address these chronic problems head on. He wants to give the police more leeway in cracking down on drug dealers and other criminals to reverse the crime wave many Brazilians believe began with the end of dictatorship in 1985. He has pledged a free market agenda and has even promised to privatize corruption-riddled Petrobras. He picked a University of Chicago-trained economist to lead economic reforms and tackle the country’s huge budget deficit. A knife attack put Bolsonaro in the hospital for three weeks during the campaign, but it only added to his mystique. He has insisted he will respect institutions and has pointed to his 27 years in Congress as proof that he values that body’s importance.

Bolsonaro will have to assemble a governing coalition out of Brazil’s 26 parties in Congress. His Social Liberal Party is small, but he can expect help from the conservative “Beef, Bullets, and Bibles” caucus, which represents agricultural interests, law enforcement, and Christian evangelicals. Brazil’s spoils system might help him too: the president controls some 25,000 direct appointees, a powerful tool to build loyalty.

But given Latin America’s history, we cannot rule out that, faced with mounting problems, President Bolsonaro could move to secure for himself dictatorial powers, as other presidents in the region have done or tried to do. Although he hails from the political right, the anti-communist Bolsonaro bears similarities to another would-be national savior: Venezuela’s Marxist former dictator Hugo Chavez Frias.

Venezuela’s case offers some disturbing parallels. Like Brazil today, Venezuela in the early 1990s was the region’s flagship democracy, its dark political years seemingly well behind it. But Venezuela became vulnerable after a period of controversial reform and economic downturn in which corruption scandals discredited the political class. The charismatic Chavez, a military officer, failed in a coup attempt in 1992, but his effort caught the imagination of many frustrated Venezuelans. After being released from jail in 1994, Chavez got political religion and turned to electoral campaigning. As in today’s Brazil, Venezuela’s party system had fractured over the impeachment of the sitting president, which gave Chavez a wide opening.

El Comandante Chavez developed a huge personal following, but Venezuela’s traditional political class thought they could contain him. He won the presidency in 1998, with a strong mandate for change. Despite ominous signs that he didn’t respect Venezuelan democracy—he openly admired Fidel Castro and former Venezuelan military dictator Perez Jimenez—many chose to ignore them. Some big businessmen thought Chavez would take on Venezuela’s rent-seeking labor unions. Many left-of-center democrats supported him because he was patriotic, untainted by corruption, and not part of the old political establishment.

Thereafter, Chavez, with a degree of authority granted him by the national legislature, imposed more and more dictatorial measures on Venezuela, always with significant popular support. In 2002 and 2003, after a coup attempt and a general strike against him failed, Chavez cracked down on his main opponents and won the loyalty of the Venezuelan military. After that, dismantling Venezuelan democracy was essentially a mop-up operation. Even though Chavez often encountered strong pushback, it is impossible to argue that Venezuela’s path to a socialist dictatorship was unpopular, or unexpected. Chavez won every election (though there were allegations of fraud).

Perhaps this is an invidious comparison. Brazil’s long-suffering conservatives have a right to be satisfied with this win. The country needs a strong leader with the right vision, and Bolsonaro might provide it. His criticism of Brazil’s institutional corruption resonates, and his backing of market reforms is welcome. If he cuts Petrobras and other state institutions down to size, Brazil would benefit greatly. Brazilians are politically engaged and don’t want to lose their freedoms.

Still, they should be wary. As Venezuela reminds us, even a country with strong democratic values and traditions can lose them because of elevated expectations, frustration with the slow pace of change, and wishful thinking that a political messiah offers a better way.

Michael J. Ard, a former deputy National Intelligence Officer for the Western Hemisphere, teaches international relations at Rice University.