Asylum seekers must not be subjected to psychological tests to determine whether they are homosexual, the European Court of Justice (ECJ) has ruled.
Tests to determine sexual orientation are controversial, but are sometimes used when assessing asylum claims.
The ECJ case relates to a Nigerian man who submitted an asylum application in Hungary. He feared persecution in Nigeria for being gay.
The Nigerian's claim was rejected after a psychologist's report failed to confirm his homosexuality. A court in Szeged, Hungary, must now reconsider his case in light of the ECJ ruling.
Hundreds of homosexuals fearing persecution in Africa, the Middle East and Chechnya have sought asylum in the EU.
The European Court of Justice ruling is binding in all 28 EU states, and it means that EU countries now have no legal right to impose psychological tests to determine an asylum seeker's sexuality.