It looks like you're new here. If you want to get involved, click one of these buttons!
The least restrictive environment comes from the horrors of mental institutions before the 1970s.
It's as simple as this: either you error on the side of caution and lock up every person who may become potentially become violent, meaning large numbers of people with psychotically based disorders will be locked away in spite of the fact that they'll likely never hurt anyone (essentially returning mental health treatment back to the 1700s), or you have a system where the focus is on responsibly maintaining people in the community. The cost being that, unfortunately, sometimes things like this will happen.
This is where I'll point out that people will mental illnesses are far more likely to be the victims of violent crimes than perpetrators, that the overwhelming majority of violent acts are undertaken by people who don't have mental illnesses, that there are mentally ill people around the world and there aren't nearly as many instances of violence, particularly shootings, in those other countries. The culture of violence in this country is the problem. Not people with mental illnesses, who are just easy targets.
And if you have a basic understanding of mental illness then try using language that indicates that your understanding is based on current literature and research and not based on a mashup of 17th century terminology mixed with some regressive Fox News type fear mongering. I'll also point out that there are multiple people responding to you who are, in fact, mental health professionals, so rather than being defensive and indignant, try listening to what people are telling you. There are reasonable means for improving mental health treatment that don't involve simply locking up every symptomatic person and throwing away the key. As whynot_31 mentioned, there's supportive housing, ACT teams, AOT, mental health court, etc. It isn't "virtually impossible to lock away someone who is criminally insane." Beyond the antiquated terminology, if someone has the kind of history you're describing, combined with current symptoms, it isn't very difficult at all to have that person evaluated in an ER, at which point they would be hospitalized. That doesn't mean that no mentally ill person will ever commit a violent act any more than I can guarantee that for the general population, many of whom will undoubtedly commit violent acts before the day is done.
Here's where money is being spent to improve NYC's "system"