A funny thing happened in the hours after Jair Bolsonaro, a far-right congressman from Rio de Janeiro, was stabbed during a campaign stop this month: Brazil’s beleaguered stock market bounced upward, on the belief that the attack on the controversial front-runner in Brazil’s upcoming presidential elections would boost his support and improve his chances of victory.

Bolsonaro is a former army officer who has praised the military dictatorship that ruled Brazil from 1964 to 1985. He has declared a female fellow legislator unworthy of rape, suggested that indigenous Brazilians are not suitable for procreation, called immigrants “scum” and, at different points over the last two decades, called for the murder of his political opponents. His running mate has suggested that Brazil’s military could return to power. The combination of the two on the right-wing Social Liberal Party’s ticket has fostered fears that Bolsonaro would pose a deep threat not only to Brazil’s most vulnerable populations and but also to the very existence of its 30-year-old democracy.

After two decades spent on Brazil’s political fringes and with less than a week until the first round of elections on Oct. 7, Bolsonaro has surged to the top of pre-election polling, which suggests he will face former São Paulo Mayor Fernando Haddad of the leftist Workers’ Party (or PT, for Partido dos Trabalhadores) in the second round at the end of October.

While Wall Street and market-focused elites had warned of the dangers of putting a right-wing populist in charge of the world’s ninth-largest economy, the market’s performance on the day of his stabbing was the most obvious indication yet that Brazil’s investor classes now see Bolsonaro as a man they can get behind, especially if it means keeping the left from returning to power.

“It was the clear sign of the market view that if this guy wins, then the [Workers’ Party] doesn’t,” said Thiago Figueiredo, a trader and analyst at Horus GGR in São Paulo. “So let’s celebrate. And that’s what the market believes, that he’s the best option.”

Bloomberg via Getty Images Bolsonaro has admitted his ignorance on economic issues, and through most of his political career, he has opposed the market-friendly policies of Brazil’s traditional center-right parties.

Bolsonaro and Brazil’s financial elites make for strange bedfellows. The right-wing candidate has admitted his ignorance on economic issues, and through most of his political career, he has opposed the market-friendly policies of Brazil’s traditional center-right parties. He has opposed austerity and privatization of state-owned companies. In 1999, after President Fernando Henrique Cardoso, the darling of Brazil’s elites, proposed a round of spending cuts, Bolsonaro suggested that someone shoot him.

But Bolsonaro and the fancy classes have a common goal in the 2018 elections. Both want nothing more than to keep the leftist Workers’ Party ― and specifically its leader, former President Luiz Inácio Lula da Silva ― from returning to power.

Perhaps Brazil’s most transformational political leader, da Silva oversaw a period of explosive economic growth that he used to expand social welfare programs during his presidency from 2003 to 2011. The good times didn’t last: The economy collapsed in 2014; da Silva’s hand-chosen successor, Dilma Rousseff, was impeached; and da Silva found himself convicted of money laundering as part of the country’s sprawling political corruption scandal.

But amid widespread discontent, da Silva led pre-election polls for most of the last year, until he was barred from the race in September under a law that prohibits politicians convicted of corruption from pursuing office. Still, the Workers’ Party has remained an electoral force. Haddad assumed da Silva’s place atop the party’s ticket and promptly rose to second place in the polls.

Haddad, whom many see as merely a figurehead for da Silva, now sits behind only Bolsonaro, who has based his campaign on backlash against the Workers’ Party and its policies and railed against the corruption inherent in Brazilian politics ― a problem for which da Silva has become the face.

Bolsonaro has thrived, too, because Brazil’s center-right parties have discredited themselves. President Michel Temer, a centrist who took power after Rousseff’s impeachment, has spent his two years in office plagued by bribery charges of his own and the unpopularity of the austere, reform-minded policies he has implemented or sought to enact ― including hard caps on social spending and reforms to public pensions and labor laws ― that have failed to reboot the economy. So while the Workers’ Party has lost some of its base, support for the center-right establishment’s presidential candidates has cratered. Former São Paulo Gov. Geraldo Alckmin of the Social Democratic Party (which formed a vital part of Temer’s governing coalition and has suffered from its own corruption problems) has failed to gain traction with voters hungry for change.

Bolsonaro has presented himself as the savior capable of delivering that change not just to Brazilians tired of corruption and violence but to its upper classes too.

Nearly a year ago, he began wooing financial elites in Brazil and abroad, attempting to convince them that he was only playing populist on the trail and would govern as a pragmatic liberal supportive of their market-friendly policies. In late 2017, he traveled to the United States to visit with Wall Street firms and speak with American financial publications. In April of this year, he hired Paulo Guedes, a University of Chicago–educated economist who had advised the center-right Social Democratic Party.

Since then, Bolsonaro has turned his back on his previous support for more statist economic policies and embraced the market-friendly beliefs of his new adviser. He has said he would staff much of his government with military men, but when it comes to economic affairs, he has promised to hand near-total control to his “Chicago Boy.”

There’s a flocking of people and specifically the elite, specifically people from the financial sector ... who are already moving to Bolsonaro. Monica de Bolle, Johns Hopkins University

Such an alliance has been formed before, with brutal consequences.

In 1973, Gen. Augusto Pinochet led a coup against Chile’s socialist government and put Latin America’s original Chicago Boys in control of the economy. They set about instituting neoliberal reforms that delivered economic riches to a small group of elites, all while Pinochet’s reign of terror was responsible for as many 3,000 murders and disappearances of political opponents, dissenters and anyone else his dictatorship deemed undesirable and for the torture of at least 40,000 more. To the elites, the bloodshed and human rights violations were merely an unfortunate byproduct of their experiment. “In spite of my profound disagreement with the authoritarian political system of Chile,” American economist Milton Friedman, who had educated those Chicago Boys, said at the time, “I do not consider it as evil for an econ­omist to render technical economic advice to the Chilean Government.”

Bolsonaro’s primary critique of Pinochet’s 30-year military junta: that it wasn’t murderous enough.

But for the market folks, his hiring of Guedes has nevertheless been a sufficiently convincing argument. Business leaders have cheered Bolsonaro at private campaign events and begun to see him as the only antidote to the Workers’ Party and Haddad, who has rejected the market-friendly reform consensus and proposed new investments into infrastructure and social services.

To many investors, Bolsonaro’s plan is “much better than the program that the leftist parties are presenting,” according to Figueiredo, who said he does not plan to vote for Bolsonaro. “For the people that do the math, he’s a better call than Haddad.”

And now that Bolsonaro and Haddad have separated themselves in recent polling, many of those elites have decided to abandon the center-right candidates and support Bolsonaro even before the second stage.

“There’s a flocking of people and specifically the elite, specifically people from the financial sector, CEOs and former CEOs, who are already moving to Bolsonaro right now,” said Monica de Bolle, the director of Latin American studies at Johns Hopkins University. “They’re not even waiting for whatever happens in the first round.”

Bolsonaro rose to 32 percent in a poll released Tuesday, and surveys have shown that he enjoys strong support among Brazil’s wealthier and more educated voters ― classes that often traditionally oppose the Workers’ Party. Recent polls suggest that more than half of Alckmin’s centrist bloc of voters would support Bolsonaro in the second round. Brazil’s political elite seem to be making themselves comfortable with the radical right-winger too. On Tuesday, just five days before the first-round election, São Paulo Mayor João Doria of the Social Democratic Party recorded a video in which he urged voters to choose Bolsonaro.

He’s not kind of a dictator — he is a dictator. Monica de Bolle, Johns Hopkins University

Bolsonaro’s detractors have linked him to President Donald Trump ― he is known as “Brazil’s Trump” in the media ― thanks to his penchant for radical and authoritarian sentiments. The more apt comparison is to Philippine President Rodrigo Duterte, who has carried out an extrajudicial war on drugs that is responsible for an estimated 20,000 deaths and counts the poor as its primary victims. In addition to his nostalgia for Brazil’s military dictatorship, Bolsonaro supports further militarizing Brazil’s already deadly law enforcement bodies and giving them more leeway to shoot and kill people with impunity.

And like Trump and Duterte before him, Bolsonaro is now poised to win. Polls show him in a virtual tie with Haddad in second-round scenarios.

“He’s not kind of a dictator — he is a dictator,” de Bolle said. “The things that he’s said are absolutely horrific. He clearly has zero regard for democratic institutions. He clearly means what he says. His vice president has been shooting his mouth off, and he clearly means what he says.”

“I’m deeply confounded by why it is that people are willing to shrug that aside and say that the PT is a lot worse than this,” she continued. “It’s not rational at all. There’s no rationality in the discourse.”

But to many financial elites, the perception that Bolsonaro is another Trump is only another reason to get behind him. The American economy, they note, has soared since Trump took office, with markets rising to record heights and unemployment falling to near-record lows. For all his populist rhetoric during the campaign, Trump has signed new tax cuts into law and gutted regulations on finance and other industries, making it easy for Brazilian bankers, traders and investors to look past the horrors of his administration.

“We’ve seen that the United States is flying. The economy is going up, and I can’t remember such good numbers,” Figueiredo said. “I cannot say that is 100 percent because of Trump, but he’s the guy in the chair.”

And much as with Trump, the elites simply don’t believe he’s going to pursue the sort of policies to match his words. His praise for dictatorship in Chile and Brazil and his violent rhetoric aimed at women, LGBTQ people and black and indigenous Brazilians are easy to dismiss as “things that people dig up from 10 years ago or 15 years ago” that financial elites “don’t think are a reason to be afraid if he’s the president,” Figueiredo said. Their view, he said, is that Brazil’s democratic institutions will constrain Bolsonaro should he win, preventing him from having the latitude to draw up a new constitution (as his running mate has suggested may be necessary) or implement the worst of his anti-democratic ideas.

It’s a familiar recipe for disaster, but the irony of it all is hard to avoid. Bolsonaro’s rise is a product of his ability to capitalize on voters’ discontent with Brazil’s elites. But if he wins the presidency, he will owe his victory, in part, to the acquiescence of the same elites he has railed against and their ability to turn their heads from the horrors he may bring to Brazil’s most vulnerable citizens.

“Some of them will be fine, probably,” de Bolle said of the elites who have embraced Bolsonaro. “But the country won’t be.”