What did people in the 19th century believe about the relationship of crime to insanity?

The attitudes towards insanity shifted rapidly over the 19th century. First, insanity became increasingly medicalized, and was fully shorn of its lingering associations with earlier theories of demonic possession. Next, the notion of the insanity defense became fully codified with the M'Naghten rule in 1843, which set out the conditions under which a person could be cxonsidered not guilty by reason of insanity, namely that the person must not know the nature of the act nor that the act was immoral. Finally, during this period, psychologists discovered what they called "monomania", i.e. people who were not raving Bedlamites, but were insane only with respect to certain circumstances or issues; this was advanced as an explanation of how people who might otherwise appear reasonable might commit crimes that appeared "insane".