Court hearings were supposed to serve as a check on psychiatric decision-making.