The Government has suffered a defeat in the highest court in the land over its plans to restrict access by foreign-born individuals to legal aid in civil cases.
Seven Supreme Court justices have announced the lord chancellor acted ultra vires, or beyond his powers, when he decided to use secondary legislation to introduce a controversial "residence test".
The lord chancellor was proposing to give the test legal effect by amending the Legal Aid, Sentencing and Punishment of Offenders Act 2012 (LASPO).
A Ministry of Justice(MoJ) spokesman said: "We are of course very disappointed with this decision. We will now wait for the full written judgment to consider."
It is understood the MoJ was aiming to have regulations for the test in place this spring, ready to come into force in the summer.
The Supreme Court ruling is a victory for legal charity Public Law Project (PLP), represented by law firm Bindmans.
Michael Fordham QC, appearing for PLP, said the test targeted a vulnerable group - "notwithstanding their equal rights and their equal needs".
The proposed test involves restricting civil legal aid, except in certain circumstances, to people who have lived in the UK, Crown dependencies or British overseas territories continuously for a period of at least 12 months at the time of applying for aid.
Human rights campaigners warned the test would have a particularly serious impact by denying help to recently arrived migrants and their children who might face all sorts of legal problems requiring legal assistance, including those relating to family matters, health and housing.
Government lawyers argue the country has one of the most expensive legal aid systems in the world and the residence proposals were fair and necessary to save costs and restore public confidence in the system amid public concern over the expense.
The issue reached the highest court in the land after splitting the judiciary in the lower courts.
The hearing was expected to last two days, with a judgment to follow later.
But at the end of the first day of the hearing the Supreme Court announced that it was allowing the appeal on the ultra vires issue and full written reasons for the decision will follow in due course.
The parties are being asked whether they wished to address the court on the second issue - whether the residence test would be unjustifiably discriminatory and so in breach of common law and the Human Rights Act 1998.
The road to the Supreme Court began with a High Court ruling in July 2014 that the test was ultra vires and unjustifiably discriminatory.
One of the cases used to highlight the issues raised in the High Court was that of P, an adult with severe learning disabilities forced to live in a dog kennel by his family, subjected to regular beatings by his brother and mother, and starved over an extensive period of time.
High Court judge Lord Justice Moses said: ''With the benefit of legal aid and the involvement of the Official Solicitor, proceedings in the Court of Protection resulted in a determination that it was in P's best interests to live separately from his family in a small group home with his friends and peers and 24-hour care.''
If the residency test had been in place at the time, it would have been impossible to discover whether P met it and was entitled to legal assistance from the state, said the judge.
But the Court of Appeal, composed of three different judges, declared last November that the lord chancellor did have power to introduce the test by way of secondary legislation, and that while withholding legal aid from particular groups might be discriminatory, it could be justified.
As the case reached the Supreme Court, John Halford of Bindmans said in a press statement: "In this country, we are rightly proud we have a legal system which, whilst not perfect, seeks to ensure that anyone can enforce important legal rights and enter into the courtroom on an equal footing to their opponents.
"Legal aid has been available to facilitate this in its current form for over 60 years.
"The lord chancellor's proposed residence test strikes at the heart of these principles by very deliberately withholding legal aid from those who overwhelmingly will not be British, yet are obliged to obey the law here and so should, equally, be protected by it."
The MoJ said: "This Government believes that, in principle, individuals should have a strong connection to the UK in order to benefit from the civil legal aid scheme.
"We believe the residence test proposed during the previous Parliament is a fair and appropriate way to demonstrate that connection."