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.