Thousands of people may have been unlawfully held in immigration removal centres in recent years, the court of appeal has ruled.

In a test case brought by five asylum seekers who were challenging the provisions of the Dublin III regulations, the appeal court judges ruled that the detained people could not be held indefinitely.

Under Dublin III, asylum seekers must claim asylum in the first safe country they arrive in. If they arrive in the UK and claim asylum and the Home Office discovers that they have passed through another safe country first, the Home Office can send them back to that country.

There is no time limit on immigration detention in the UK. However, senior judges have ruled that the Home Office unlawfully held many asylum seekers who passed through a safe country before reaching the UK.

While discussions between the Home Office and the other European country take place, the asylum seekers may be locked up indefinitely. It is this practice that has been ruled unlawful.

Affected people may now be able to claim damages from the Home Office for false imprisonment.

Krisha Prathepan, of Duncan Lewis Solicitors, who represented two of the five men, welcomed the ruling. “This landmark judgment has huge implications for those who were detained under the provision in the Dublin regulation [Dublin III].

“It is deeply concerning that the Home Office’s unlawful conduct may have led to the detention of so many people without any lawful basis. In effect, the Home Office has unlawfully detained hundreds or even thousands of individuals seeking international protection.”

The judges said in their ruling: “There is no doubt that all the necessary ingredients for the common law cause of action for false imprisonment are satisfied in the case of each of the appellants.”

The appeals related to the meaning and effect of specific parts of Dublin III – detention for the purpose of transfer to another EU member state. The argument was that the only ground for detention was that specified under article 28 (2) that there was a significant risk of absconding.

The court ruled that the Home Office could not detain people indefinitely for the purposes of transfer to another member state at a time when “significant risk of absconding” had not been defined in UK law.

The case was heard by the master of the rolls, Sir Terence Etherton, Lord Justice Philip Sales and Lord Justice Peter Jackson. The ruling was a two to one majority decision.

The judges pointed out that under article 28 of the Dublin convention people should not be detained solely while the procedure of transferring them from one country to another took place.

The rules state that detention should be for the shortest possible time. The judges said that while the power to detain must be retained in the interests of having effective immigration control, the presumption rests with release from detention.

The Home Office said: “We are disappointed with the court’s ruling and are carefully considering the next steps.”