Brazilians are choosing their leaders on Sunday in an election marked by intense anger at the ruling class following years of political and economic turmoil.
Many figured that "throw-the-bums-out" rage would produce an outsider.
But the man who has benefited most from voter anger is a 27-year veteran of Congress — Jair Bolsonaro. His outsider status is based largely on hard-right positions that have alienated as many as they have attracted — nostalgia for a military dictatorship, insults to women and gay people and calls to fight crime by loosening controls on already deadly police forces.
Prison and hospital: primary battle grounds in Brazil's election race
[ Brazil’s firebrand candidate gets party nod for top job ]
Brazilians choose among 13 candidates for president on Sunday in one of the most unpredictable and divisive elections in decades. If no one gets a majority in the first round, the top two candidates will compete in a runoff.
Mr Bolsonaro leads in polls despite having been unable to campaign in person since early September due to a stabbing.
Second in the polls is former Sao Paulo Mayor Fernando Haddad of the Workers' Party.
Here's a look at the five top contenders, according to polls:
With former President Luiz Inacio Lula da Silva barred from running by electoral authorities following a corruption conviction, far-right congressman Bolsonaro leads the polls. The former army captain has tapped into deep unease in Brazil, which is reeling from a sweeping corruption scandal and is struggling to grow again after a protracted recession. Mr Bolsonaro has expressed nostalgia for the 1964-1985 military dictatorship, has been repeatedly fined for offensive comments and has made cracking down on crime a centerpiece of his campaign. But his proposals and his fiery rhetoric have often repulsed as many Brazilians as they have attracted.
He has seen support growing in the polls despite little television advertising and being hospitalised for weeks after a stabbing. Mr Bolsonaro was discharged from the hospital on 29 September.
The former Sao Paulo mayor surged into second place after being named last month to replace Mr da Silva as the candidate of the left-leaning Worker's Party. Mr Haddad was a political science professor and education minister as well as mayor. He wasn't prominent nationally until the election and was unpopular enough in Sao Paulo that he lost in the first round when he ran for re-election in 2016 –an unusually decisive defeat for an incumbent.
He has depended heavily on Mr da Silva's endorsement and polls indicate he's neck and neck with Mr Bolsonaro in a likely runoff.
The left-leaning Ciro Gomes has roots in Mr da Silva's stronghold of the northeast and brings extensive experience, having served as governor, mayor, cabinet minister and federal congressman. Yet he also appeals to voters who are disgusted with dirty dealings so common in Brazilian politics, touting the fact that he has remained clean, despite decades in public service.
Still, Mr Gomes has a reputation for being prickly and making controversial statements and he's struggled to rally the left behind him and has in low double-digits in recent polls.
A three-time governor of Sao Paulo, Brazil's largest and richest state, Mr Alckmin has a lot of executive experience. The right-leaning candidate supports market-friendly economic policies, like scaling back the country's faltering social security system, making him the darling of investors.
But Mr Alckmin lacks charisma, and he has struggled to peel off votes from Mr Bolsonaro, despite devoting much of his extensive free television ad time to attacks on the congressman. Polls show him with single-digit support.
Ms Silva, who once served as Mr da Silva's environment minister, has a dramatic personal story: She suffered numerous illnesses and often went hungry as a child. She didn't learn to read and write until her teens. Ms Silva nearly upended the last presidential race when her party's candidate died during the campaign and she took his place: She initially surged in polls, tapping into voter discontent and attracting Brazilians on both the left and right.
But she has struggled to define herself, beyond her focus on environmental issues, and her poll numbers have been sliding in recent weeks.