When Fernando Haddad ran for a second term as mayor of São Paulo in 2016, he was mocked for wearing cheap baggy suits to televised debates, and even his supporters found him uncompelling. Although praised internationally for making the largest city in the Americas a more progressive megalopolis, Haddad was weighed down by his party’s dismal year, which included the impeachment of President Dilma Rousseff over alleged budgetary manipulation. Haddad, a former education minister and university professor, lost to a millionaire who had once hosted the Brazilian version of The Apprentice. But now, Haddad is his party’s nominee for the October 6 presidential election, assigned a role that befits him about as much as those suits from two years ago: mass leader.

The stakes of Haddad’s undertaking could not be higher. Congressman Jair Bolsonaro, a retired army captain, is riding high in the polls as an unreconstructed apologist for the military regime that ruled Brazil between 1964 and 1985. While casting his vote in favor of Rousseff’s impeachment in 2016, Bolsonaro dedicated it to the memory of Carlos Alberto Brilhante Ustra, a notorious torturer who died the year before without ever having to answer for crimes he committed as an agent of the dictatorship. In twenty-seven years in Congress, Bolsonaro has faulted the dictatorship for not killing enough people during its two decades in power, suggesting there should have been at least 30,000 casualties instead of several hundreds. He has argued that parents can and should beat homosexuality out of their children at an early age. He told a female member of Congress that he would never rape her because she did not deserve it. As a presidential candidate, he has called for widespread chemical castration of accused sexual offenders and argued that the discourse of human rights has done a “disservice” to Brazil. He has also declared that he will not accept the results of the election unless he wins, setting the stage for a potential constitutional crisis. Bolsonaro is Trump without the winking buffoonery, a Duterte who has yet to be handed the reigns of executive power. There is a very real chance that he could be Brazil’s next president.

It has long been clear to Brazilian progressives that Bolsonaro would mount a serious bid in 2018. Haddad’s candidacy, on the other hand, is largely an improvisation. After his 2016 defeat, Haddad met with former president Luiz Inácio Lula da Silva, the popular leftist who had previously been expected to seek a return to the presidency for a third term this year, but was jailed on corruption charges this past April. Haddad wanted to draft the policy platform for the presidential campaign. The position granted Haddad close access to Lula for months, even after the president was remanded to prison. When Lula was barred from candidacy last month, it seemed simple to pass the baton to Haddad on September 11. Haddad had already devised much of the policy agenda his Workers’ Party (Partido dos Trabalhadores, or PT) was putting forward. Now he just needed to go out and campaign on it.

So far, he has been effective: A poll on September 24 showed Haddad in second place with 22 percent of the vote—a meteoric rise for the new nominee. Haddad lacks Lula’s preternatural ability to connect with poor and working-class voters who form the base of the PT’s electoral strength. But what he lacks in righteous populist fire, he makes up for with reasoned and reasonable argumentation: In opting for Haddad, the PT placed a bet on lucidity, far from a sure thing in this heated electoral climate. While Haddad seeks to establish a moderate progressive tone, Bolsonaro consistently emits extreme right-wing views, hardly denying the fact that his presidency would pose an existential threat to Brazilian democracy. The crucial question is whether Brazilians will embrace a soft-spoken professor of philosophy and political science from a tarnished political party at the most cacophonous moment in the country’s recent history.

Being Lula’s man will probably propel Haddad into the run-off, when the field of thirteen candidates will be whittled down to two. But he will need to broaden his support in the second round to overcome the very real animosity toward his party, which many Brazilians blame for the recession, high unemployment, deindustrialization, corruption—and just about every other malady, real and imagined—that has gripped the country in recent years. Whether Haddad can prevail will depend in large part on whether he can convey a generational changing of the guard.

The PT, founded in 1980 by union leader Lula, along with allies in the progressive Catholic Church, grassroots movements, and academia, has won four presidential elections in a row and is widely seen as Latin America’s most consequential leftist party, bringing Brazil widespread recognition and economic gains on the international stage in the early aughts. Lula’s hand-picked successor, Dilma Rousseff, became president in 2010 and was reelected in 2014. Soon thereafter, corruption scandals and an economic downturn fueled calls for impeachment. Rousseff’s vice-president Michel Temer, who was from a different party, turned against her and joined with reactionary forces in Congress for an ouster, citing underhanded budgetary practices. International reaction was mixed, and her supporters pointed out that virtually every one of the previous male presidents had engaged in practices similar to the ones Rousseff was accused of since the return of democracy in 1985.

Impeachment bore bitter fruit: Michel Temer has been the most unpopular president in Brazilian history by far, reducing parties that allied with him to electoral rubble. The Party of Brazilian Social Democracy—long the main opposition party of the center-right—has been one such casualty, reduced to a bit player in national affairs largely due to its support for the disastrous current administration. The congressional coup against Rousseff also did little to improve the country’s economic fortunes or restore trust in public institutions. Instead, it emboldened a darkly reactionary current of Brazilian society that openly questions whether democracy itself is worth preserving if the PT is to keep winning elections.

What is standing in Bolsonaro’s way? Women, for one. A Facebook group created by women against Bolsonaro briefly exploded onto the scene in mid-September, quickly garnering hundreds of thousands of female adherents before being hacked by bolsominions, as Bolsonaro’s supporters are called by their critics. The hashtag #elenão (“not him”), which started out as a curt female-driven rejection of Bolsonaro, recently became a trending topic on Twitter and inspired hundreds of thousands to take to the streets in Brazil and around the world in protest of Bolsonaro’s potential election.  At the ballot box, poor women voters of color in particular are likely to be the nation’s firewall against a Bolsonaro presidency, seemingly put off both by his rhetorical violence toward women and his exterminatory approach to law and order.

Haddad himself, an untested last line of defense, also stands in the way. Bolsonaro will seek to mobilize anti-PT sentiment against Haddad in the second round of voting, a potent force that will lead many Brazilians to conclude he is the lesser evil. He will also remind voters of corruption scandals under Lula and Dilma, declaring that he will tolerate no such thing. Bolsonaro would not be the first authoritarian or protofascist swept to power promising to violently stamp out crime and corruption, nor is this promise new for him personally. But against the backdrop of economic stagnation, his pledge of a well-ordered, if domineering, society may be intuitively appealing for many Brazilians. Bolsonaro was also stabbed at a public campaign event in early September, images of him recovering in a hospital bed inspiring a wave of sympathy nationwide. It’s not inconceivable that he could stay ahead in the race by keeping his mouth shut and playing up the circumstances of his recovery.

It is less clear what tack Haddad will take to convince voters that, however angry they might be at the PT, Bolsonaro is a step into the abyss. Will he double down on the PT’s strength in the impoverished northeast, emulating as best he can Lula’s personalist appeals? Or will he stay closer to home and bank on his ability to convey moderation to voters in the economic centers of the southeast? It is no exaggeration to say that the future of Brazilian democracy may well come down to the ability of a progressive soft-spoken professor to win over conservative voters who, reluctant to lose yet another close election, are considering a far-right adventure.