Faced with evidence that federal immigration agents in New York have routinely jailed almost everyone they’ve arrested during the Trump administration, a judge ordered them Tuesday to carry out the individualized bond review the law requires.

The decision by Judge Alvin Hellerstein at U.S. District Court in Manhattan applies only in New York, but it calls into question whether Immigration and Customs Enforcement is holding people unjustly across the country at a time when the COVID-19 pandemic ratchets up the danger of being incarcerated.

Since 2013, ICE has relied heavily on a computerized tool called the Risk Classification Assessment to evaluate whether to release someone pending a hearing. The New York Civil Liberties Union and Bronx Defenders charged in a lawsuit that “By mid-2017, ICE had changed the tool’s algorithm to prevent it from recommending that people be released on bond or their own recognizance.”

Federal authorities denied that ICE had created what the lawsuit called a “No-Release Policy,” but Hellerstein granted a preliminary injunction on the basis of the government’s own data. The numbers showed that starting in June, 2017, there was wholesale jailing in New York even of people the classification system judged to be a low risk of flight or danger to the community—a shift from freeing nearly half of those arrested to under 4 percent.

“The federal government’s sweeping detention dragnet means that people who pose no flight or safety risk are being jailed as a matter of course,” the lawsuit asserts, charging that it’s the result of the Trump administration’s “zero tolerance” policy.

New York State underscored the immediate health risk of this practice in a friend-of-the-court document the state attorney general filed on Monday. “Unnecessary immigration detention will only further burden the immigrant populations and state and local governments that are already dedicating all available resources to combating the current public-health crisis,” it said.

In criminal cases, defendants must be arraigned before a judge within 48 hours. But deportation is a civil matter, and under federal immigration law, ICE agents, not a judge, make the initial determination within 48 hours on whether to jail or release someone.

It then takes weeks before the case goes before an immigration judge and, often enough, that review results in the release of ICE’s detainee. According to a Daily Beast review of deportation cases initiated in immigration courts served by ICE’s New York office, immigration judges released 827 people ICE detained in fiscal year 2019, or about 36 percent of the cases.

They were detained a median of 41 days before getting an initial hearing before a judge, according to data maintained by the Justice Department’s Executive Office of Immigration Review, which runs the immigration courts.

In a hearing held by telephone late Monday afternoon, Assistant U.S. Attorney Brandon Waterman rejected accusations that ICE had rigged its algorithm for evaluating people taken into custody. He said that in any case, the final decision was made by a deportation officer and supervisor, not the algorithm, and that it was individualized.

Also, he said, ICE has been re-evaluating its decisions in light of the COVID outbreak, and had released about 100 detainees within 11 days.

But the government couldn’t explain the sharp shift in the numbers to the judge’s satisfaction. “The number of people who have been denied release, whether on bond or recognizance, has become so infinitesimally small as compared to what has been in existence, as to show such a fundamental alteration of the nature of the program,” he said. “And whether it is done by this Risk Classification Assessment … or by actions of arresting officers, or by their supervisor, really does not make a difference. There has been a change, a marked change, and there has been no recent explanation to support that.”

He ordered ICE’s New York field office director not to use whatever “more stringent or more onerous” evaluation may have been adopted in June, 2017 and required the government to report back to him on its progress by April 17.

While the order applies only to New York, the case has national implications since ICE has been using its Risk Classification Assessment since 2013. In a 2015 review, the Department of Homeland Security’s inspector general recommended revisions in it, saying that “the tool is time consuming, resource intensive, and not effective in determining which aliens to release or under what conditions.” And in 2018, an ICE spokesman had confirmed to Reuters that the previous year, ICE had changed the Risk Classification Assessment so that it no longer could issue a “release” recommendation—but said ICE officials could always override a recommendation to detain someone.

Robert Hodgson, an attorney for the plaintiffs, said that the case was based on data for New York arrests that a judge required ICE to release under the Freedom of Information Act. “ Certainly it’s the case that the risk assessment tool affects people across the country and that the Trump administration’s enforcement priority… is placing more and more people at risk of being detained unlawfully,” he said.

Nicholas Biase, a spokesman for U.S. Attorney Geoffrey Berman, declined to comment on the case. In court documents, New York ICE official William Joyce said the agency’s New York enforcement office “has no policy of denying release to all aliens.” He said that after “individualized custody review,” most people were held because they had been charged or convicted of crimes, or had prior orders of deportation.