RIO DE JANEIRO (AP) — Brazil's supreme court officially made homophobia and transphobia crimes similar to racism on Thursday, with the final justices casting their votes in a ruling that comes amid fears the country's far-right administration is seeking to roll back LGBT social gains.

Six of the Supreme Federal Tribunal's 11 judges had already voted in favor of the measure in late May, giving the ruling a majority. The final justices voted Thursday for a tally of eight votes for and three against.

Racism was made a crime in Brazil in 1989 with prison sentences of up to five years. The court's judges ruled that homophobia should be framed within the racism law until the country's congress approves legislation specifically dealing with LGBT discrimination.

The court's judges have said the ruling was to address an omission that had left the LGBT community legally unprotected.

"In a discriminatory society like the one we live in, the homosexual is different and the transsexual is different. Every preconception is violence, but some impose more suffering than others," said justice Carmen Lucia.

Justice Ricardo Lewandowski, one of the judges who voted against the measure, recognized the lack of congressional legislation on the issue but said he voted against putting homophobia inside the framework of the racism legislation because only the legislature has the power to create "types of crimes" and set punishments.

While same-sex marriage is legal in Brazil, it is still a dangerous country for members of the LGBT community and has a large evangelical movement often critical of gay rights. According to the rights group the Grupo Gay da Bahia, 420 LGBT people were killed across Brazil in 2018, while at least 141 have been killed so far this year.

President Jair Bolsonaro, a former army captain who assumed office on Jan. 1, has a history of offensive comments about gays, blacks and other minorities, openly acknowledging he is a homophobe. He has said he would rather have a dead son than a gay son.