A temporary cap on the number of skilled workers from outside the EU allowed into the UK was introduced "unlawfully", the High Court has ruled.
Home Secretary Theresa May introduced the cap this summer as an interim measure ahead of a permanent cap.
But a legal challenge to it was upheld with judges ruling that ministers had "sidestepped" Parliamentary scrutiny.
The Home Office said this did not imperil its flagship immigration policy but Labour said it was in "chaos".
The BBC's Home Affairs Correspondent Danny Shaw said the ruling was an embarrassment and a setback for the coalition but was not a fatal blow to its plan for a permanent cap on non-EU migration.
The ruling has nullified the current temporary cap, meaning it is no longer in force.
But ministers can introduce a new cap when Parliament returns in January. This would come into effect immediately but MPs and peers would be able to challenge it within 40 days, the BBC understands.
Prime Minister David Cameron has said current immigration levels are not sustainable and called for net migration - the difference between the number of people entering the UK and those emigrating - to be reduced from nearly 200,000 a year to "tens of thousands".
As a first step, ministers introduced a temporary cap for non-EU skilled workers of 24,100 a month in June, in line with a Conservative election commitment.
But the measure was challenged by the Joint Council for the Welfare of Immigrants (JCWI) and English Community Care Association, which was concerned over the position of immigrant care workers.
In Friday's ruling, Lord Justice Sullivan and Mr Justice Burton concluded that the home secretary had not gone through the proper parliamentary procedures before implementing the cap - which took effect without a vote in Parliament.
"The secretary of state made no secret of her intentions," they stated. "There can be no doubt that she was attempting to side-step provisions for Parliamentary scrutiny set up under provisions of the 1971 Immigration Act and her attempt was for that reason unlawful."
As a result, it said no lawful limits were now in place for two tiers of job applicants from abroad.
The English Community Care Association said the temporary cap - which reduced by 5% the number of non-EU work visas issued - could have a potentially "catastrophic" effect on the care sector.
As 13% of those who work in care homes come from outside Europe, it said thousands of staff from the Philippines, India and South Africa could be forced to quit their jobs and this could damage continuity of care.
'Not thought through'
Vacancies created would not be filled by British staff, it said, as there was not sufficient demand for the jobs.
It argued the cap had been introduced with "complete disregard" for care providers and their staffing needs.
In response, the Home Office said it was still "firmly committed" to reducing levels of net migration.
"I am disappointed with today's verdict," Immigration minister Damian Green said, stressing ministers would launch an appeal if "there were grounds" to do so.
"We will do all in our power to continue to prevent a rush of applications before our more permanent measures are in place," he added.
But Shadow Home Secretary Ed Balls, for Labour, said the policy "may have sounded good before the election but it wasn't properly thought through and didn't get the scrutiny it deserved".
He added: "David Cameron's flagship election promise to bring net migration down to the tens of thousands has now been watered down from a firm pledge to just an aim."
The level at which the permanent cap will be set has been a source of tension within government, with Lib Dem ministers calling for the regime to be flexible as possible so as not to prevent firms from being able to recruit highly skilled labour.