The M'Naghten test, also known as the cognitive test, says that a person is not guilty by reason of insanity when he, at the time he committed the act:
Had a mental defect
Which either:
Prevented him from knowing the nature and quality of the act he was doing or