Cristina Gozdal turned out to vote on Sunday morning wearing the yellow and green colours of Brazil’s national flag and hoping her country was on the verge of electing its very own Donald Trump.

“He thinks like the people think,” Gozdal, a 45-year-old systems analyst, said of Jair Bolsonaro, the far right’s favourite to become Brazil’s next leader, as she cast her vote a few blocks from Rio de Janeiro’s Copacabana beach.

Around Gozdal, outside Rio’s Infante Dom Henrique school, other voters chimed in with their support of the former paratrooper and professional polemicist who stood on the verge of leading the world’s fourth-largest democracy despite – or perhaps because of – his infamously venom-filled tongue and his oft-voiced nostalgia for dictatorship.

Brazil’s fearful LGBT community prepares for a ‘proud homophobe’

Read more

On the eve of the election, polls gave Bolsonaro an 8-10% advantage over his leftist rival, Fernando Haddad, although the Workers’ party (PT) candidate had been gaining ground in recent days.

Monica Gamero, a 48-year-old civil servant, said she believed Bolsonaro would improve education and clamp down on crime. “Our country is in moral, cultural and security disorder,” she complained.

Pensioner Denir Quintanilha said he was voting out of anger at the PT, which critics blame for leading Brazil into economic meltdown and a quagmire of corruption. “We are totally against the PT,” said the 65-year-old.

Elisabete Pereira, a 56-year-old estate agent, said Brazilians were sick of being governed by “thieves”.

But there was also concern outside the polling station about the consequences of electing a populist provocateur notorious for praising Brazil’s 1964-85 military regime and foreign autocrats including Peru’s Alberto Fujimori and Augusto Pinochet of Chile.

Many said they were backing Haddad not because they were loyal PT voters but because they were afraid of Bolsonaro’s extreme positions. “I voted Haddad because I am really worried what could happen if the other one wins,” said Paul Pichnoff, a 41-year-old engineer.

Adolfo Castro, a 20-year-old auditor, agreed. “In the current climate, we are scared of a candidate like this.”

Three hundred miles west, in São Paulo’s largest favela, Heliópolis, those fears were even more stark.

Leda dos Santos said she was firmly opposed to a man she and millions of others feared would wreck their country’s young democracy. “I believe [we can stop him],” the 41-year-old toy factory worker said. “I have faith. God will help us – because this man is a monster.”

Voters wait in line outside a polling station in Rio’s Maré favela on Sunday. Photograph: Ricardo Borges/AP

That was a commonly held sentiment in the sprawling red-brick community in the south of Brazil’s economic capital, with the area home to an estimated 100,000 people. After casting his vote for Haddad at Gonzaguinha primary school, Antonio da Silva Lima, a bricklayer, said he was rooting for a reversal that would prevent Bolsonaro plunging Brazil back into authoritarianism.

“I lived through the dictatorship and we don’t want to go back to that. It’s dangerous,” said Lima, 61. “I know what dictatorship means. It means torture, do you know what I’m saying?”

Andonias Albuquerque, a 37-year-old driver, said he was also voting against Bolsonaro. “Nothing that comes out of his mouth pleases me,” he said as his wife nodded in agreement. “If you ask him about education he talks about the economy, if you ask about the economy he talks about security … Haddad is the only one with actual proposals.”

Francisco Rodrigues, 33, foresaw a return to the bad old days of poverty and police repression should Bolsonaro emerge victorious. “Dirt roads and police humiliation,” he predicted, recalling occasions in the past when he had been forced to walk past bullet-riddled corpses on his way to work.

João Victor, an 18-year-old doorman, was worried that Bolsonaro would scrap affirmative action programmes introduced during 13 years of PT rule that have helped young black slum residents go to university. “We have criticisms of the PT but we have to defend democracy … We support love and peace.”

Genilce Gomes, a 51-year-old teacher, said Heliópolis was also home to Bolsonaro voters, many of whom had been convinced to support him by their pastors’ sermons. “There’s a big evangelical influence,” Gomes said. “But many [Christians] are waking up to the fact that what he preaches goes completely against what is in the Bible.”

During his visit to Heliópolis on Saturday, Haddad told reporters he believed voters were becoming aware of the “leap into the dark” his radical opponent represented. “He is a truculent and dangerous person,” said Haddad, who only officially became the PT candidate last month after the jailed former president Luiz Inácio Lula da Silva was barred from running.

Aloízio Mercadante, a veteran PT figure and Brazil’s former chief of staff, told the Guardian he was confident of a turnaround. “The other side is on the defensive … we are on the offensive,” he said.

With Brazil struggling to emerge from an unprecedented recession and shake off a vast corruption scandal, Mercadante said he understood voters were angry with politicians but said Bolsonaro represented “the worst possible adventure that Brazilian democracy could have to go through”.

But Haroldo Carrilho, a popcorn salesman who had parked his cart outside the Gonzaguinha school, said that even in Heliópolis, a traditional PT stronghold, some were so fed up with their political leaders they were willing to take the risk.

“In Lula’s day the whole favela was PT,” said Carrilho, 58. Now many were shifting to Bolsonaro, he said, because the PT had lost touch with the poor. “They abandoned us.”