I once represented a client who lived in Davis, California and worked in the Sacramento County morgue as a janitor. He had access to body parts that he stole from the morgue in order to conduct medical experiments.
He always wanted to be a doctor and so he thought that by conducting these medical experiments they would somehow help him to get into medical school. After he finished with the experiments he disposed of the body parts in a large trash container and those body parts were discovered and turned over to the police.
At one point the police thought that there was mass murderer in the Davis area which became national news. One evening when my client was disposing of these body parts he was seen by a neighbor and arrested.
In the jail my client became delusional thinking he was seeing crawling bugs and a ghost that were talking to him. As a result I disclosed this to the judge who decided we needed to have a hearing regarding his sanity. Two psychiatric experts testified. One said he was competent, while the other disagreed and said he was incompetent.
The judge ruled, my client was competent but incapable of committing the crime and ended up pleading to a lesser offense that resulted in him being released from jail.