A federal judge said Tuesday that she will order an emergency inspection of the D.C. jail while weighing whether to release prisoners after the number of inmates infected with the novel coronavirus quintupled from five cases to 28 in little more than a week, and the system transferred the first patient to a hospital.

The D.C. jail system has more confirmed coronavirus ­cases than all but four of 142 Federal Bureau of Prisons facilities nationwide, according to federal authorities, although its outbreak is not as widespread as those in jails in New York City, Chicago and other major urban areas. Tuesday’s hearing came as the D.C. jail system has cut its population by more than 300 prisoners in three weeks.

“This is an emergency. This is a pandemic. The numbers are increasing,” U.S. District Judge Colleen Kollar-Kotelly said, vowing to move swiftly during a hearing held by videoconference.

The American Civil Liberties Union and D.C. Public Defender Service filed an emergency federal class-action lawsuit March 30, alleging that the D.C. government has acted “too little and far too late” to fight the pandemic within jail facilities that house about 1,500 inmates, down almost 20 percent from about 1,830 in March.

The lawsuit alleges that the jail has not followed safety measures suggested by the Centers for Disease Control and Prevention — such as keeping inmates and employees six feet apart in cells or communal areas — to avoid contracting the virus. The lawsuit also asserts that D.C. officials have been “deliberately indifferent” to prisoners’ health.

At Tuesday’s two-hour hearing in Washington, Kollar-Kotelly said she is considering appointing a prison downsizing expert to recommend categories of inmates who could be safely released or monitored outside the jail while housing the rest, at lower risk of infection. Those who filed the lawsuit have requested an outside monitor to recommend inmate releases and ensure compliance with cleanings, disinfection and health screenings of inmates, staff and visitors.

Kollar-Kotelly directed both sides to decide on an independent inspector by Wednesday morning, citing the “wide gap” between jail conditions described by officials and those alleged by inmates in sworn declarations.

“My point is not to credit one side’s claims or the other’s, but I need to have answers, facts, and someone who actually goes in and looks,” Kollar-Kotelly said.

The judge cited the urgency to act as the jail infection rate is climbing multiple times higher than that of the city as a whole, even as testing of inmates has lagged. One out of every 6 inmates is now under quarantine or isolation, the department has reported.

The U.S. attorney’s office has opposed the “wholesale and indiscriminate” release of violent offenders serving sentences after being convicted of crimes including armed assaults on the public and police, bomb threats, voyeurism, stalking, indecent exposure, and domestic violence.

“This pandemic should not be used as a basis to release violent criminals onto the streets of Washington,” U.S. Attorney Timothy J. Shea said in a statement. “Now more than ever, as law enforcement authorities are being stretched thin due to the impact of covid-19, the rule of law must be maintained.”

The union representing 3,600 D.C. police officers and sergeants has backed that stance, saying in a tweet Tuesday morning: “Those who were victimized deserve justice. Beyond that, we already have our hands full out here.”

D.C. Public Defender Service attorney Steven Marcus warned that the disease could “spread like wildfire.” He said that as recently as this weekend, the jail was allowing up to 40 inmates at a time to share recreational spaces — a figure since cut to 10.

“We have men who are coughing up blood, who despite putting in seven requests for medical visits have not been able to see a doctor,” Marcus said. “People working in kitchens while displaying coronavirus symptoms, being forced to work in the kitchen where they potentially can infect other residents and jail employees.”

The D.C. corrections workers union supports the lawsuit. The union accused officials of “guaranteeing and accelerating the rampant spread of covid-19,” the disease the virus causes, by providing no masks, gowns, disinfectants or comprehensive screening.

In court Tuesday, attorney Micah Ian Bluming with the office of D.C. Attorney General Karl A. Racine said that plaintiffs cannot show that the D.C. Department of Corrections is violating inmates’ constitutional rights by acting with “deliberate indifference” to their health or safety.

Bluming argued that the agency is complying with formal procedures and consulting with the District and outside health experts.

The jail has banned outside visitors and halted inmate group activities. It has also ordered inmates confined for all but 30 minutes every day. Inmates with symptoms are monitored by medical officials and will be hospitalized if needed.

Kollar-Kotelly also directed the jail to come up with an alternative to cutting off inmates’ rights to defense counsel, which she said officials had effectively done by barring attorney visits and allowing only 10-minute daily calls. Calls occurred in the same half-hour inmates had to shower, clean, eat a meal and leave their cells, Marcus said. Jail officials later agreed to allow 30-minute calls.

As of Tuesday, 28 inmates had tested positive for the coronavirus — up from five on March 30. An additional 232 inmates — an 80 percent increase in one day — are under quarantine and suspected of having the coronavirus because they showed symptoms or may have been exposed to inmates with the virus, according to the Department of Corrections.

The jail said the first inmate who has tested positive for the virus and was transported to a hospital is a 51-year-old man who was admitted for “observation.”

The Federal Bureau of Prisons reported Monday that 241 federal inmates and 72 employees at all of its facilities have tested positive.

Washington’s jail population has fallen as police issue more citations and make fewer arrests, with daily D.C. Superior Court presentments plunging from 100 a day to about 15, Kollar-Kotelly said.

D.C. Superior Court judges also have released 108 defendants awaiting trial on bond change motions — half for felonies and half for misdemeanors. A backlog of cases remains, and other cases require more details about defendants’ health and potential dangerousness. Federal judges also have released more than 20 pre­trial defendants or inmates near the completion of their sentences.

The number of inmates convicted of nonviolent misdemeanors has also fallen by half, from 94 to 46, the judge said, under D.C. Council emergency legislation that provides for accelerated good time credits toward release.

Many defendants released suffer from medical conditions that put them at heightened risk of death in case of coronavirus infection. Several have been sent to high-intensity supervision, home confinement or other less-restrictive conditions.

In agreeing with a release in one case, prosecutors noted that the government “takes serious consideration of the defendant’s health and his circumstances, however, from the government’s perspective, this motion is not an invitation to release all defendants simply because of covid-19.”