Marvae Dunn had no business being in prison. He is severely mentally ill. At age 64, he can barely speak or follow simple instructions. How could he stand trial on first-degree murder charges of shooting his sister-in-law?

He never did, yet Dunn's home for seven years was a Philadelphia prison infirmary, until advocates intervened. He was transferred Monday to a state nursing home in Franklin County.

"We're subsidizing failure," said his prison chaplain, Phyllis Taylor. The legal system failed Dunn and the taxpayers who bore the cost of his imprisonment. While neighbors had remarked on his erratic behavior, he didn't seem to be getting mental health services. Perhaps if Dunn, eligible for disability assistance, had received proper medication and supervision, he might not have spent seven years on Street Road.

Let's be clear: Dunn's sister-in-law is dead, and he certainly belonged somewhere in custody. Though Dunn's is an extreme case, as The Inquirer's Melissa Dribben reported, he has company. Profoundly mentally and emotionally ill residents are being warehoused in prisons, many for nonviolent crimes. A third of Philadelphia's male prison population is mentally ill, and 80 percent of female inmates are prescribed psychiatric medicines, half for severe illness. "It's totally immoral," said Taylor, who assisted Dunn in his transfer.

"This is the largest psychiatric facility in Pennsylvania," said prison medical director Bruce Herdman, a statement that should make no one proud.

Inmates with mental illness tend to be indigent and barely literate, and are often accompanied by a long history of self-medicating with illegal drugs. They are frequently homeless. Their sentences are 30 percent longer, with a 20 percent higher rate of recidivism. "This is no place for these people," Herdman said. Yet the irony, said Maureen Barden of the Pennsylvania Health Law Project, is, "inmates get more care and faster care inside the prison."

Philadelphia is not alone. More than 20 percent of state inmates, 10,000 prisoners, are treated for mental and emotional illness. With the necessary dismantling of failed public mental-health institutions like Byberry, Barden said, "jails and prisons are the de facto mental health institutions at this time."

We took one failed model and replaced it, in desperation, with another.

Prison is a lousy economic approach, too, far more costly to taxpayers than treating patients at community health centers or in group homes. The annual inmate cost is $30,000, and more than double for older prisoners like Dunn with chronic major medical illnesses.

"These people are in absolute need of treatment, not only because it's humane and right for them, but also because it's the most cost-effective," said Common Pleas Court Senior Judge Benjamin Lerner.

Better, earlier, and consistent treatment is necessary, experts say. Funding, much of it federal, is available. Mental illness has long been regarded as a poor stepchild, but the Affordable Care Act recognizes the necessity of proper mental-health care.

"We're beginning to address this issue in a systemic and comprehensive way, criminal justice in partnership with the behavioral health system," said Arthur C. Evans Jr., the city's behavioral health commissioner. The city serves 120,000 residents annually for mental-health issues and substance abuse.

The police department has trained 2,000 officers to recognize psychiatric distress. A mental-health court helps get defendants medical assistance. With proper treatment and regular supervision, Evans said, patients with severe illness such as bipolar disorder "can and do recover. They do find work." His goal is to get 10,000 residents trained in mental-health first aid "to recognize and assist in getting people help. Otherwise they are going to languish."

The aim is to get the next Marvae Dunn assistance before he allegedly gets his hands on a gun.

Lawyer David Rudovsky, who has sued the county and state over prison conditions, said, "A lot of people with mental illness don't have jobs, family. You've got to create that network of support. It's certainly less expensive than locking people up."

We need "a serious housing policy," Evans and other experts said, but residents often resist even the smallest group home in their neighborhood. "Many of these people have had such traumatic lives since the time they were born. Despair is a huge problem," said Taylor, who has seen prisoners so mentally impaired they have no comprehension of their actions.

Especially when so many shouldn't be there. This is a medical, financial, and moral failure.

"It's a tragedy to put people in jail for their illness," Evans said. "People do not get locked up for diabetes or hypertension. We have to do everything we can to prevent it."

215-854-2586 @kheller