As recently as two months ago, few people in Brazil other than Jair Bolsonaro's most ardent supporters believed the far-right congressman had more than an outside shot of winning the race to lead Latin America's largest nation.
Bolsonaro was declared the next president of Brazil on 29 October by the country's Supreme Electoral Tribunal.
However, his history of comments offensive to women, blacks and gays, combined with his praise of the 1964-1985 military dictatorship and a largely unremarkable 27 years in Congress created the general impression that, even if he survived the first round of voting, he would ultimately be defeated against almost any competitor in the second round.
But then several things happened that helped elevate the former army captain to front-runner: Bolsonaro got stabbed and nearly died, traditional coalitions on the left and right collapsed and it became apparent that social media had replaced television airtime as the most dominant force in the elections.
Those events reverberated in a nation hungry for radical change after years of turmoil that provoked rage at the ruling class.
In the first round of voting on 7 October, Bolsonaro performed far beyond expectations, nearly winning outright with 46 percent of the vote, compared with 29 percent for Fernando Haddad of the Workers' Party. Polls ahead of Sunday's runoff showed him with 56 percent of voter intentions compared with 42 percent for Haddad.
Through it all, Bolsonaro’s simple campaign promises to clean up corruption and confront rising crime with brutal force have resonated with a population hungry for new approaches.
"How did Donald Trump become president in the United States?" said Carlos Manhanelli, political marketing specialist and chairman of the Brazilian Association of Political Consultants. "It's basically the same thing. Bolsonaro is speaking to the minds of voters. He isn't worried about being politically correct."
For Bolsonaro, His Near-Death Experience Gave His Campaign a Boost
While all 13 presidential candidates were maneuvering for a final push, the race was upended on 6 September, when Bolsonaro was stabbed while campaigning in Juiz de Fora, a small city 125 miles (200 kilometers) north Rio de Janeiro.
The man arrested, Adelio Bispo de Oliveira, appears to have acted alone and was mentally ill. According to police, he said he attacked on God's orders.
For Bolsonaro, the near-death experience gave his campaign a huge boost. Although he was hospitalized for three weeks and couldn't campaign in the streets, his ordeal dominated media coverage. That was particularly significant for a candidate who was only allotted a few seconds of free television airtime each day.
Instead of having to debate or defend his ideas, Bolsonaro stayed in his hospital bed and continued to hammer away at his campaign themes via Facebook Lives and Twitter.
His campaign kept all but friendly media companies from visiting him and announced he would skip several debates on doctors' orders. Even after being discharged in late September, Bolsonaro avoided debates during the last month, citing his health.
Haddad tried to shame Bolsonaro into debating, saying he would be willing to meet his rival anywhere. He and supporters also forcefully argued that Bolsonaro represented a clear risk to Brazil's young democracy. But those concerns appear to have been largely drowned out on social media, where Bolsonaro's campaign outmaneuvered Haddad's.
Beyond numerous daily posts and tweets by Bolsonaro and his three older sons, all politicians, the campaign has undertaken a massive effort on messaging service WhatsApp.
In recent weeks, Brazilians have been bombarded by messages that extol Bolsonaro and condemn Haddad, often making outrageous claims.
Along the way, Bolsonaro's campaign may have broken campaign finance laws. An investigative report by the daily newspaper Folha de S. Paulo last week alleged that friendly businessmen were bankrolling the WhatsApp effort, leading to an investigation by the electoral court. Bolsonaro has been responding ever since with the kinds of aggressive tweets and videos that thrill supporters.
The newspaper "is Brazil's biggest fake news," Bolsonaro said in a video transmitted Sunday to supporters at a rally. "You guys will not get any more government advertising money. Sold out press, my condolences."
(This article has been edited for length.)
. Read more on World by The Quint.RSS & BJP’s Nehru-Netaji ‘Cosplay’: Irony Dies a Thousand DeathsHow Bolsonaro Rose from Far-Right Long-Shot to Brazilian President . Read more on World by The Quint.