EU countries that have not legalised gay marriage must still offer same sex spouses the same residency rights as heterosexual couples under Brussels’ freedom of movement laws, the European Court of Justice has ruled.

In a landmark decision, EU judges decided that a country could not use the illegality of homosexual marriage as a reason to stop an EU citizen bringing their non-EU spouse to live with them, which is a right guaranteed by Brussels.

They stressed that the decision, which will set a precedent across the bloc, did not force EU members to recognise gay marriage in a bid to prevent accusation that the Luxembourg court was meddling in national affairs.

The judgement comes after an American man, Clai Hamilton, was denied residency in Romania with Adrian Coman, his Romanian husband, because gay marriage is illegal in that country. Instead he would only be allowed to stay in Romania for three months.

“Romanian citizens cannot be divided into good and gay. We can no longer be treated as inferior citizens without equal rights on the basis of the prejudices that some people have about homosexuality," Mr Coman said.

“Although the member states have the freedom whether or not to authorise marriage between persons of the same sex, 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 EU’s highest court said in a statement on Tuesday.