The EU's top court ruled Wednesday that governments can ban homosexual blood donors to combat HIV but only on condition they show it is still the best way to limit health risks.
The court ruled on the case of a homosexual man in the eastern French city of Strasbourg who protested against a ban on his blood being used in 2009.
The European Court of Justice said the French ban, dating from 1983, could violate the European Union principle "of non-discrimination on the basis of sexual orientation."
But the court ruled that a ban on blood donations from gay men "may be justified, having regard to the situation prevailing in the Member State concerned."
"It must be established whether those persons are at a high risk of acquiring severe infectious diseases, such as HIV, and that there are no effective detection techniques or less onerous methods for ensuring a high level of health protection for recipients," it said.
If new testing regimes can ensure that all blood donations are free of infectious diseases, then such a prohibition may not be necessary, said the top court for the 28-nation EU.
It was now up to the French court to review the situation in light of the latest medical findings, it said.
France barred homosexual blood donors in 1983 as the world scrambled to find a way to halt the spread of HIV/AIDS which has claimed some 39 million victims since then.
Advances in detection and treatment have helped bring the disease under control and in April, the French government proposed to end a ban which many think stigmatises the homosexual community and should be reconsidered.
Britain ended its donor ban in 2011 and the United States followed late last year, providing that the persons involved had not had sexual relations for a year.