It is possible for the necessity of defense to arise in many types of criminal cases. Essentially, the defense is asserted when a defendant needs to commit the act to prevent greater harm from occurring. For example, if you shoved another person or struck them to prevent them from seriously harming another person or yourself, it would be an example of the necessity defense.