By MARLENE LENTHANG, ABC News

(NEW YORK) — A judge has ruled New York must offer the COVID-19 vaccine to all inmates in state prisons and jails immediately, condemning their exclusion from the shots as “unfair and unjust.”

On Monday, Bronx Supreme Court Justice Alison Y. Tuitt called the exclusion of incarcerated populations from the vaccine “arbitrary and capricious” and “an abuse of discretion.”

She said New York “irrationally” prioritized other populations living in congregate facilities, such as nursing homes and long-term care facilities, but not prisons, putting “great risk to incarcerated people’s lives during this pandemic.”

The state allowed staffers of the Department of Corrections and Community Supervision to get vaccinated in late January.

On Feb. 5 the state allowed inmates 65 years old and up to get the vaccine, about a month after the state opened the vaccine to everyone 65 and older, and as of Tuesday, 822 of 1,066 eligible inmates were inoculated, Gov. Andrew Cuomo’s office said. Youth living in juvenile detention facilities were declared eligible for the vaccine in late February, and inmates with comorbidities were given access to the shots on March 5, after New York opened eligibility to people with comorbidities on Feb. 15.

The ruling was in response to a lawsuit filed last month by two Rikers Island inmates, Charles Holden, 52, and Alberto Frias, 24.

“[Rikers Island] is very unsanitary and risky. It is impossible to stay six feet apart,” Holden said in a statement through the Legal Aid Society. “You eat together, you use the same showers. DOC does not supply masks within the housing area, so people are walking around without masks. I am simply asking to be treated fairly and with dignity.”

The judge’s ruling noted that Cuomo announced Monday that all New York residents 30 and older will be eligible to the vaccine effective Tuesday. “However, as of today, Petitioner Frias and other incarcerated individuals under the age of of 30 years of age are still not eligible for the vaccine,” Tuitt wrote.

Advocates praised the move to allow all inmates to get the vaccine.

“Governor Cuomo’s decision to withhold the vaccine from the people confined to dense, congregate settings of jails and prisons always ignored the unambiguous public health guidance that called for priority vaccinations in this uniquely dangerous setting, and exacerbated the vastly disproportionate toll of this virus on Black and Latinx communities,” Mary Lynne Werlwas, director of the Legal Aid Society’s Prisoners’ Rights Project, told ABC News.

“These New Yorkers should have had priority access to the vaccine, and this never should have required litigation,” she added.

The governor’s office did not comment on why the vaccine was initially withheld from the entire inmate population.

“Our goal all along has been to implement a vaccination program that is fair and equitable, and these changes will help ensure that continues to happen,” acting counsel to the governor Beth Garvey said in a statement.

The decision over whether to inoculate incarcerated populations was a contentious issue in the early days of the vaccine rollout, following COVID-19 outbreaks at prisons across the country.

As of February, just 15 states allowed inmates to be eligible for the COVID-19 vaccine before New York joined them this week, according to the Kaiser Family Foundation, a nonprofit that covers national health issues.

The Legal Aid Society said jail and prison populations are now surging to pre-pandemic levels of COVID-19 infection.

As of March 19, 577 people in New York DOC custody have COVID-19 — an increase from 306 people at the beginning of 2021, according to state data. There are currently 31,342 incarcerated people in state correctional facilities, according to Cuomo’s office.

A total of 6,273 COVID-19 cases among the incarcerated population have been documented by DOCCS, 6,099 of whom have recovered, according to last week’s COVID-19 update. There have been 35 reported incarcerated population deaths due to the virus.

Copyright © 2021, ABC Audio. All rights reserved.