A U.S. veteran with post-traumatic stress in Chicago's Cook County Jail. (Charles Rex Arbogast/Associated Press)

THE INCARCERATION of mentally ill inmates is a national epidemic, with local jails in Los Angeles, Chicago and elsewhere now counting among the country’s largest de facto mental institutions. One result has been pressure and proposals to divert some people charged with nonviolent and minor crimes to treatment rather than a cell.

That’s a critical reform, but in order for it to work, courts and judges have to take a leading role, which is starting to happen in Montgomery County.

The county, a liberal bastion, is a laggard when it comes to devising innovative alternatives to warehousing the mentally ill behind bars. That’s starting to change thanks to key officials, including the county’s top prosecutor, John McCarthy. They aim to establish a mental health court that, like the county’s drug court, would channel some nonviolent offenders into community-based programs.

To that end, a task force, chaired by former county council member Phil Andrews and composed of local defense lawyers, prosecutors, jail officials, mental health professionals and others, is being formed by county circuit Administrative Judge John W. Debelius III. The goal is to shape a workable proposal for setting up the court in the coming months. Then it will require buy-in from judges, particularly at the district court level, which handles the greatest volume of arrestees — plus some money.

The impetus is clear. Even as the number of people charged with crimes and booked into jail has dropped over the past three years in Montgomery, the number requiring immediate mental health services has soared by about 60 percent, to more than 1,600 annually.

That mirrors the trend nationally, where jail and prison chiefs say that large proportions of their inmates, and sometimes majorities, are mentally ill — partly a result of the closing of many big state mental hospitals starting in the 1970s. Left on the streets and to their own devices, with little in the way of monitoring or treatment options, mentally ill people often end up in trouble.

Those charged with crimes such as trespassing, vandalism and public urination needn’t be confined in jails, where mentally ill people are more likely to be sexually victimized than other inmates. They’re better off — and the public is better off, owing to the likelihood of reduced recidivism — if they enter court-supervised treatment; jail is not a therapeutic environment.

Ideally, Montgomery would follow other localities whose mental health courts are structured to include input not only from prosecutors and public defenders but also from county case workers, private providers of mental health services and police. Caseloads should be manageable enough that the small number of judges — perhaps just one or two to start in the circuit court — would become familiar with individual defendants and able to ensure compliance with court orders regarding their treatment and supervision.

Montgomery’s district court, which handles the lion’s share of defendants, is so far wary of participation, citing the strain on caseloads that might arise from assigning judges to full-time mental health court duty. The court’s reluctance, along with the need for resources from the county — for housing, case workers and treatment — are challenges that Mr. Andrews’s task force will be charged with addressing.