SAO PAULO (AP) — Brazilians on Sunday were weighing their hunger for radical change against fears that the presidential front-runner could threaten democracy as they cast ballots in the culmination of a bitter campaign that split many families and was frequently marred by violence.

Far-right congressman Jair Bolsonaro has won over many voters by painting a picture of a Brazil at war — with criminals, corrupt politicians and leftist ideas that he says could turn the country into Venezuela — and promises to change the tide with force and clean governance.

Recent polls showed Bolsonaro with an 8 to 10 point lead over his rival, leftist candidate Fernando Haddad of the Workers’ Party. Several key endorsements late Saturday gave Haddad’s camp hope that they could still pull out a victory.

“I am confident we can win,” said Haddad after voting. “There are many democratic voices that could have been silent and have spoken in our favor.”

On Saturday, a popular former supreme court justice, Joaquim Barbosa, tweeted support for Haddad, saying Bolsonaro’s candidacy scared him. Likewise, former Attorney General Rodrigo Janot, one of the biggest crusaders against corruption in Haddad’s Workers’ Party in recent years, endorsed Haddad for similar reasons.

One of the most important endorsements, particularly for young people, came from Youtuber Felipe Neto, whose channel has nearly 27 million followers.

Neto said he was troubled by Bolsonaro’s comments a week ago that “red” leftists would be run out of Brazil.

“In 16 years of the (Workers’ Party), I have been robbed, but never threatened,” Neto said by Twitter.

Bolsonaro, a former army captain with a lackluster record in Congress over 27 years, rose in prominence amid disgust with Brazil’s political system after a massive corruption scandal and a prolonged recession. In particular, many Brazilians are furious with the Workers’ Party for its role in the graft scheme, known as “Carwash” and Haddad has struggled to build momentum with his promises of a return to the boom times by investing in health and education and reducing poverty.

“If you have three crises happening at the same time — economic, political and moral, ethical in a way — I think you create a scenario which is perfect for outsiders and authoritarian, fringe candidates,” said Oliver Stuenkel, an associate professor of international relations at the Fundacao Getulio Vargas university in Sao Paulo. “It’s not unlikely that we’ll see an erosion of Brazil’s democracy. We’re already seeing it now.”

Many in Brazil and beyond have expressed concerns about a rollback of civil rights and a weakening of institutions in what remains a young democracy, especially since Bolsonaro has waxed nostalgic for Brazil’s 1964-1985 military dictatorship and said he would name military men to his Cabinet.

More than a dozen U.S. Democratic congressmen have written a letter urging Secretary of State Mike Pompeo to make clear that American aid to and cooperation with Brazil “is contingent on the upholding of basic human rights and democratic values by its leaders.”

The past few years in Brazil have been exceptionally turbulent. In 2016, then-President Dilma Rousseff of the Workers’ Party was impeached and removed from office on charges that many on the left felt were politically motivated. The economy suffered a two-years-long recession and is only beginning to emerge, with growth stagnant and unemployment high. And scores of politicians and executives have been jailed in the Carwash corruption investigation that uncovered a multi-billion-dollar scheme to trade public contracts and official favors for bribes and kickbacks.

That instability unleashed extreme anger with the political class but also revealed deep divisions in Brazilian society, and this campaign was the most polarized in decades. There were numerous reports of politically motivated violence, especially directed at gay people, whom Bolsonaro has disparaged. Bolsonaro himself was stabbed and almost died at a campaign event in early September.

“I’m not crazy about Bolsonaro. But he is our way to keep the Workers’ Party out of office,” said Rafaela Rosa, a 32-year-old teacher, after voting Sunday in Sao Paulo. “We have had enough corruption and now we need to clean up.”

Many observers predicted that a newcomer would emerge to harness that anti-establishment anger. Instead, support coalesced around Bolsonaro, who both is and isn’t an outsider: He has served for nearly three decades in Congress, but he has often been at the margins of that institution and he painted himself as just the strong man Brazil needed to dismantle a failing system. Bolstering his rebel image is his reputation for offensive statements and sometimes extreme views, including insulting women, gays and blacks.

Bolsonaro’s campaign first gained traction with his promises to go after violent crime in a country that leads the world in homicides and where many Brazilians live in daily fear of muggings or burglaries. But his vows to loosen gun laws and give police a freer hand to use force against suspects have also raised concerns that a Bolsonaro presidency could lead to a bloody crackdown and an erosion of civil rights.

The campaign gained momentum by winning over much of the business community with promises of enacting market-friendly reforms that would reduce the size of the Brazilian state, including cutting ministries and privatizing state companies.

Haddad has taken the opposite tack, promising to double-down on investment in education, health and social programs, arguing that the gains Brazil made in reducing poverty during the boom years have eroded and the poorest are suffering.

“I still have hope Haddad can turn this around,” said Mario Victor Santos, 58, former ombudsman for the newspaper Folha de S. Paulo, which Bolsonaro has repeatedly claimed spread “fake news” about him. “And if Haddad doesn’t (win), we have given evidence that the resistance to a Bolsonaro administration will be very stiff.”

___

Prengaman contributed from Rio de Janeiro.