Same-sex partners of EU citizens have the right to live in any member state whatever their nationality, even in countries that do not recognise gay marriage, the bloc's top court ruled Tuesday.
EU laws on freedom of movement extend to the non-European spouses of EU citizens and the European Court of Justice judgement means this also includes same-sex partners.
The decision, based on a case from Romania, risks further embittering relations between more socially tolerant member states to the west of the EU and conservative countries to the east.
The Luxembourg-based court recognised that EU member states "have the freedom whether or not to authorise marriage between persons of the same sex".
However, it added "they may not obstruct the freedom of residence of an EU citizen by refusing to grant his same-sex spouse, a national of a country that is not an EU member state, a derived right of residence in their territory."
The court was ruling in the case of Romanian man Relu Coman and his American husband Robert Hamilton, who were married in Brussels in 2010 and two years later sought to move to Romania.
The Romanian authorities refused to give Hamilton permission to live in the country for more than three months on the grounds that he could not be classified as Coman's spouse because the laws there do not recognise same-sex marriage.
The couple brought a case for discrimination on the basis of sexual orientation, arguing that Coman's right to freedom of movement, guaranteed by EU law, had been curtailed by the restriction placed on his husband.
The case went to the Romanian Constitutional Court, which asked the ECJ whether under EU law Hamilton should be regarded as Coman's spouse.
"In the directive on the exercise of freedom of movement, the term 'spouse', which refers to a person joined to another person by the bonds of marriage, is gender-neutral and may therefore cover the same-sex spouse of an EU citizen," the ECJ said.
EU member states are free to decide whether or not to allow same-sex marriage in their own territories, the court said, but refusing to recognise a union lawfully made in another EU country "may interfere with the exercise of that citizen's right to move and reside freely".
The court said the obligation to recognise same-sex marriages for the purpose of granting residence rights "does not undermine the national identity or pose a threat to the public policy" of the country involved.
"We can now look in the eyes of any public official in Romania and across the EU with certainty that our relationship is equally valuable and equally relevant, for the purpose of free movement within the EU," Coman said in a statement released by ILGA-Europe, which campaigns for rights for gay, lesbian, bisexual and transgender people.
"We are grateful to the EU Court and to the many people and institutions who have supported us, and through us, other same-sex couples in a similar situation. It is human dignity that wins today."
The Romanian courts will now have to rule on Coman and Hamilton's case based on the ECJ judgment.
The court "has confirmed that rainbow families should be recognised equally in the eyes of the law on freedom of movement. Now we want to see the Romanian authorities move swiftly to make this judgment a reality," Paradis said in a statement.