The US has a dearth of psychiatric beds available, with 14 beds per 100k population. The EU for comparison has 69. Experts say you need at least 50. [0] [1].
You have all these people that need help, but have no way of getting it. Add to that the rampant inequality and the high cost of housing and it's no surprise things got this bad.
We need to fix the systemic issues, not just lock up some poor souls that were failed by the system.
[0] https://www.npr.org/2017/11/30/567477160/how-the-loss-of-u-s...
[1] https://ec.europa.eu/eurostat/web/products-eurostat-news/-/e...