The Maryland General Assembly plans to address the state's forensic mental-health crisis during its upcoming session legislative session, weighing funding, hospital staffing and how long a mentally ill criminal suspect may be held in jail before being transferred for court-ordered psychiatric treatment.

A group of judges, including the state's District Court chief judge, recently told a joint panel of state lawmakers that it was important for the legislature to address the shortage of psychiatric beds for inmates deemed incompetent to stand trial.

State Sen. Thomas M. Middleton (D-Charles), chairman of the Senate Finance Committee, said he expects the legislature to take up the issue during its 90-day session, which begins in January.

Long waits for treatment for such inmates have been a persistent problem in Maryland and across the country. A 2016 survey of 25 states by the Treatment Advocacy Center, a nonprofit based in Arlington, found that 1,956 inmates with serious mental illnesses were waiting for beds in psychiatric hospitals after being ordered by a court to get treatment.

In Maryland, the number of inmates waiting has dropped from a high of 84 last year, when a lawsuit was filed to compel the transfer of defendants from jails to hospitals, to a low of 14 earlier this month.

Advocates and correctional officers attribute the long waits to more people with mental illnesses being arrested and state officials shifting resources away from psychiatric hospital beds. The wait list tends to grow during the summer and drop during the winter.

In a court opinion this year about the delays, retired Circuit Court judge Gale E. Rasin said the long-standing problem "seems to be all about the money."

District Court Chief Judge John P. Morrissey said it is typical for judges to see "individuals who are sick," unaware of their surroundings and unable to assist in their own defense in their courtrooms. Judges are increasingly frustrated with the current system, which allows some of those defendants to remain in jail without the treatment the court has ordered.

"It's not just legally required; it is morally, socially and economically desirable" to transfer defendants with mental illnesses to hospitals in a timely manner, Morrissey said.

Del. Erek L. Barron (D-Prince George's), a member of the House Health and Government Operations Committee, said he will propose legislation to address what he called a "self-inflicted" problem, created decades ago when states closed public psychiatric hospitals with plans to shift resources and patients to private facilities.

Despite recommendations from state health officials to provide more staffing and more beds, administration after administration has failed to appropriate enough money, Barron said. Former health secretary Van T. Mitchell called the bed shortage "a crisis."

Del. Kathleen M. Dumais (D-Montgomery), vice chair of the House Judiciary Committee, said she is hopeful Gov. Larry Hogan (R) will include sufficient funding in the budget to address the issue. "If not, we will have to include it in the negotiations with the governor's office," she said. "These things are critical, and we can't just keep kicking the can down the road."

Hogan spokeswoman Amelia Chasse said the governor plans to provide money for additional beds in his 2019 fiscal budget. She would not say how much money Hogan would offer. Chasse said details about the budget plan will be released in January.

Acting health secretary Dennis Schrader, who made the budget request, said the administration agrees that the legislature should set clear rules on the amount of time defendants may wait for beds.

Schrader, who took the reins of the agency last year, has been on the hot seat over the issue, much like his predecessors. In September, he and four other health department officials were held in contempt of court for their failure to eliminate the wait list.

Rasin said the waits persisted despite "years of notice about the problem, internal recommendations to increase bed size, admonitions by the judiciary, oversight of the legislature, civil charges of contempt of court, and commitments by its own Secretary."

The administration asked for, and received, a stay in the case from the judge, who ordered the state to fully staff and admit patients to 20-bed units at the Clifton T. Perkins Hospital Center in Jessup, Spring Grove Hospital Center in Catonsville and a third facility, to be selected in consultation with the state director of hospitals. Eighty-four defendants needed placement at the time the lawsuit was filed.

Health officials said the state plans to have 60 beds ready for inmates by the end of this year. An additional 35 are slated to be available by the end of March.

Schrader said the stay allows the administration to continue "implementing our fixes" while the state's appeal of the lawsuit moves forward next year.

"We need to have this discussion in the legislature this session," Schrader told the panel. He said later in an interview that the administration is considering offering its own legislative proposal.

Schrader said the department placed a 30-day limit on how long the state has to place an inmate in hospital treatment after he or she has been deemed incompetent to stand trial. Previously, there was no cap in place, he said, and the wait time rose as high as 60 days during the summer months.

Even 30 days "is not acceptable," Schrader told the legislative panel.