Nathaniel Manlangit, 26, entered the plea in court on Wednesday to charges of murder with the use of a deadly weapon in connection with the June 7 killing of 31-year-old Carlos Caloca and could spend the rest of his life in a locked forensic mental hospital, according to prosecutors.
"We believe that, due to his mental illness, Mr. Manlangit was incapable of understanding that his horrifically violent act was wrong," Deputy District Attorney Angela Bernhard said in a statement.
In order to be found not guilty by reason of insanity, a court must rule that the defendant's mental illness prevented the person from understanding the nature of their act or distinguishing between right and wrong.
The ruling also came after assessments from two doctors who agreed that Manlangit was legally insane at the time he committed the murder.
According to prosecutors, Manlangit and Caloca were walking the aisles of the Sports Authority store at the Great Mall of the Bay Area in Milpitas the morning of June 7 when, apparently unprovoked, the defendant grabbed a baseball bat from a store shelf and used it to strike the victim multiple times.
The police arrived on the scene a short time later to find Caloca dead from his injuries.
Manlangit could be released to supervised outpatient treatment at some point if he is determined to no longer be a danger to the public, according to prosecutors.
In order for that to happen, a jury trial would have to be held to determine whether the defendant still poses a danger.