Hollywood likes to throw the insanity defense into movies all the time because it is exciting and a twist. However, that is not how this defense works in real life. In a real courtroom, using insanity as a defense is not common, and it also is not an easy way to defend against charges. Furthermore, it is not your standard defense where you can walk away with an acquittal. Understanding this defense is important if you think you might use it in your case in California. 

Cornell Law School explains that the insanity defense will not allow you to defend against your actions. Instead, you will plead guilty to doing the crime, but you will admit you only did so because you were mentally incapable of understanding what you were doing due to a mental illness. You give an excuse as to why you did the crime and why that makes you not responsible for what happened. 

This defense is very tricky because you have to prove that you are no longer in a state of mind where you cannot competently understand the charges against you and what is happening in court. The court will conduct a competency hearing to determine this. You must be able to make your own decisions and communicate effectively. 

If the court finds you competent, then you have the burden of proving your mental state at the time of the crime. You will have to go through a test from the court that shows you meet the legal definition of being unable to understand at the time of the crime what you were doing and how that was wrong. This information is for education and is not legal advice.