He has praised this era, in which thousands of people were imprisoned and tortured, as a "glorious period".

"I am in favour of torture - you know that," he said during a television appearance in 1999. "And the people are in favour of it, too."

Law and order

During his seven terms in Congress, in which he largely remained a fringe political figure, his priorities evolved beyond the military.

He has focused on the broader issues of public safety and law and order, which made him popular with many voters in crime-wracked Brazil.

Image copyrightEPAImage caption
Supporters of Mr Bolsonaro, who has promised to relax gun laws, pose with a paper gun

In 2017, he controversially said that "a policeman who doesn't kill isn't a policeman".

On the campaign trail he reinforced his position as a hardliner who aimed to restore safety to the streets.

"Safety is our priority! It is urgent!" he wrote on Twitter.

"People need jobs, they want education, but it's no use if they continue to be robbed on the way to their jobs; it's no use if drug trafficking remains at the doors of schools."

On this issue, he has pledged to reduce crime and increase security by relaxing the country's gun laws.

Just days before taking office, he tweeted about plans to ensure that any citizen without a criminal record would be permitted to possess a firearm, and said he would work to "fight the Marxist trash" he claimed was being taught in schools.

'Trump of the Tropics'

Some media have nicknamed him the "Trump of the Tropics", comparing his anti-establishment populist style and social media presence to that of the US leader.

Mr Bolsonaro campaigned as a nationalist and among the comparisons with the US president include his promise to move Brazil's embassy in Israel to Jerusalem as he looks to strengthen ties with the country.

Israeli Prime Minister Benjamin Netanyahu, who was in Brasilia for Mr Bolsonaro's inauguration, said just hours ahead of the ceremony that Brazil's president-elect had told him that the move was a matter of "when, not if".

A provocative figure

One of the candidates who ran against him in the first round of the presidential elections, Ciro Gomes, went as far as dubbing Mr Bolsonaro a "little tropical wannabe Hitler".

His statements on issues ranging from abortion to race, and from migration to homosexuality, have proved provocative and garnered much attention.

"I'd prefer [to see] a son of mine to die in an accident than [to be] a homosexual," he told Playboy in a 2011 interview.

In 2016, he provoked outrage by remarking that a fellow lawmaker was not worth raping because he thought she was "very ugly" and not his "type".

Even though he was confined to a hospital bed following the attack, unable to return to the campaign trail, he kept rising in the polls and continued to attract new supporters.

Many in the business sector liked his strong backing of free-market economics. Some young people were attracted to his plain speaking and his social media presence. Evangelicals, who account for one in every four voters, liked his conservative outlook.

All of these groups will now be hoping he can deliver on his campaign promises and lead Brazil in a new direction.