Criminal - Defence of Necessity. R. v. Guillemette
In R. v. Guillemette (Ont CA, 2022) the Court of Appeal considered the role of 'necessity' in a criminal context:
 Therefore, the main issue for resolution at trial was whether the appellant had an excuse for committing the offences. At trial, and on appeal, the appellant argues that she did what she did out of necessity.
 While necessity is often referred to as a defence, it is a defence that operates to excuse, but not justify, criminal behaviour. In limited circumstances, it will excuse a person of their crime because the commission of that crime arose from a genuine emergency. The real genesis of the defence of necessity in Canadian law goes back to R. v. Perka, 1984 CanLII 23 (SCC),  2 S.C.R. 232, where Dickson J. (as he then was) focused upon the injustice involved in punishing someone for a choice to break the law when that person really had no true choice at all. Dickson J. explained, at p. 250:
At the heart of this defence [of necessity] is the perceived injustice of punishing violations of the law in circumstances in which the person had no other viable or reasonable choice available; the act was wrong but it is excused because it was realistically unavoidable.See also: R. v. Ruzic, 2001 SCC 24,  1 S.C.R. 687, at para. 29; R. v. Aravena, 2015 ONCA 250, 323 C.C.C. (3d) 54, at paras. 48-56, leave to appeal refused,  S.C.C.A. No. 497.
 There are three elements to the defence of necessity: (1) the accused was faced with an urgent situation involving “clear and imminent” peril; (2) there was “no reasonable legal alternative” to the accused breaking the law; and (3) there exists a “proportionality between the harm inflicted and the harm avoided” by the accused: see R. v. Latimer, 2001 SCC 1,  1 S.C.R. 3, at paras. 28-31. Once the defence shows that there is an air of reality to each element of necessity, the onus shifts to the prosecution to disprove one or more of the essential elements of the defence beyond a reasonable doubt: Perka, at pp. 257-58.