France could loosen its ban on gay men giving blood after the European court of justice ruled in favour of adopting less restrictive measures than excluding all gay men who have ever had sex.

France’s ban on gay men giving blood has been criticised by rights groups as discrimination on the grounds of sexual orientation. Any potential male blood donor in France who admits ever having had sex with a man is automatically and permanently banned from giving blood. The ban came into force in 1983 because it was deemed that sexually active gay men were more likely than other groups to have HIV, the virus that causes Aids.

A French man, Geoffrey Léger, brought a legal case in 2009 after he went to give blood in the eastern city of Metz but was refused because he had previously had sexual relations with a man.

After examining Léger’s case, the ECJ has ruled that EU governments may be justified in banning gay men from donating blood but only under strict conditions. The court found that France’s law was “liable to discriminate against male homosexuals on the basis of sexual orientation”, which is against EU policy.

It suggested “less onerous methods” than a blanket ban should be considered, such as using questionnaires and an individual interview with a doctor to “identify high-risk sexual behaviour more accurately”.

Lifetime bans may be justified if a donor presents a high risk of acquiring severe infectious diseases and there is no other method to protect blood recipients, the court said.

Last year, the advocate general of the ECJ had been more vehement, telling the judges that French law was too restrictive and that it indirectly discriminated by excluding “essentially the entire male gay and bisexual population” from giving blood.

The Socialist French government has long promised to end the ban. Earlier this month, the French parliament voted in an amendment to a health bill stipulating that nobody could be prevented from giving blood on the grounds of their sexual orientation. But France’s consultative ethics committee said further scientific research was needed before considering lifting the ban.

Caroline Mécary, who represented Léger, told the website Yagg that she would have liked a judgment that was more “clear-cut” but that the ECJ was known for being pragmatic.

Mécary told the Guardian before the ruling: “Mr Léger brought this case because, in a gesture of generosity, he had gone to give blood to save lives and had been told he couldn’t because he was gay. He found that very difficult, to be banned because he was gay. If they had said it was because of multiple partners or being at risk … but they didn’t even ask about those details. So it was discriminatory and he contested it.”

Rights campaigners have insisted for years that questionnaires and pre-donation interviews should ask everyone about their sexual behaviour and risk factors regardless of their sexual orientation, rather than just focusing on gay or bisexual men. It is now up to the French justice system to take a final decision on Léger’s case.

Last year, the US Food and Drug Administration recommended a less stringent ban on gay blood donors, suggesting that men who have sex with men must abstain from doing so for a year before they are eligible to donate blood. This one-year deferral is in line with policies in countries including the UK and Australia.