Inmates from the medium- and maximum-security blocks at the D.C. jail. (2014 photo by Jahi Chikwendiu/The Washington Post)

A federal judge frustrated by the erroneous release of inmates dressed down District corrections officials in court Friday, calling the problem “a significant public safety issue” created by a department that has a history of high-profile missteps.

“I have no desire to run the Department of Corrections, but I can and I will if necessary,” U.S. District Judge Emmet G. Sullivan told city officials. “This is not rocket science to make sure that people aren’t released. . . . There has to be zero tolerance; nothing less is acceptable.”

Sullivan had ordered D.C. jail officials to appear in federal court Friday after an inmate awaiting federal trial was nearly set free despite a court order requiring that he remain held for public safety reasons. The jail held that inmate, Jarrell Harris, 23, only because authorities in Prince George’s County also placed a hold on him for charges he faced there. But at least five others facing federal charges have been improperly released since June 1, according to court records.

Corrections officials said Harris’s near-release occurred because the department failed to log a request from U.S. marshals to keep him detained.

Andrew Saindon, an attorney for the D.C. Department of Corrections, apologized and said the department has started to hire more staff members and an independent consultant to prevent future mistakes.

“We’re not here to make excuses,” Saindon said. “We’re taking concrete steps to fix the problem.”

Sullivan ordered corrections officials to report on their progress by July 11 before again appearing in court on July 31. The judge also ordered quarterly reports on the matter.

The judge had earlier ordered Harris detained after he left a halfway house in November while finishing a sentence for a case involving a threat to kill a co-worker. Harris had been loose for months before he was recaptured in a high-speed chase that left an officer injured, according to court records.

In similar instances, an inmate was freed after pleading guilty in a federal case, even though he had warned officials he was to be detained until sentencing. Another man was mistakenly freed in July even though he was awaiting trial on a stolen-firearms charge.

Sullivan said Friday’s hearing was to “draw a line in the sand” for a department that has made dangerous and costly mistakes in the past.

Sullivan invoked the “horrific” 1998 case of Leo Gonzales Wright, who committed two carjackings and a murder in the District while erroneously released before a pending drug trial. Sullivan, Wright’s trial judge, triggered an investigation by the U.S. Justice Department into the D.C. Corrections Department’s failings. The 1999 report led to funding for a new jail management information system, escorted inmate trips and an interagency working group that Sullivan now leads.

Then, as now, investigators found errors occurred most frequently with prisoners under the authority of both D.C. Superior and U.S. District courts because of prior convictions, with jail officials failing to track “dual-sentenced individuals,” Sullivan said.

“Essentially, the Department of Corrections is a mess, is the bottom line,” Sullivan said.

Sullivan also noted prior sweltering conditions at the D.C. jail, which has had problems with air conditioning. He said judges have planned unannounced inspections this summer.

Sullivan said he was not moving to find officials in contempt of court or trigger a broader investigation, at least for now. But he warned that failure to address problems could lead to potential constitutional violations.

“That is something the Department of Corrections wants to avoid,” Sullivan said. “That could create lawsuits, create damages, and take money out of taxpayers’ pockets.”