Brazil’s president-elect Jair Bolsonaro has promised to uphold the constitution following his election victory, in response to fears the far-right leader threatens the nation’s democratic institutions.

International human rights groups and defeated left-wing rival Fernando Haddad have warned of a looming crackdown on civil liberties as the country moves sharply to the right.

Mr Bolsonaro, who won just over 55 per cent of the votes on Sunday, tried to allay fears about his win, saying he would “pacify” Brazil following an election campaign repeatedly marred by violence.

“This country belongs to all of us, Brazilians by birth or by heart, a Brazil of diverse opinions, colours and orientations,” he said. Mr Bolsonaro also said he wanted “to change the destiny of Brazil”.

The ex-army captain – dubbed “Trump of the Tropics” – has spoken fondly of Brazil’s former military dictatorship and said socialists would have to “go to jail” if he won.

He has also made comments in support of torture and has vowed to appoint military generals to his cabinet.

Mr Haddad, who took just under 45 per cent of the votes, promised to fight for human rights and the rule of law.

“We have the responsibility to mount an opposition, putting national interests, the interests of the entire Brazilian people, above everything,” the Workers’ Party candidate told supporters.

“Brazil has possibly never needed the exercise of citizenship more than right now.”

Supporters of left-wing candidate Fernando Haddad react to his defeat (AFP/Getty) (AFP/Getty Images)

International rights groups have expressed concerns about the far-right congressman’s victory.

Human Rights Watch called on Brazil’s judiciary and other institutions to “resist any attempt to undermine human rights, the rule of law and democracy under Jair Bolsonaro’s government”.

Erika Guevara-Rosas, Americas Director at Amnesty International, said Mr Bolsonaro’s victory “could pose a huge risk to Indigenous Peoples and quilombolas, traditional rural communities, LGBTI people, black youth, women, activists and civil society organisations, if his rhetoric is transformed in public policy.”

Mr Bolsonaro built his popularity on hardline law and order positions. The 63-year-old congressman had vowed to crack down on crime by granting police more autonomy to shoot at criminals.

His campaign also tapped into widespread anger at the political class after years of corruption, an economy that has struggled to recover from a punishing recession and a surge in violence.

Many Brazilians were furious with the Workers’ Party for its role in the graft scheme revealed by the “Operation Car Wash” investigation, which uncovered billions of dollars in bribes paid to politicians via inflated construction contracts.

Brazil election: far-right candidate Jair Bolsonaro wins Presidency Show all 8 1 /8 Brazil election: far-right candidate Jair Bolsonaro wins Presidency Brazil election: far-right candidate Jair Bolsonaro wins Presidency A man holds an inflatable figure of jailed former president Luiz Inacio Lula da Silva as supporters of far-right presidential candidate Jair Bolsonaro celebrate in front of the National Congress in Brasilia, after the former army captain won Brazil's presidential election AFP/Getty Brazil election: far-right candidate Jair Bolsonaro wins Presidency Supporters of the left-wing presidential candidate for the Workers Party (PT), Fernando Haddad, react in Rio AFP/Getty Brazil election: far-right candidate Jair Bolsonaro wins Presidency Police officers patrol the streets during a gathering of supporters of the left-wing presidential candidate for the Workers Party AFP/Getty Brazil election: far-right candidate Jair Bolsonaro wins Presidency Fernando Haddad, presidential candidate of Brazil's leftist Workers Party (PT), is kissed by his wife Ana Estela Haddad Reuters Brazil election: far-right candidate Jair Bolsonaro wins Presidency epa07128316 Supporters of Socialist candidate Fernando Haddad react after he was defeated by far-right candidate Jair Bolsonaro, in Rio de Janeiro, Brazil, 28 October 2018. With 99.4 percent of ballots counted, Bolsonaro won the second round of the elections with 55.1 percent of the votes, compared to 44.9 percent obtained by Fernando Haddad, successor of Luiz Inacio Lula da Silva and candidate of the PT, or Workers Party. EPA/JULIO CESAR GUIMARAES JULIO CESAR GUIMARAES EPA Brazil election: far-right candidate Jair Bolsonaro wins Presidency Supporters of the left-wing presidential candidate for the Workers Party (PT), Fernando Haddad, react in Rio de Janeiro, Brazil, after the far-right candidate Jair Bolsonaro won Brazil's presidential election, in Rio de Janeiro, Brazil, on October 28, 2018. - Far-right former army captain Jair Bolsonaro was elected president of Brazil on Sunday, beating leftist opponent Fernando Haddad in a runoff election after a bitter and polarized campaign. Official results gave the controversial president-elect 55.18 percent of the vote with more than 99.7 percent of the ballots counted. (Photo by Daniel RAMALHO / AFP)DANIEL RAMALHO/AFP/Getty Images DANIEL RAMALHO AFP/Getty Images Brazil election: far-right candidate Jair Bolsonaro wins Presidency Supporters of far-right presidential candidate Jair Bolsonaro, celebrate in front of the National Congress in Brasilia, after the former army captain won Brazil's presidential election, according to official results that gave him 55.7 percent of the vote, on October 28, 2018. - Far-right former army captain Jair Bolsonaro was elected president of Brazil on Sunday, beating leftist opponent Fernando Haddad in a runoff election after a bitter and polarized campaign. Official results gave the controversial president-elect 55.18 percent of the vote with more than 99.7 percent of the ballots counted. (Photo by Sergio LIMA / AFP)SERGIO LIMA/AFP/Getty Images SERGIO LIMA AFP/Getty Images Brazil election: far-right candidate Jair Bolsonaro wins Presidency Supporters of Jair Bolsonaro gather outside the Federal Police headquarters where Brazilâ€™s former President Luiz Inacio Lula da Silva is serving a prison sentence, after Bolsonaro wins the presidential race in Curitiba, Brazil October 28, 2018. REUTERS/Rodolfo Buhrer RODOLFO BUHRER REUTERS

But Mr Bolsonaro’s candidacy also raised serious concerns that he would roll back civil rights and weaken institutions in what remains a young democracy.

He has frequently disparaged women, gays and blacks, and vowed to appoint military men in his cabinet. Mr Bolsonaro has a long history of offensive statements about immigrants, black Brazilians and gay people.

In a speech made last year, Mr Bolsonaro spoke about a black settlement founded by the descendants of slaves. “They do nothing. They are not even good for procreation,” he said.

Mr Bolsonaro has also repeatedly said he would pull Brazil from the Paris agreement on climate change, but last week he backed off on that.

In Rio de Janeiro, thousands of Mr Bolsonaro’s supporters gathered on iconic Copacabana Beach to celebrate on Sunday night. There were also reports of clashes between his backers and opponents in Sao Paulo.