Brazil's Supreme Court has struck down as unconstitutional the nation's ban on gay and bisexual men donating blood.

Men who have sex with men were prohibited from donating blood for 12 months.

According to Reuters, the case had been in court for almost four years. The high court's 11-judge panel voted to end the ban.

Such limits were put in place in many countries at the height of the AIDS crisis in the 1980s.

Supreme Court Minister Edson Fachin argued that the ban was based on “prejudice and discrimination.”

“Instead of the state enabling these people to promote good by donating blood, it unduly restricts solidarity based on prejudice and discrimination,” Fachin wrote.

Last month, as the United States became the epicenter of the coronavirus crisis, the U.S. Food and Drug Administration (FDA) eased its blood ban, reducing from 12 to 3 months the time gay and bisexual men must abstain from sex before being allowed to donate blood. The previous policy was implemented in 2015.

(Related: FDA eases ban on gay men donating blood.)

Brazil has seen a dramatic rise in COVID-19 cases as President Jair Bolsonaro has refused to take action.