Sanity is a legal term denoting that an individual is of sound mind and therefore can bear legal responsibility for his or her actions. It is not a medical term, although the opinions of medical experts are often important in making a legal decision as to whether someone is sane or insane.
See also:
Sanity is sometimes used as an engineering term to mean "internal consistency", as in the phrase "sanity check". This has led to pins on integrated circuits being labeled "LOS": "loss of sanity".
/Talk