By Julia Fioretti

BRUSSELS (Reuters) - Europe's top court ruled on Wednesday that banning homosexual men from giving blood may be justified where strictly necessary and only if there are no alternatives for preventing the transmission of severe infectious diseases.

A doctor in France refused a blood donation from Geoffrey Leger in 2009 on the grounds that he had had sex with another man. French law excludes blood donations from men in such cases as a measure against the spread of diseases such as HIV.

Leger challenged the decision and the Luxembourg-based Court of Justice of the European Union was asked whether permanently banning people having had homosexual relations from donating blood was against EU law.

"Although the permanent deferral provided for in French law helps to minimize the risk of transmitting an infectious disease to recipients ... the principle of proportionality might not be respected," the ECJ said in a statement.

Under EU law, people who are at high risk of contracting severe infectious diseases because of their sexual behavior may be permanently banned from blood donation.

Alluding to screening as a possible alternative to an outright ban, the ECJ said: "It is possible that HIV may be detected by effective techniques able to ensure a high level of health protection for recipients."

Where there are no such techniques, the Strasbourg court would have to "ascertain whether there are less onerous methods of ensuring a high level of health protection for recipients other than the permanent deferral from blood donation".

The French Minister for Social Affairs, Health and Women's Rights, Marisol Touraine, said discrimination against potential blood donors on the basis of sexual orientation was unacceptable.

She said she supported removing all references to sexual orientation in questionnaires for blood donors and making the exclusion temporary.

France has the highest rate of HIV among homosexual men in Europe. Half of those newly infected with HIV between 2003 and 2008 were men who had had sexual relations with other men, according to the ECJ.

However, the Court said the permanent exclusion of homosexual men from blood donation in France still had to follow the principle of non-discrimination on the basis of sexual orientation.

Any limitations on rights protected under EU law may be imposed only if they are necessary, meet the public interest or are needed to protect the rights of others, the ECJ said.

(Editing by Mark Heinrich)