BRUSSELS (AP) — The European Union’s top court says that asylum-seekers in the bloc shouldn’t be psychologically tested on their sexual orientation as part of the procedure to grant them protection.

The EU Court of Justice ruled Thursday that such a psychological report “is disproportionate” in relation to the objective.

The court made the ruling after a Nigerian sought asylum in Hungary, arguing he faced persecution at home based on his homosexuality. Hungary rejected the application based on a psychological report that couldn’t confirm his homosexuality.

The Nigerian appealed and the Hungarian court sought the advice of the EU’s top court.