The government's immigration rules racially discriminated against Roma (Gypsies) seeking entry into the UK, the Law Lords have ruled.
Roma Gypsies were prevented from boarding UK-bound flights
It follows a Home Office move to cut asylum claims by stopping people, mostly Roma, from boarding flights to Britain from the Czech capital, Prague.
Civil rights group Liberty said it exposed "racism at the heart of the government's asylum policy".
The Home Office said it had not meant to discriminate against anyone.
It said it would look at the implications of the ruling, but pointed out the controls were no longer in place because Czechs are now entitled to free movement across Europe.
The screening took place at the airport in July 2001, at a time of concern about the number of asylum seekers entering Britain.
Those refused "pre-clearance" were effectively prevented from travelling to the UK, because no airline would carry them.
Lady Hale, sitting with Lords Bingham, Steyn, Hope and Carswell, said many Roma had good reason to want to leave the Czech Republic because of persecution.
But she said they were treated more sceptically than non-Roma passengers by immigration officers "acting on racial grounds".
Lady Hale said immigration officers should have treated all would-be passengers in the same way, only using more intrusive questioning if there was a specific reason.
Liberty said statistics suggested Roma Czechs were 400 times more likely to be stopped by British immigration officials at Prague airport than non-Roma Czechs.
It took up the case of six unnamed Roma Czechs refused entry to Britain, and that of the European Roma Rights Centre, which said the measures unfairly penalised Roma people.
It lost a High Court action in October 2002 when a judge said the system was "no more or less objectionable" than a visa control system.
He ruled there was no obligation on Britain not to take steps to prevent a potential refugee from approaching its border to claim asylum.
David Blunkett has lost several law lords rulings on asylum policy
The Court of Appeal then decided the practice almost inevitably discriminated against Roma, but that this was justified because they were more likely to seek asylum.
Immigration law allows officials to discriminate against citizens from named countries, but it does not allow officers to go further than that.
Responding to the ruling, a Home Office spokesman said: "The scheme was operated two years ago as a short-term response to the high levels of passengers travelling from Prague who are subsequently found to be ineligible for entry to the UK."
Welcoming the ruling, Maeve Sherlock, chief executive of the Refugee Council, said: "Human rights abuses against the Roma in Eastern Europe are well documented, and it is hugely troubling that the government sought to deny entry to such a vulnerable group."
Amnesty International's Jan Shaw said: "That the government's own asylum policy was being operated discriminatorily is bleakly ironic given that discrimination often lies at the heart of serious human rights abuse, not least in the Czech Republic."
But the chairman of Migration Watch UK, Sir Andrew Green, said the House of Lords decision was a "step in the wrong direction".
"The basic point is that the government has a duty to control our borders and this decision appears to extend the race relations legislation beyond sensible limits."