Court had ordered man accused of rape into psychiatric care