This man was shooting at cars full of people, and was incompetent to stand trial, so was released, had no further follow-up, and unsurprisingly eventually killed someone.
This is a sensitive topic. The power of the state to incarcerate or limit the freedom of or monitor and track people due to their alleged or even actual mental illness or cognitive limitations is fraught with moral risk and social risk of abuse. There is certainly a robust history of that, across many societies.
And yet. People who are intermittently dangerous need care. And the society needs protection from them.
We put too much weight on the judicial system to punish, and not enough weight on the need to help people, deal with the social and personal circumstances that cause harm, and work for justice via means other than ex post facto criminal incarceration.