(BBC) Far-right candidate Jair Bolsonaro has won a sweeping victory in Brazil’s presidential election.
With almost all of the votes counted, Mr Bolsonaro has 55% of the votes against 45% for Fernando Haddad from the left-wing Workers’ Party.
Mr Bolsonaro campaigned on a promise to eradicate corruption and to drive down Brazil’s high crime levels.
The election campaign has been deeply divisive. Each camp argued that victory for the other could destroy Brazil.
What does it mean?
Mr Bolsonaro’s victory constitutes a markedly rightwards swing in the largest democracy in Latin America, which was governed by the left-wing Workers’ Party for 13 years between 2003 and 2016.
For the past two years, the country has been led by a conservative, Michel Temer, following the impeachment of President Dilma Rousseff. But Mr Temer has proven deeply unpopular with Brazilians.
With the outgoing president’s approval rating at a record low of 2%, voters clamoured for change but they were deeply divided on which way that change should go.
Mr Bolsonaro’s convincing 10-percentage-point victory means the vision he laid out to voters of a Brazil where law and order and family values would be made the priority won out.
What did Mr Bolsonaro say after winning?
In his victory speech, Jair Bolsonaro said his government would be a “defender of democracy and the constitution”.
He added: “This is not the promise of a party, nor the word of a man. It is an oath before God.”
He went on to tell his cheering supporters: “The commitment I assumed with the Brazilian people was to create a decent government, committed to the country and the people. And I guarantee you that I will.
“We will change Brazil’s destiny together.”
Critics of Mr Bolsonaro are worried that the former army captain, who has expressed nostalgia for the years Brazil was under military rule, may curtail citizens’ freedoms and undermine Brazil’s constitution.
They are also worried about the rights of minorities following homophobic, racist and misogynistic remarks Mr Bolsonaro made during the campaign and before.
What did Mr Haddad say?
Fernando Haddad said he had “a responsibility to join the political opposition” against Mr Bolsonaro and promised to “defend the freedoms of those 45 million people” who voted for him.
How did the vote break down?
Mr Haddad won in the north-east of Brazil, the heartland of the Workers’ Party and the stronghold of former President Luiz Inácio Lula da Silva, whom Mr Haddad replaced on the Workers’ Party ticket after Lula was barred from running due to his corruption conviction.
But Mr Bolsonaro won in all other parts of the country, and in some of them by a very large majority, ultimately giving him a sweeping overall victory.
How did Bolsonaro’s supporters react?
His supporters were jubilant with some taking to the streets outside his home in Rio de Janeiro to let off fireworks and wave Brazilian flags.
“Brazil is partying. Brazil’s good people are celebrating,” Carmen Flores, a local leader of Bolsonaro’s PSL party said.
“All these people here are outraged, upset about corruption and crime, and we are with Bolsonaro. The people have spoken. For the first time I feel represented,” Andre Luiz Lobo, 38, told Agence France Press news agency.
What is he likely to do once in office?
Mr Bolsonaro takes office on 1 January 2019.
One of his flagship campaign promises was to increase security for Brazilian citizens. He has portrayed himself as a hardliner who will restore safety to Brazil’s streets.
He has indicated that his government will aim to relax laws restricting the ownership and carrying of guns.
His economic policy plans include proposals to reduce government “waste” and promises to reduce state intervention in the economy.
He has suggested that Brazil could pull out of the 2015 Paris Agreement on climate change, arguing that its requirements compromise Brazil’s sovereignty over the Amazon region.
Mr Bolsonaro has also said that he will “cleanse” Brazil of corrupt politicians, a campaign promise which was very popular with Brazilians who say they are tired of the corruption which has seen dozens of high-ranking politicians from the established parties jailed.