Ministers have been defeated in the Lords over limits on detention in immigration removal centres (IRC).
During the Immigration Bill debate, peers voted by 187 to 170 that detention must be limited to 28 days, except when a court decides otherwise.
The government had argued most of those detained either were foreign criminals, or had broken immigration rules before.
Opponents insisted the limit was needed because detaining people indefinitely had a negative impact on mental health.
It is the second time the government has been defeated over the bill. Lords voted a week ago to allow asylum seekers the right to work if their claims have not been processed within six months.
The 28-day cap was recently recommended by a cross-party group of MPs and peers.
Crossbench peer Lord Ramsbotham, a former HM inspector of prisons, put it forward as an amendment to the bill, saying he had done so because the current system “is not working”.
He was backed by Labour and Lib Dem peers.
Recent inspections have found detainees being held for more than a year, and in two cases for as long as five years, at Verne IRC in Dorset and Harmondsworth IRC in west London – which is Europe’s largest.
Meanwhile an inspection of Yarl’s Wood IRC in Bedfordshire found almost 100 pregnant women among those been detained.
The report prompted Chief Inspector of Prisons Nick Hardwick to say there should be “strict time limits” and vulnerable people should only be detained “in the most exceptional circumstances”.
However, peers who supported the government in the debate warned that bringing in the 28-day cap could undermine the government’s enforcement of immigration controls and make it more difficult to maintain public safety.
Lord Keen said the limit would give illegal migrants attempting to avoid being deported an “easy target” to aim for.
The change could lead to up to 10,000 people a year appealing for release from detention, crossbench peer Lord Green of Deddington said.
Source: BBC NEWS