|Part of the common law series|
|Other common law areas|
In U.S. criminal law, 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. However case law suggests necessity is narrowed to medical cases.
Necessity as a defense to criminal acts conducted to meet political ends was rejected in the case of United States v. Schoon. In that case, thirty people, including appellants, gained admittance to the IRS office in Tucson, where they chanted "keep America's tax dollars out of El Salvador," splashed simulated blood on the counters, walls, and carpeting, and generally obstructed the office's operation. The court ruled that the elements of necessity did not exist in this case.
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.
Denmark and Norway
Emergency law/right (nødret, nødrett) is the equivalent of necessity in Denmark and Norway. It is considered related to but separate from self-defence. Common legal examples of necessity includes: Breaking windows and other objects in order to escape a fire, commandeering a vehicle for emergency ambulance, and ignoring traffic rules while rushing a dying patient to a hospital, and even killing a person who poses an immediate threat to several other people not including yourself. In the last case self-defense laws are not enough, but the case is covered by nødret. Nødret can only be invoked though when no other option is available.
Customary international law
Under international law, an obligation of customary international law or an obligation granted under a bilateral investment treaty may be suspended under the doctrine of necessity. It is "an exception from illegality and in certain cases even as an exception from responsibility." See Continental Casualty Company v Argentine Republic, ICSID Case No ARB/03/09. In order to invoke the doctrine of necessity: (1) The invoking State must not have contributed to the state of necessity, (2) Actions taken were the only way to safeguard an essential interest from grave and impending danger. Id. at page 72, paragraph 165.
Taiwan, Republic of China
In specific states
- New Hampshire
- New Jersey
- New Mexico
- New York
- North Carolina
- North Dakota
- Rhode Island
- South Carolina
- South Dakota
- West Virginia
- Christie, The Defense of Necessity Considered from the Legal and Moral Points of View, (1999) Vol. 48 Duke Law Journal, 975.
- Fuller, Lon L. The Case of the Speluncean Explorers, (1949) Vol. 62, No. 4 Harvard Law Review  and The Case of the Speluncean Explorers: A Fiftieth Anniversary Symposium, (1999) 12 Harvard Law Review 1834.
- Herman, United States v. Oakland Cannabis Buyer's Cooperative. Whatever Happened to Federalism? (2002) Vol. 95, No. 1 The Journal of Criminal Law and Criminology, 121.
- Travis, M. The Compulsion Element in a Defence of Necessity (2000) 
- See Re A (Conjoined Twins: Surgical Separation)  Fam 147
- See R v Dudley and Stephens  14 QBD 273 and R v Howe  1 AC 417
- Cavallaro, James L., Jr. (1993), The demise of the political necessity defense: indirect civil disobedience and United States v. Schoon, University of California Press, ISSN 0008-1221
- U.S. v. Schoon, 939 F2d 826 (July 29, 1991).
- Straffeloven på Retsinformation
- Straffeloven av 2005 § 17
- Article 24 of the Criminal Code of the Republic of China.
- Article 13 of Administrative Penalty Act.