It is rare to find police, sheriffs, prosecutors, defense attorneys, judges, prison officials and human rights activists all on the same page. But across the criminal justice spectrum there is a striking consensus that something has gone painfully awry: the nation's jails and prisons have become mental health facilities – a role for which they are singularly ill-equipped.

At least one in six prisoners in the United States is mentally ill – well over 300,000 men and women. There are three times as many mentally ill in U.S. prisons as in the country's mental health hospitals, suffering from schizophrenia, bipolar disorder and major depression, among other illnesses.

Three decades ago few prison systems provided any mental health treatment. Most now offer something, but nowhere near enough – in quality and quantity – for the soaring number of prisoners with serious mental illness. Understaffing, insufficient specialized facilities and limited programs leave prisoners without the treatment they need.

Untreated or undertreated, mentally ill prisoners suffer painful symptoms. They rant and rave, babble incoherently or huddle silently in their cells. They talk to invisible companions and live in worlds constructed of hallucinations. They lash out without provocation and often refuse to obey orders. They beat their heads against cell walls, cover themselves with feces, and self-mutilate until their bodies are riddled with scars. Many attempt suicide; some succeed.

How is it that such desperately ill and vulnerable people are incarcerated? The quick answer is they committed a crime and were sentenced to prison by judges increasingly reluctant to declare defendants incompetent to stand trial and by juries increasingly loath to find them "not guilty by reason of insanity."

The longer answer is that the mentally ill are victims of two failed public policies.

The first is the failure of public officials to ensure an effective mental health system. Beginning in the 1960s, a process of "deinstitutionalization" freed mentally ill men and women from the bleak mental hospitals in which they had previously been dumped. But the system of community-based mental health services envisioned by the architects of deinstitutionalization never materialized. Today, community mental health services are a shambles.

People living with mental illness – especially if they are poor and homeless and have substance abuse problems – find it nearly impossible to obtain help. Untreated, they can find themselves on the margins of society, deteriorate psychiatrically and may ultimately break the law.

As criminal offenders, they then confront the second failed public policy: punitive laws, such as mandatory minimum sentences, that send people to prison even for low-level nonviolent crimes. As these laws have sent the U.S. prison population soaring to levels unimaginable in the rest of the world, so they have propelled the incarceration of many mentally ill.

Tragically, for some of the mentally ill, jail or prison may be the first time they have received any mental health services. But the more common experience of the mentally ill behind bars is to receive little or no meaningful treatment. Committed mental health professionals working in prisons acknowledge that treatment is often limited simply to medication.

Prisons were never designed for and are not now run to accommodate the unique needs of the mentally ill who find it difficult to abide by the formal and informal rules that govern prison life. Prison staff neglect them, accuse them of malingering and treat them as disciplinary problems. Other prisoners exploit and victimize them. Some correctional staff mock them, ignore their suffering or even use excessive force against them – covering them in pepper spray when they will not stop yelling, hitting them and even, in a few cases, suffocating them to death through improper methods of control.

Prisoners who break the rules because of their illnesses are punished. Even self-mutilation and attempted suicide are dealt with as disciplinary matters. Mentally ill prisoners who break too many rules, who "act out" or who are otherwise unpleasant or disruptive, are locked up interminably in segregated units or supermax prisons that provide high-security solitary confinement.

Indeed, these special segregation or isolation units are disproportionately populated by mentally ill prisoners. There they live 24 hours a day in small, sometimes windowless cells, allowed out for solitary exercise in a barren space a few times a week. They have little or nothing to do all day. Mental health treatment and programs are even worse for isolated prisoners than elsewhere in the prison systems.

Prolonged solitary confinement is hard enough for anyone. But it can be overwhelming for people whose coping mechanisms are weakened by mental illness. Many will break down completely into acute psychosis, and then have to be taken to a hospital for intensive psychiatric treatment. Once stabilized, they are returned to solitary confinement, where the cycle of their deterioration repeats.

The misery of the mentally ill in prison is not only appalling, it is unnecessary. Recommendations abound for effective steps that would strengthen community-based mental health services. There is also growing recognition of the need to divert nonviolent mentally ill offenders from the criminal justice system into treatment facilities and to ensure that dangerous offenders with mental illness are confined in secure facilities that meet their mental health needs.

Some Americans no doubt question why mentally ill offenders should receive publicly funded mental health care when countless people who have not committed a crime cannot. The answer is that everyone in the United States should have access to medical and mental health care for serious illnesses. Unfortunately, the Constitution only recognizes the state's obligation to care for those who are incarcerated. The state must meet the medical and mental health needs of those who are locked up and therefore dependent on the state for all their needs because they quite literally cannot care for themselves.

But if the law and compassion are not sufficient motivation to improve mental health services in prison, then self-interest should be. Communities are little served if mentally ill offenders are released from prison, as most eventually will be, in worse shape than when they went in.

Jamie Fellner is the director of the U.S. Program at Human Rights Watch and Sasha Abramsky is consultant to Human Rights Watch. They are co-authors of the Human Rights Watch report, "Ill-Equipped: U.S. Prisons and Offenders With Mental Illness."