In criminal law, insanity is usually defined as an inability to either determine the difference between "right" and "wrong" (or, in a more practical sense, "legal" and "illegal") or understand the consequences of one's own actions. An insanity defense is based on claiming that the defendant suffers from a mental disorder severe enough to meet either of these criteria, and that a sentence should therefore involve treatment rather than punishment (or, in the case of temporary insanity, that no sentence should be applied at all).
In civil law, insanity renders a person unfit for entering contracts or other legal obligations. In some judicial systems, it may allow for someone to be involuntarily committed. Many who support the movement of anti-psychiatry take the position that mental illness is questionable as a diagnosis either legally or medically, and that claims of insanity should not free said persons from responsibility.
In some views, what is insane by mainstream definitions is not necessarily a disorder of the mind, but may simply be a different way of being that is judged as unacceptable on social or cultural grounds. This is stronger than the meaning discussed above—in this case, it is implied that what is seen as actual insanity by others is not (and by extension, that there is no mental illness). Since great legal and social consequences are attached to being declared insane (ranging from possibly having one's freedom curtailed by involuntary commitment to escaping punishment by falsely convincing others of insanity), these matters are a source of considerable controversy.
As a state of mental disorder, insanity has historically been attributed to supernatural or divine causes where theories of mental illnesses were not developed. Aberrant or destructive behaviour from an individual has been explained as another entity taking over their body (demonic possession) or as a mental unhinging inflicted by the gods, as punishment for wrongdoing. In these theories, insanity is an external condition overriding an otherwise sane mind (which may not ever manifest itself). That demonic possession occurs and can be a valid explanation for insanity in some cases is still asserted by some, but this view holds no more than minority acceptance.
In popular culture, something "insane" is something extremely foolish, while persons may be deemed "insane" if their behavior strongly deviates from accepted social norms. The term is typically negative, but departure from established norms may also be seen as a positive quality; in this case, being "insane" is being daringly unconventional or individualistic. This use of insane is illustrated by the following quote from Henry David Thoreau's A Plea for Captain John Brown:
Many, no doubt, are well disposed, but sluggish by constitution and by habit, and they cannot conceive of a man who is actuated by higher motives than they are. Accordingly they pronounce this man insane, for they know that they could never act as he does, as long as they are themselves.
In this sense, "insanity" is not implied to be an actual disorder, let alone severe.