They could've been held without bail and gotten mental health treatment. But there's a lot that needs to be fixed in the system.
9th circuit judges. Too liberal and make it too hard to prosecute, commit, and punish criminals. Half of the conservative judges are only mildly conservative. Trump has to come back and fill more seats.
Prison and Jail space - need more of it so criminals actually serve their sentences and we can prosecute more criminals and not have the revolving door. Inmates have a choice between rehab or hard labor.
Prosecutors, judges, LEOs, public defenders. Hire a lot more. Bump up their pay a lot.
Mental health/rehab - greatly increase funding for it. Hire more workers and build more centers to house people.
Crackdown on drug abuse/sellers - the addictive and mind destroying ones like ice that cause mental health problems.
Societal - Get rid of the progressive mindset. Promote good parenting, hard work, and morals. individual responsibility. Strength in adversity. Community support.