NEW YORK (AP) – Newly detained immigrants must appear before a judge within 10 days, rather than the weeks or months they’ve sometimes had to endure in recent years, a judge said November 30.

Civil rights groups praised the ruling by U.S. District Judge Alison J. Nathan as the first of its kind in the nation to set such a rule for the U.S. Immigrations and Customs Enforcement agency. They said in a release that the ruling would strike a blow to federal immigration authorities who hold detained immigrants indefinitely before they appear before a judge.

A law authorizing the detention of immigrants while removal proceedings are pending “does not negate class members’ interests – of the utmost importance – in freedom from imprisonment,” said Judge Nathan. “Class members may not have a ‘fundamental right to be released during removal proceedings,’ but nor does the government have an unfettered right to detain them.”

In 2014, the average wait to see a judge was 11 days, but it had stretched to over a month in 2017 and nearly three months in 2018, according to the judge’s ruling.

“A few weeks or months of sitting in inhumane ICE detention facilities can be dangerous and devastating for individuals and their families,” said Niji Jain, an attorney at The Bronx Defenders. “The Court’s ruling recognizes that prompt access to an immigration judge is a fundamental right – one that is all the more important when detention facilities are hotbeds for the spread of COVID-19.”

Shemar Michel said ICE officers told him he’d be home by dinner time when they picked him up as he prepared his children for school. He said he didn’t see a judge for six weeks.

“During that time, I was mentally shattered, I missed my son’s second birthday, and I felt like I had no chance to fight my case,” he said. I told the ICE officers I would rather buy my own plane ticket home than stay in ICE detention any longer.”

The civil rights groups said in their release that many individuals held for months were entitled to release. They said about 40% of them were eventually released on bond. Others, they added, were U.S. citizens or lawful permanent residents. Additionally, the average petitioners have lived in the United States for 16 years and nearly a third are lawful permanent residents.