Virginia’s state mental hospitals are “dangerously” full, and staffing shortages are leaving facilities “overwhelmed” — a long-standing problem that has been exacerbated by the pandemic, according to the state agency in charge of the facilities.

But lawmakers and policy experts hope to use money from the latest federal pandemic relief package to create systematic changes that will free inpatient beds and develop community services to keep people out of hospitals in the first place.

“We have the opportunity with these funds to really do something transformational. That is what we are asking for,” said Alison Land, commissioner of the state Department of Behavioral Health and Developmental Services, which runs the state mental hospitals.

The General Assembly will decide how to spend about $4 billion Virginia is getting from the American Rescue Plan when it reconvenes in August.

In the meantime, a joint subcommittee studying mental health services is racing to prepare its recommendations to the General Assembly for how to use the funds in time for the session.

The panel is known as the Deeds Commission, in honor of Sen. Creigh Deeds (D-Bath), an outspoken advocate for mental health treatment after his son stabbed him in 2013 before killing himself during a mental health crisis.

In a virtual session of a Deeds Commission work group this month, Land presented a dire picture of the state’s mental health facilities.

The state’s nine inpatient psychiatric hospitals, which have a total of 2,124 beds, are operating at an average 98 percent capacity, she said. The Northern Virginia Mental Health Institute in Falls Church, for example, has 135 patients but only 134 beds, according to a slide titled, “Problem: State Hospital Census is Dangerously High.”

When hospitals are overcrowded, it’s dangerous for the patients and employees, Deeds said.

“At some of these hospitals, there are assaults every day. Overcrowding creates an environment where it’s very difficult to think people can get well,” he said in an interview.

The problem worsened during the pandemic. Efforts to contain the spread of the coronavirus — such as physical distancing — have had unintended consequences throughout the mental health system.

A law requiring the state to provide a bed of last resort when a person needs acute mental health care — intended to prevent people in crisis from leaving before a bed could be found, as happened with Deeds’s son — made it impossible for already crowded facilities to isolate and quarantine patients who tested positive or were exposed to the coronavirus.

Gov. Ralph Northam (D) last summer issued an executive order pausing the rule, allowing hospitals to refuse patients until they had a bed available.

But the lifting of the rule, coupled with overburdened mental health hospitals, meant people suffering from psychiatric crises could spend hours and even days in emergency rooms in the custody of sheriff’s deputies, waiting for a bed. Deputies become involved when a person in crisis is charged with a crime or needs to be involuntarily committed.

John Jones, executive director of the Virginia Sheriffs’ Association, told the Deeds Commission work group that the situation leads to patients languishing without care, while taking sheriff’s deputies away from other duties.

“If there were more beds available . . . that would solve two problems: the patient needs and the law enforcement pressure,” Jones told lawmakers.

But Anna Mendez, board president of the nonprofit advocacy group Mental Health of Virginia and executive director of the Charlottesville affiliate, Partner for Mental Health, said more beds are not the answer. Instead, she said, the state must address mental health needs before they become severe enough to require hospitalization.

While most states spend 75 percent of public mental health dollars on community services and the remaining quarter on inpatient hospitals, it’s the opposite in Virginia, she said. Per capita, only Wyoming and North Dakota spend more on inpatient hospitals.

“When you fund state hospital beds at the expense of building out a community-based system, you create a perverse loop where you just need more and more hospital beds. That is the situation we find ourselves in,” she said.

And even if the state had more beds, there may not be enough people to staff them.

In March 2020, as the pandemic set in, the department had more than 1,000 job vacancies, including nurses, internists and psychiatrists. By early this month, the number had ballooned to about 1,300, “leaving facilities overwhelmed,” Land, the state commissioner, said in the presentation.

Across the state, job vacancies in mental health hospitals were well over 20 percent — and in some cases, up to 50 percent, she said.

During the pandemic, not only were people hesitant to work with a population in need of acute care, but they also could earn as much elsewhere without exposing themselves and their families to the coronavirus, Land said.

Angela Harvell, deputy commissioner for facility services at the Department of Behavioral Health and Developmental Services, said more than 1,700 patients and employees in mental health facilities tested positive for the coronavirus, and 27 patients died of the disease it causes.

“It was a tremendous challenge because we maintained a 100 percent census almost throughout the entire pandemic,” Harvell said.

Land said the state has paid retention and recruitment bonuses and hazard pay but has not been able to fill direct care positions where salaries are well below market rate.

“They are overworked and underpaid, as the saying goes,” Del. Patrick Hope (D-Arlington), who sits on the Deeds Commission, said in an interview. “They are clearly working extremely hard under difficult conditions.”

Deeds said that in addition to raising pay and providing incentives, the state should better fund loan repayment programs for people who go into behavioral health in underserved areas, which could be all of Virginia.

There have been many grim milestones in the history of mental health treatment in Virginia, which is home to the oldest psychiatric hospital in the nation. Eastern State in Williamsburg was founded in 1773 and operates 302 beds today.

In 2007, a gunman with a history of mental health problems killed 33 people on the campus of Virginia Tech in Blacksburg. In 2013, it was the Deeds attack.

Two years later, Jamycheal Mitchell died in a Hampton Roads jail as he waited for space at a mental hospital. Each time, legislation followed — intended to prevent another tragedy.

“When all the sudden there’s a crisis, everyone pays attention,” said Sen. T. Montgomery “Monty​” Mason (D-Williamsburg), who leads a Deeds Commission work group.

He is hopeful the legislature will devote significant federal funding to programs to address the mental health crisis.

Advocates say the state is in need of more intervention centers, staffed with security, where people in crisis can bypass the emergency room to get immediate mental health treatment.

Land said the state has contracts with private mental health facilities to divert patients from public hospitals, with plans to add more. The state has also launched a multiyear effort to add more community services to every region.

Mendez, the patient advocate, said she is hopeful the federal money will make even more of a difference.

“We tell our patients, ‘Nothing changes until something changes,’ ” she said.