Image caption Harmondsworth immigration removal centre in west London is Europe's largest

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.

'Easy target'

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.

'More compassion'

The change could lead to up to 10,000 people a year could appeal for release from detention, crossbench peer Lord Green of Deddington said.

Concerns were raised by several peers who opposed the amendment that it could lead to a deterioration of race relations - with released detainees potentially facing discrimination from land lords, and a return to the "bad old days of poor police race relations".

Lord Brown of Eaton-Under-Heywood, a crossbench peer, suggested a time limit of nine months would be better, pointing out that Sweden has a 12-month cut-off point.

But Labour peer Lord Rosser said the change would let the courts decide the issue.

Meanwhile, Lib Dem Lord Roberts of Llandudno said detainees should be treated with more compassion, because they are "not criminals, they are people... with lives and dreams".

Labour's Baroness Lister of Burtersett said indefinite detention impacted on people's mental health and the current situation was a "stain on this country's human rights record."