Guy was not malicious, just not mentally healthy. Doing nothing meant the business would continue to get harassed.
Judge and prosecutor and defense attorney had a long conference about how none of the options available were any good.
Mental health courts are one approach being tried out in a few jurisdictions: https://en.wikipedia.org/wiki/Mental_health_court
Basically like a plea agreement with conditions to enter into a community based support program or some kind of treatment program.
They aren't without criticisms, but they provide a tool to deal with these messed up situations the criminal justice constantly gets stuck with.