Changes to marriage laws introduced by the UK Home Office have been overturned by Mr Justice Silber, sitting at the High Court in London. The judge declared the rules were incompatible with the European Convention on Human Rights.
The marriage laws were introduced to clamp down on "marriages of convenience" to get around immigration controls and require immigrants to obtain a special certificate of approval, or COA before they can wed in the UK.
The rules introduced February 2005, mean people born outside the EU and some bordering European nations who have only 6 months stay in the UK, must seek special permission from the Home Office to marry, irrespective of the status of their partner.
The rules do not apply to Church of England members, even if they are illegally in the UK.
The overturning of the marriage laws due to unfair discrimination against immigrants on religious grounds leaves the door open for hundreds of people from overseas getting married in the UK.
The test case involved in overturning by Mr Justice Silber, involved a foreign national from Algeria and an EEA national who was legally living in the UK. Once Mahmaud Baiai and Izabella Trzanska from Poland were refused permission to marry, they launched the challenge.
Mr Justice Silber said the case raised issues under Article 12 of the European Convention on Human Rights, which protects the right to marry and found a family.
"The rules were incompatible because they discriminated against immigrants rights subject to immigration control on grounds of religion and nationality," he declared.
The judge pointed out that Anglican marriages were treated differently, and were exempt from the rule, because steps were taken to ensure Church of England marriages were not marriages of convenience.
He said other faiths, including Islam and Hinduism, and also other denominations of the Christian church took steps to ensure marriages were not "bogus."
Lawyers for immigrants argued the Government was guilty of religious discrimination and unlawfully interfering with one of the most fundamental rights of all, the rights of couples to marry when their relationships were genuine and not a sham.
"The right to marry is not dependent on the right to reside in the country. Adequate measures are already in place to combat marriages of convenience, and a marriage of itself did nothing to secure the right to live in the UK," said the judge.
Monica Carss-Frisk QC, appearing for the Home Secretary, contended that the COA scheme was both "proportionate and compatible" with Article 12 and there was nothing inherently objectionable or unlawful in adopting such a scheme in the interests of an effective immigration policy.
A Home Office spokesman said ministers would consider an appeal, and will comply with the ruling by introducing revised guidelines and suspend decisions on any cases that have faced rejection by the Home Office.
The ruling by the judge means ministers must return the law to parliament or take other steps to make sure it is fair.