REDWOOD CITY -- The former child psychiatrist facing retrial on the Peninsula for allegedly molesting patients has been released from jail on $900,000 bail, authorities said Monday.

William Ayres, 80, got out of Maguire Correctional Facility on Thursday morning, less than 24 hours after a judge ruled he was mentally well enough to again be tried on nine counts of child molestation. He posted a bail bond, which typically requires a 10 percent premium or about $90,000 in Ayres' case, Chief Deputy District Attorney Karen Guidotti said.

Prosecutors say Ayres used the cover of genital or physical exams to molest young male patients in his San Mateo Office. A handful of those former patients testified to the alleged abuse, but a trial ended with a hung jury in July 2009.

After prosecutors decided to retry the case, the apparent onset of Alzheimer's-related dementia led mental experts to declare him unfit for trial.

But a forensic doctor at Napa State Hospital, where Ayres was committed in October 2011, declared the former head of the American Academy of Child and Adolescent Psychiatry had faked or exaggerated his symptoms. San Mateo County Superior Court Judge John Grandsaert on Wednesday ruled Ayres manipulated mental health experts to avoid prosecution and declared him competent for trial.