In the criminal law of many nations, necessity may be either a possible justification or an exculpation for breaking the law. Defendants seeking to rely on this defense argue that they should not be held liable for their actions as a crime because their conduct was necessary to prevent some greater harm and when that conduct is not excused under some other more specific provision of law such as self defense. Except for a few statutory exemptions and in some medical cases there is no corresponding defense in English law for murder.
For example, a drunk driver might contend that he drove his car to get away from a kidnap (cf. North by Northwest). Most common law and civil law jurisdictions recognize this defense, but only under limited circumstances. Generally, the defendant must affirmatively show (i.e., introduce some evidence) that (a) the harm he sought to avoid outweighs the danger of the prohibited conduct he is charged with; (b) he had no reasonable alternative; (c) he ceased to engage in the prohibited conduct as soon as the danger passed; and (d) he did not himself create the danger he sought to avoid. Thus, with the "drunk driver" example cited above, the necessity defense will not be recognized if the defendant drove further than was reasonably necessary to get away from the kidnapper, or if some other reasonable alternative was available to him.
As a matter of political expediency, states usually allow some classes of person to be excused from liability when they are engaged in socially useful functions but intentionally cause injury, loss or damage. For example, the fire services and other civil defence organizations have a general duty to keep the community safe from harm. If a fire or flood is threatening to spread out of control, it may be reasonably necessary to destroy other property to form a fire break, or to trespass on land to throw up mounds of earth to prevent the water from spreading. These examples have the common feature of individuals intentionally breaking the law because they believe it to be urgently necessary to protect others from harm, but some states distinguish between a response to a crisis arising from an entirely natural cause (an inanimate force of nature), e.g. a fire from a lightning strike or rain from a storm, and a response to an entirely human crisis. Thus, parents who lack the financial means to feed their children cannot use necessity as a defense if they steal food. The existence of welfare benefits and strategies other than self-help defeat the claim of an urgent necessity that cannot be avoided in any way other than by breaking the law. Further, some states apply a test of proportionality. So the defense would only be allowed where the degree of harm actually caused was a reasonably proportionate response to the degree of harm threatened. This is a legal form of cost–benefit analysis.