Section 12 of Penal Code CAP 63: Insanity
A person is not criminally responsible for an act or omission if at the time of doing the act or making the omission he is through any disease affecting his mind incapable of understanding what he is doing, or of knowing that he ought not to do the act or make the omission; but a person may be criminally responsible for an act or omission, although his mind is affected by disease, if such disease does not in fact produce upon his mind one or other of the effects above mentioned in reference to that act or omission.
Check the current authoritative text and amendment history before relying on this provision.