Hearing a plea of unconstitutionality raised in the context of that dispute, the Curtea Constituţională (Constitutional Court, Romania) asked the European Court of Justice whether Mr Hamilton, as the spouse of an EU citizen having exercised his freedom of movement, must be granted a right of permanent residence in Romania.
The Romanian man who brought the case married an American man in 2010 in Belgium, where same-sex marriages are allowed, and then sought a residence permit for his spouse from the Romanian authorities. The country does not recognize any form of legal union between those of the same gender.
Romania has laws that prohibit the marriage of same sex couples, and doesn't recognise them at all in the legal system - resulting in the Romanian nationals spouse being unable to take up residence as the spouse of an European Union citizen.
The couple challenged the decision, saying it was discriminatory on the grounds of sexual orientation. The case was eventually referred to the ECJ, which determined that "spouse" is gender-neutral and includes same-sex partners.
This week, ECJ advocate general Melchior Wathelet said that should include same-sex spouses who Wednesday in a country that has equal marriage on the books.
The majority of E.U. nations have marriage equality, but some offer civil unions with equivalent or limited rights.
Romania decriminalized homosexuality in 2001 but prohibits marriage between people of the same sex, and does not recognize same-sex marriages carried out overseas.
The ECJ's order is nonbinding.
The official opinion of the advocate general - the highest officers of the court who advise judges on how to rule on complex cases - will now be considered by a panel of ECJ judges.
Sophie in 't Veld, vice president of the Liberal group in the European Parliament and vice president of the European Parliament's LGBTI Intergroup, said: "This is fantastic news and a landmark opinion for rainbow families".
EU laws guarantee citizens of member states and their family members the right to move and freely reside in any country in the bloc, subject to certain conditions, raising questions about the legal rights of same-sex spouses in countries where such unions are not legal. In its conclusions, known this Thursday, community lawyer opens door to a greater protection of rights of homosexual marriages in countries where it is not legalized.