Latin America’s largest democracy will hold what some consider the most critical election in its history on Sunday, with a far-right populist notorious for his hostility to gays, refugees, ethnic minorities and the environment leading the race to become Brazil’s next president.

Jair Bolsonaro, a self-styled political outsider who basks in comparisons with Donald Trump, topped polls with about 35% of intended votes on Friday as 147 million Brazilians prepared to elect their new leader, as well as 27 state governors, and nearly 1,600 lawmakers.

Profile Who is Jair Bolsonaro? Show Biography Born in Glicério in São Paulo in 1955 to parents of Italian descent, he served in the army from 1971 until 1988, when he was elected as a city councillor in Rio de Janeiro for the Christian Democratic party. In 1990, he became a federal congressman for the same party. He has since been affiliated with a number of political parties. On 22 July, he was officially nominated as the presidential candidate of the Social Liberal party. Policies Bolsonaro espouses populist and nationalist views that often stray into far-right territory. A vocal opponent of same-sex marriage, abortion, immigration and other progressive causes, he has defended the death penalty and the 1964-85 military dictatorship. On foreign policy, he has said he wants to improve relations with the US. Economically he says he is pro free market and privatisation. Political style Deliberately provocative and polarising. He has praised Gen Pinochet, expressed support for torturers and called for political opponents to be shot, earning him the label of "the most misogynistic, hateful elected official in the democratic world”. In his bid to capitalise on Latin America’s lurch to the right, he paints himself as a tropical Donald Trump: a pro-gun, anti-establishment crusader set on "draining the swamp" and cracking down on violent crime. Controversies On top of repeated calls for a return to dictatorship, he has made equally inflammatory attacks on women, black people, gay people, foreigners and indigenous communities. Earlier this year, he was charged by the attorney general with inciting hate speech. Support and first round victory Bolsonaro has a devout following among some conservative voters, who admire his promises to get tough on rampant violent crime, and won 46% of the vote in the election's first round. Photograph: Evaristo Sa/AFP

“This is the most important election in the history of Brazil,” said James N Green, the director of Brown University’s Brazil Initiative. “There is just no other time at which voters’ decisions will determine the fate of the country and its direction [to such an extent] … We are at a moment in which a conservative, rightwing pro-fascist-type person is possibly going to be the president,” added Green, the author of several books on Brazil’s 1964-85 dictatorship.

“I don’t even want to imagine what that is going to be like [if he wins] … It would be the beginning of the end of democracy.”

Hoping to foil Bolsonaro, a 63-year-old ex-paratrooper, is the former São Paulo mayor Fernando Haddad, who is lying second in the polls. Haddad, 55, replaced jailed former president Luiz Inácio Lula da Silva as the Workers’ party (PT) candidate last month after Lula was forced to drop out of the race.

With Brazil struggling to escape its worst ever recession with 13 million unemployed, Haddad has promised a return to the golden days of economic boom under Lula, who was president from 2003 to 2011.

“We want to be happy again,” Haddad told the Guardian last week. “We have learned Brazil can develop in a way that includes people rather than excluding them. My dream is that Brazil starts to include people again.”

Haddad had seemed to be gaining ground on Bolsonaro but the latest polls give him about 22% of intended votes, suggesting his campaign may have stalled, while Bolsonaro has opened up a 13-point lead.

Bernardo Mello Franco, a columnist for the O Globo newspaper, said those polls had punctured a growing mood of euphoria in Haddad’s camp and left PT officials – some of whom had already started discussing Haddad’s future cabinet – “dumbstruck”.

Some observers are even pondering the possibility, previously considered fanciful, that Bolsonaro could claim a first-round victory on Sunday by winning an outright majority. If no candidate gets more than 50% of the vote, a runoff between the top two will be held on 28 October.

“He can win in the first round. It is difficult but not impossible,” said Paulo Baía, a political scientist from Rio de Janeiro’s Federal University, who believes that could happen if voters ditch less popular candidates such as the former environment minister Marina Silva and the centre-right Geraldo Alckmin.

The prospect of Bolsonaro – who has praised dictatorship and called gay people abnormal, women “tramps” and refugees “the scum of the earth” – has horrified progressive Brazilians and members of its LGBT community.

“The violence will get worse and become more visible, not just for LGBTs but for everyone,” predicted Alessia Almeida, a 40-year-old transsexual and community leader in Rio. “We live in a democracy and I want to continue living in a democracy.”

Green said a Bolsonaro victory would undo decades of political and social advances since democracy was restored in 1985 and risked a return to military rule. “It is just an amazingly dangerous moment for everything that has been achieved,” he said.

“I’m really hesitant to make analogies with the 1930s – but similar things happened to Germany. We know Hitler came to power through legitimate forces.

“We have a tradition of dictatorships in Brazil – we’ve had two of them, one from [19]38 to 45 and another from 64 to 85. These are not things that could not happen. They can happen. They could happen.”

But millions of Bolsonaro supporters, who include many evangelical Christians, are cheering his social-media propelled rise. They hail him as an anti-establishment crusader who will restore conservative family values and tackle corruption, communism and soaring crime.

“Every robbery is one more vote for Bolsonaro,” said Daniela Gouveia, 47, an entrepreneur and actor from the north-eastern city of Recife.

Tens of thousands of protesters have joined anti-Bolsonaro “not him” demonstrations with strong echoes of the 2017 Women’s March on Washington against Trump. Further protests are scheduled for Saturday.

Gouveia claimed Bolsonaro was “a true defender of women”, not their enemy. “Rightwing women don’t care about being empowered – they already are powerful … There’s nothing about Bolsonaro that threatens us,” she said. “When we can carry guns, and know we have a president who has no time for rapists, that’s when I’ll feel safe.”

Retired general Aléssio Ribeiro Souto, a member of Bolsonaro’s military-dominated campaign team, rubbished what he called phony “narratives” painting his candidate as anti-democratic.

“He is not a threat to democracy,” Ribeiro Souto told the Guardian. “If he is elected – and I think he will be – he will be a force for Brazil, as South America’s biggest country, to consolidate itself as one of the world’s greatest democracies.”

In a 25-minute television interview on Thursday night from his Rio home, where he is recovering from his recent stabbing, Bolsonaro declared: “We’ve got to give socialism – communism – a kick up the bum. We can’t allow this ideology into Brazil.”

Bolsonaro also rejected claims he was a chauvinist. “Am I really that bad? So bad that I wish everyone ill: women, blacks, north-easterners … the poor? It’s not true!”

In a nearby television studio, Bolsonaro’s rivals assembled for the final presidential debate, which the frontrunner had claimed he was not well enough to attend.

In the night’s most impassioned declaration, the socialist Guilherme Boulos warned Bolsonaro’s “gang of hate” risked plunging Brazil back into authoritarianism. “It has been 30 years since this country emerged from a dictatorship. Many people died. Many were tortured. To this day there are mothers who still haven’t been able to bury their children … [and] we’ve never been so close to what happened back then.

“The time has come for us to pause, find our voices and say: ‘dictatorship never again!’” Boulos concluded, to loud applause.