A federal judge in Washington, D.C. ruled Monday that the federal government must consider on a case-by-case basis whether asylum-seekers who have been detained represent a flight risk or credible danger to the public.

The ruling by U.S. District Court Judge James Boasberg blocks the Trump administration from keeping asylum-seekers in custody until their immigration proceedings are dealt with.

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

The ACLU, the Center for Gender and Reugee Studes and Human Rights First sued the administration on behalf of nine asylum-seekers, claiming that five U.S. Immigration and Customs Enforcement field offices had "almost entirely" stopped granting asylum-seekers so-called "humanitarian parole."

The ICE offices singled out in the lawsuit are in Detroit, El Paso, Los Angeles, Newark and Philadelphia.

The ACLU claimed that the indefinite detention policy violated the Constitution, immigration law, and the Department of Homeland Security's own policy dating back to 2009.

Boasberg agreed, writing that he was doing "no more than hold the Government accountable to its own policy, which recently has been honored more in the breach than the observance."

"To mandate that ICE provide these baseline procedures to those entering our country – individuals who have often fled violence and persecution to seek safety on our shores – is no great judicial leap," he added.

There was no immediate comment from the Department of Homeland Security or the Department of Justice.

Fox News' Casey Stegall contributed to this report.