Rio De Janeiro: Veteran leftist Luiz Inacio Lula da Silva won a new term as Brazilian president Sunday, capping a remarkable political comeback to defeat far-right incumbent Jair Bolsonaro in a deeply divisive, down-to-the-wire runoff election.
All eyes will now be on how Bolsonaro and his supporters react to the official result, after months of alleging - without evidence - that Brazil's electronic voting system is plagued by fraud and that the courts, media and other institutions have conspired against his far-right movement.
The victory marks a stunning turnaround for ex-metalworker Lula: he left office in 2010 as the most popular president in Brazilian history, fell into disgrace when he was imprisoned for 18 months on controversial, since-quashed corruption charges, and now returns for an unprecedented third term at age 77.
Bolsonaro, the vitriolic hardline conservative dubbed the "Tropical Trump," meanwhile becomes the first incumbent president not to win re-election since Brazil returned to democracy at the end of its 1964-1985 military dictatorship.
Electoral officials declared the election for Lula, who had 51 percent of the vote to 49 percent for Bolsonaro with more than 99 percent of polling stations reporting.
Decked out in the red of Lula's Workers' Party (PT), supporters exploded into celebration in cities across the country, setting off colorful fireworks in Rio de Janeiro and erupting into huge cheers in Sao Paulo.
A grinning Lula greeted euphoric supporters in Sao Paulo, the economic capital, and tweeted a single word: "Democracy," alongside a picture of the Brazilian flag.
In tears, Bolsonaro supporters in the green and yellow of the flag - which the ex-army captain has adopted as his own - meanwhile fell to their knees to pray for a reversal, gathered outside the seat of government in the capital, Brasilia.
Bolsonaro surged to victory four years ago on a wave of outrage with politics as usual, but came under fire for his disastrous handling of the Covid-19 pandemic, which left more than 680,000 dead in Brazil, as well as a weak economy, polarizing style and attacks on democratic institutions.
Many fear a Brazilian remake of the Capitol riots that rocked the United States after the 2020 election loss of Bolsonaro's political role model, Donald Trump.
Regardless of how Bolsonaro reacts, Lula will face huge challenges from the day he is inaugurated on January 1.
Bolsonaro's far-right allies scored big victories in legislative and governors' races in the first-round election on October 2, and will be the largest force in Congress.
Lula said after voting in Sao Bernardo do Campo, the southeastern city where he rose to prominence as a union leader, that he would work to heal the wounds left by the polarizing campaign.
"One of the dreams that made me become a candidate in this election was to restore peace among Brazilians," he told journalists, dressed in a white shirt and surrounded by white-clad allies.
The campaign descended into an orgy of mudslinging, attack ads and disinformation, especially on the all-important battleground of social media.
The muck left little space for actual issues, such as the economy, rampant destruction of the Amazon rainforest and the 33 million Brazilians living in hunger.
Lula inherits a deeply divided country, with a hugely difficult global economic situation that looks nothing like the commodities "super-cycle" that allowed him to lead Latin America's biggest economy through a watershed boom in the 2000s.
Lula's win is "one of the biggest comebacks in modern political history," tweeted Brian Winter, editor-in-chief of Americas Quarterly.
But the charismatic-but-tarnished left-wing icon will also have "a weak government," Winter told AFP.
The result heralds "an attempt to dial back the clock to the 2000s," he said.
"The problem is that you can't repeat the past. Brazil has a very strong, resurgent conservative movement. Lula will be under the microscope from day one, and facing a hostile Congress."
None of that mattered for the time being to elated Lula supporters.
"Brazil is starting to stand upright again after four years of darkness. We were going through so many problems, so much fear," Larissa Meneses, a 34-year-old developer, told AFP at a joyful victory party in Sao Paulo.
"Now with Lula's victory, I really believe things will start getting better. This is a day to laugh a lot."