The 10 detainees asked for their release "because of the public health crisis posed by COVID-19," their petition said.
The men and women had been detained by federal immigration authorities and had removal proceedings pending in immigration court. They were being held at three jails in New Jersey where either detainees or staff had tested positive for coronavirus.
"Each Petitioner suffers from chronic medical conditions, and faces an imminent risk of death or serious injury in immigration detention if exposed to COVID-19," the decision said.
Tune into ABC at 1 p.m. ET and ABC News Live at 4 p.m. ET every weekday for special coverage of the novel coronavirus with the full ABC News team, including the latest news, context and analysis.
The jails where the detainees were being housed has each reported confirmed cases: two detainees and one correctional officer in the Hudson County Jail; one detainee at the Bergen County Jail; and a superior officer at the Essex County Jail.
"The nature of detention facilities makes exposure and spread of the virus particularly harmful," Judge Analisa Torres wrote.
"Moreover, medical doctors, including two medical experts for the Department of Homeland Security, have warned of a 'tinderbox scenario' as COVID-19 spreads to immigration detention centers and the resulting 'imminent risk to the health and safety of immigrant detainees' and the public," she added.
The decision also cited the "failure" of jail operators to say with certainty the detention facilities were in a position to allow inmates to remain 6-feet apart, as recommended by the Centers for Disease Control and Prevention.
New York has been particularly hard-hit by the virus. There have been at least 39,125 cases in the state and at least 454 deaths, according to data compiled by the Center for Systems Science and Engineering at Johns Hopkins University.
ICE detainees in facilities with coronavirus cases ordered released by judge originally appeared on abcnews.go.com