Corrections officers and medical staff of the Montgomery County Correctional Facility explain the treatment of the mentally ill inside the 40-unit crisis intervention center. (Astrid Riecken/For The Washington Post)

Maryland health officials say they have nearly eliminated the backlog of people who have been charged with crimes but require psychological treatment or evaluations, reducing the need to put those people in jails that cannot address their needs.

The Maryland Department of Health and Mental Hygiene said the number of people on its forensic waiting list has dropped from a high of 84 in May to 12 this month.

The reduction, which was discussed at a legislative hearing on Tuesday, comes after mental health advocates and corrections officials raised concerns that a shortage of beds at Maryland’s five state mental hospitals had reached a crisis point.

Some judges asked state health officials, including Health and Mental Hygiene Secretary Van T. Mitchell, to appear in court to explain why they could not comply with legally binding orders.

In April, Mitchell sent a letter to a judge in Prince George’s County saying that the state’s mental hospitals were full but that he was creating a work group to address the situation and working on ways to move patients more efficiently through the system.

The problem dates back about 10 years, but it has grown worse recently. Experts say factors contributing to the rise include an increase in the number of people with mental illnesses being arrested and booked into jails without a corresponding expansion of state mental-health facilities; patients staying longer for acute illnesses; and private-care providers not accepting former criminal defendants who need ongoing help.

On Tuesday, health officials testified before lawmakers from state legislative committees that they trimmed the wait list in large part through a new initiative focused on discharging longtime patients who have been deemed “medically ready” for release.

Barbara J. Bazron, executive director of Maryland’s Behavioral Health Administration, said the agency discharged 49 of 98 people who met the criteria, but only after “looking at their individual cases and individual needs . . . and connecting them to the services and support they need in the community.”

Del. Kathleen M. Dumais (D-Montgomery), vice chair of the House Judiciary Committee, said the health department needs to tackle those remaining on the wait list with urgency, saying the patients sitting in jail are “being illegally detained, and we need to find beds to treat them.”

Health officials said they will follow the recommendations from the work group that Mitchell convened this summer to develop solutions for the backlog, including increasing bed capacity, adding more staff who are trained to deal with vulnerable populations, standardizing the processes for accepting and discharging patients at state mental hospitals and expanding the availability of crisis services and outpatient clinics.

Baltimore City District Court Judge George Lipman, one of three members of the judiciary at the hearing, credited Mitchell with being “very sincere in taking ownership of the issue,” but he noted that lawyers for the health department have argued that current law is not clear about whether state mental hospitals must accept all people who are ordered by courts to undergo treatment or evaluations. He asked the committees to reaffirm the legislative intent of the statute.

Sen. Robert A. Zirkin (D-Baltimore County), who chairs the Judicial Proceedings Committee, asked whether the legislature needs to tweak the language of the law to reaffirm its intent.

“I think the statute is very clearly written,” Lipman said, adding that the legislature could wait to see whether improvement continues before deciding whether to take action.

Lipman also said Mitchell needs to hire more mental-health employees.

“He needs more staff,” the judge said. “We can’t do it with smoke and mirrors. There has to be resources.”