It is very simple really. All citizens are equal before the law. If you break the law you should be sanctioned. Mental health should not give one any privileges when it comes to the law. It should just determine whether you will be dealt by the criminal justice system or mental institution.
If you have a mental illness and do something out of character it shouldn’t be treated the same way as if someone just chose to do something.
Sometimes institutions are needed, sometimes not. It’s an act of injustice to treat the unwell in the same way as the well.