A federal judge handed down a series of mandates Thursday designed to help keep Cook County jail inmates safe from the coronavirus, but he ultimately refused to order their release to home incarceration or other forms of custody.

U.S. District Judge Matthew Kennelly partially granted a temporary restraining order sought by pre-trial detainees at the jail with his 37-page ruling. But he also acknowledged the difficulties faced by Cook County Sheriff Thomas Dart in running the jail. The judge described the complex as “a campus of separate physical facilities” with a population “the size of a small (but not all that small) town.”

Still, Kennelly wrote that it is full of people the government has decided to imprison “pending determination of their guilt or innocence, and by doing so the government takes on an obligation to protect their health and safety.”

“And it cannot be forgotten that by requiring this, we safeguard the health and safety of the community at large — from which the detainees have come and to which they and the officers guarding them will return,” Kennelly wrote.

The jail has been recognized as a national hotspot for the coronavirus, the judge noted, writing that “the jail currently has the highest rate of new coronavirus infections in the country, and it far exceeds that of Cook County.” As of Monday, he wrote, the infection rate in Cook County was 1.56 per 1,000 people. In the jail, he wrote, it was 50 per 1,000 people.

“The (detainees) have demonstrated that certain of the conditions created by the intentional actions of the sheriff enable the spread of coronavirus and significantly heighten detainees’ risk of contracting the virus,” Kennelly wrote.

Kennelly wrote that sheriff’s personnel have not been cleaning common spaces after an inmate in that area has tested positive for coronavirus. He also wrote that “detainees are being housed under conditions that make social distancing impossible,” making note of beds “separated by only one to four feet” and rooms that are “like a military barracks.”

Finally, the judge wrote that Dart has not provided inmates with adequate supplies of soap, cleaning supplies or personal protective equipment like facemasks.

Therefore, the judge ordered the sheriff to implement, by Saturday, a policy “requiring prompt coronavirus testing of detainees who exhibit symptoms consistent with coronavirus disease” as well as detainees who have been exposed to such individuals. He also ordered the sheriff to enforce social distancing during the new inmate intake process by Saturday, “including suspending the use of bullpens to hold new detainees awaiting intake.”

On Friday, the sheriff must begin “providing soap and/or hand sanitizer to all detainees in quantities sufficient to permit them to frequently clean their hands.” He must also provide sanitation supplies to staff and detainees so they can “regularly sanitize surfaces and objects on which the virus could be present.”

Finally, the sheriff must provide face masks to all quarantined detainees by Sunday.

In a statement, the sheriff’s office said: “We appreciate that the judge acknowledged the many unique and aggressive efforts that the office has undertaken to identify and help those who catch the virus and to limit its spread. Much of what the court is requiring today has been well underway for weeks and even months in some cases.”