Clai Hamilton, left, and Adrian Coman, an American-Romanian gay couple who were married in Belgium, are shown in Bucharest, Romania, on July 22, 2016. (Vadim Ghirda/AP)

In 2010, Adrian Coman, a Romanian, and Clai Hamilton, an American, married in Brussels.

Then, in 2012, Coman's contract with the European Parliament ended. The couple were considering moving to Coman's home country, but Romanian authorities told them that would not be possible. Romania does not recognize same-sex marriage, so the government refused Hamilton a residence permit.

That denial led to a landmark legal battle. And on Tuesday the European Union's Court of Justice ruled in the couple's favor: Hamilton is entitled to residency in Romania, the court decided, because the term “spouse” is gender-neutral, and non-E.U. citizens have the right to reside with their E.U. spouses in member states. Same-sex couples in the bloc should have the same rights to freedom of movement as do heterosexual couples, the court said.

“We can now look in the eyes of any public official in Romania and across the E.U. with certainty that our relationship is equally valuable and equally relevant,” Coman said after the ruling. “It is human dignity that wins today.”

Before they reached the E.U.'s top court, Coman and Hamilton took their case to the Romanian Constitutional Court, where they claimed they had been discriminated against based on their sexual orientation. “In that moment all I felt was sad and humiliated,” Coman told Human Rights Watch, describing how the Romanian Embassy in Brussels told him they would not provide the necessary paperwork for his husband. "I left the consulate holding a sheet of paper saying my family was not recognized by the Romanian authorities.”

Individual states can still ban same-sex marriage, and a number of countries, including Bulgaria, Poland, Romania and Slovakia, already have. But no matter a country's same-sex marriage laws, those who are legally married elsewhere in the EU must be recognized as spouses everywhere in the bloc and have a legal right to move freely within it.

Hamilton, left, and Coman in Bucharest. (Vadim Ghirda/AP)

The United States had its own ruling regarding same-sex marriage this week, when the Supreme Court ruled in favor of a baker who refused to make a cake for a gay couple's wedding because he said it went against his religious beliefs.

The decision followed the Colorado Civil Rights Commission ruling against the baker, Jack Phillips, citing Colorado's law that prohibits discrimination based on sexual orientation. But Justice Anthony Kennedy was disturbed by comments made by a member of that commission, which he seemed to think were “neither tolerant nor respectful of Mr. Phillips' religious beliefs” and thus inconsistent with the First Amendment. The case did not necessarily offer a precedent for other cases.

The Supreme Court could soon debate a similar case of a florist in Washington state who refused to provide flowers for a same-sex wedding.

Read more:

Germany approves same-sex marriage, bringing it in line with much of Western Europe

What was the first country to legalize gay marriage?

Democracy threatens to backslide in Romania