A federal judge on Monday determined that the US government is violating its own rules regarding the treatment of people seeking asylum.

Judge James Boasberg issued a preliminary injunction ordering the Immigration and Customs Enforcement agency to stop what opponents called the arbitrary detention of legitimate asylum seekers.

Boasberg has also ordered the US government to immediately release or grant hearings to more than 1,000 asylum seekers.

Many of these immigrants have been jailed for months or years without their cases being reviewed.

A federal judge on Monday determined that the US government is violating its own rules regarding the treatment of people seeking asylum

The decision comes after the ACLU discovered that almost all asylum seekers have been detained since Trump has come into office, flipped from 10 per cent to 96 per cent

'As the events of recent months make clear, the question of how this nation will treat those who come to our shores seeking refuge generates enormous debate,' Boasberg wrote in his 38-page opinion, obtained by The Washington Post.

'This Opinion does no more than hold the Government accountable to its own policy, which recently has been honored more in the breach than the observance.'

'Having extended the safeguards of the Parole Directive to asylum seekers, ICE must now ensure that such protections are realized.'

The court decision is yet another blow to the Trump administration's immigration policies, which just weeks ago ended its own policy to separate children from parents at the US-Mexico border.

'This ruling means the Trump administration cannot use indefinite detention as a weapon to punish and deter asylum seekers,' said Michael Tan, senior staff attorney with the American Civil Liberties Union's Immigrants' Rights Project.

Judge James Boasberg issued a preliminary injunction ordering ICE to stop what opponents called the arbitrary detention of legitimate asylum seekers

The court decision is yet another blow to the Trump administration's immigration policies, which ended its own policy to separate children from parents at the US-Mexico border. Pictured is an Hondura family seeking asylum after being detained in Texas

All immigrants seeking asylum must initially pass a 'credible fear' screening to determine if they face a threat of persecution in their home countries. Those who fail that standard are deported immediately.

Previously, those who passed were usually given humanitarian parole while awaiting an immigration hearing, provided they were not considered flight risks or dangers to the public.

Under former President Barack Obama's administration, ICE granted humanitarian parole to more than 90 per cent of asylum seekers.

But the ACLU sued when it discovered that the rates have almost completely flipped since Trump took office, with 96 per cent being detained in the first eight months of 2017 compared to 10 per cent in 2013.

Lawyers for the ACLU and other groups argued in May that since the start of Trump's administration, the number of people granted such parole has dropped to almost zero in five key ICE field offices.

Those denied parole have instead been detained. In one case, a former ethics teacher from Haiti has spent more than 18 months in prison.

Many of these immigrants have been jailed for months or years without their cases being reviewed. Pictured is a mother who was separated from her daughter for two months after arriving in the US to flee violence in Guatemala

Boasberg, in a 38-page memorandum opinion, concluded that 'the numbers here are irrefutable,' and ordered a case-by-case review of all asylum seekers awaiting parole.

He is also preventing the government from carrying out blanket detentions of asylum seekers in Detroit, El Paso, Texas, Los Angeles, Newark, New Jersey, and Philadelphia.

Boasberg has granted provisional class status to asylum seekers and ordered that ICE cannot detain any applicant for more than seven days without reviewing their case.

Meanwhile, the lawsuit will continue with a status hearing July 10.

ACLU's lawsuit was filed on behalf of nine detained asylum seekers, some of whom have been jailed for up to two years while waiting for a hearing.

The Justice Department has argued that asylum detention decisions should not be reviewed by the courts.