You walk by the greatest shame of our society every day, as do we: the thousands of madmen and women who live on the streets of America’s greatest city.

An estimated 12,000 mentally ill live homeless in New York City, with more in the jails and prisons. Even those getting (some) treatment walk the edge, because the public and its elected representatives dither in the absence of easy solutions.

Just locking them away wasn’t the right answer, but neither was the mass deinstitutionalization that began four decades ago. Dumping the severely mentally ill on the streets, with talk of respecting their autonomy, is no solution, for them or for society.

And the occasional death — when a lunatic kills another civilian, or when a deeply troubled individual’s chaotic confrontation with police ends tragically — is only the tip of the iceberg of suffering.

The mental health establishment likes to pretend that the solution is better treatment of milder illnesses, but mental health doesn’t work that way: Depression and anxiety are not, in the main, stages on the way to paranoia and schizophrenia, but different disorders altogether.

One small step is to fix the holes in Kendra’s Law, which permits but too often doesn’t require the involuntary commitment of people who’ve become dangers to themselves and others. The courts (and the rest of the system) should support families that are trying to get assistance for a loved one so far gone that he or she can’t even recognize what help is. Laws about respecting privacy must not prevent families from being intimately involved in treatment.

It’s getting worse: Calls to 911 reporting “emotionally disturbed persons” have nearly doubled in the last decade, from 97,132 in 2009 to 179,569 last year. Since 2016, 14 mentally ill have died in police encounters gone wrong.

We don’t remotely pretend to have all the answers, and we recognize that no serious steps will be cheap. But the status quo is simply inhumane. Let’s start finding a better way.