Napa County Superior Court Judge Rodney Stone ruled 30-year-old Jesus Hernandez Tobar should be placed in a mental health institution until he is restored to competence, Deputy District Attorney Allison Haley said.
A hearing on where he will be sent is scheduled for April 19.
Tobar was charged with the sexual battery of a female hospital employee on March 2. Criminal proceedings were suspended March 9.
Haley said a psychologist who then examined Tobar determined he is unable to understand and participate in his defense and she and Tobar's attorney Ron Abernethy concurred with the doctor's report.
Haley said she will ask Stone not to send Tobar back to Napa State Hospital.
She said Tobar has been at Napa State Hospital since 2007 and in mental health institutions since he was 19 years old.
The alleged battery was the third reported act of violence at the hospital since October.
Napa State Hospital psychiatric technician Donna Gross, 54, of Concord, was murdered by a patient at the hospital on Oct. 23. A preliminary hearing for the accused killer, Jess Willard Massey, 37, is scheduled for May 2.
George Anderson, 60, a rehabilitation therapist, suffered multiple fractures when he was attacked at the hospital on Dec. 11. His alleged assailant, Sean Bouchie, 24, was found incompetent to stand trial and was sent back to Napa State Hospital.