(CNN) The European Union's top court ruled that same-sex couples are entitled to the same residency rights as other married couples, even in member states that don't recognize gay marriage.
The term "spouse" is gender-neutral and includes same-sex partners, the Court of Justice of the European Union concluded in its judgment. Member states should grant all married couples the right to move and reside freely within the EU, regardless of their sexual orientation, the court said.
With its judgment, the court sided with a gay couple who was denied the right to reside together in Romania, which does not recognize same-sex marriage.
Advocacy groups hailed the court's judgment as the first of its kind to include same-sex couples in the definition of spouse for the purpose of free movement, which allows EU citizens to move and reside freely among member states. But it stopped short of obligating Romania or other member states to allow same-sex marriage.
While member states are free to decide whether to allow same-sex marriage within their borders, the court said that they should recognize same-sex marriages performed in other EU states for the purposes of residency and free movement.
"Equality, fairness and pragmatism were at the core of today's verdict from Luxembourg. The CJEU has acknowledged that rainbow families should be recognized equally in the eyes of the law on freedom of movement," Evelyne Paradis, executive director of advocacy group ILGA-Europe, said in a statement. "Now we want to see the Romanian authorities ... move swiftly to make this judgment a reality."
Adrian Coman, a dual US-Romanian citizen, met Claibourn Hamilton, a US citizen, in New York in June 2002. The two lived there together from 2005 to 2009.
Coman moved to Brussels in 2009 to work at the European Parliament as a parliamentary assistant while Hamilton stayed in New York. They were married in Brussels in 2010.
In December 2012, when Coman's employment ended, the couple considered moving to Romania to be closer to Coman's family. They contacted Romanian authorities to find out how Hamilton could obtain the right to work and reside lawfully there for more than three months as a member of Coman's family.
Under the EU's right to free movement, non-EU spouses married to EU citizens may join their partner in a member state where the European national resides. The couple sought a residency permit for Hamilton based on the right to free movement, assuming it would apply to Hamilton. Romanian authorities said that Hamilton could not be classified as a spouse of an EU citizen in Romania because it does not recognize marriage between persons of the same sex.
The couple brought an action before the Romanian courts seeking a declaration of discrimination based on sexual orientation. Romania's Constitutional Court asked the Court of Justice to determine if Hamilton should be considered a spouse of an EU citizen with the same right to permanent residency.
Because the term "spouse" includes same-sex partners, member states must treat them the same as any other spouse, the court ruled. To refuse residency to an EU citizen's spouse may interfere with that citizen's right to move freely.
The court emphasized that recognizing same-sex marriages performed in another member state "does not require that Member State to provide, in its national law, for the institution of homosexual marriage." Nor does it "undermine the national identity or pose a threat to the public policy of the Member State concerned."
While the ruling leaves the state of same-sex marriage in Romania in limbo, Coman and others are calling it a win.
"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 through ILGA-Europe.
"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," he said. "It is human dignity that wins today."