A legal challenge to the blood ban had been in the Supreme Court for four years.

The Brazilian Supreme Court has ruled in favour of allowing gay and bisexual, and other men who have sex with men, to donate blood. A case challenging the 12 month deferral period had been in the Supreme Court for four years, and seven judges ruled in favour of lifting the restrictions.

In their ruling, the Supreme Court said that the ban was unconstitutional. Edson Fachin, one of the Justices of the Supreme Court, wrote: “Instead of the state enabling these people to promote good by donating blood, it unduly restricts solidarity based on prejudice and discrimination.”

The result was praised by LGBTQ activists in the country, and politician Samia Bomfim wrote on Twitter: “A historical victory for the LGBT population! And the measure benefits everyone who needs donations, as blood stocks are almost always insufficient.”

Despite having one of the most homophobic leaders, in the form of Jair Bolsonaro, and the highest LGBTQ murder rate in the world, Brazil’s laws are generally in favour of LGBTQ rights. And last year, homophobia and transphobia were made illegal in the country.

LGBTQ people in the country praised the ruling. Speaking to the Los Angeles Times, Alfonso Nogueira said: “This is a day I never thought would come, especially with the president we have now.

“The threats we live with on a daily basis might finally be taken seriously. Now someone will have to do something about them. This shows that our lives matter.”

And other countries recently have been either liberalising or removing their bans on gay and bisexual men donating blood. Earlier this week, Hungary completely dropped its ban, and said it would allow anyone to donate blood if their sexual behaviour was deemed not be risky.

Related: Northern Ireland blood donation rules to be relaxed for gay and bisexual men