A majority in Brazil's Supreme Court has voted in favour of making homophobia and transphobia crimes.
Six out of 11 judges voted to consider discrimination against gays and transgender people equivalent to racism.
The decision will give the community, which suffers constant attacks, real protection, activists say.
At least 141 LGBT people have been killed in Brazil this year, according to rights group Grupo Gay da Bahia.
The Catholic Church and the evangelical movement are frequently critical of gay rights and far-right President Jair Bolsonaro, elected last year with strong support of conservative voters, is a self-described homophobe.
"Homophobic crimes are as alarming as physical violence," Supreme Court Vice-President Luiz Fux said on his vote, citing "epidemic levels of homophobic violence".
For almost 20 years there have been efforts to make homophobia a crime in Brazil, but legislation on the matter has faced resistance among conservative and religious groups in Congress, the BBC's Julia Carneiro in Rio reports.
The decision at the Supreme Court means that offences are to be punished under the country's racism law until Congress approves specific legislation to protect LGBT people, our correspondent adds.
The remaining judges will vote in a session scheduled for 5 June.
Brazil has the world's biggest Catholic population but also a growing number of young, educated urban liberals who are eager to fight for gay and trans rights.
The country legalised same-sex marriage in 2013 and LGBT couples have also been given the righRead More – Source[contf] [contfnew]