“Leftwing judges closed our mental institutions.”
It wasn’t just the left. Governor Reagan signed the bill in California. There was a broad consensus signing up for this bad idea.
Back then the evil empire, the old Soviet Union was using mental health facilities to imprison any dissidents they didn't kill. Perhaps Reagan and the good guys wanted to preclude that possibility when the left returned to power.
In Oklahoma the citizens fought to keep them open. Since the legislature couldn’t be co-opted there the federal judiciary legislated from the bench.