Duress and necessity are "understood as based on the same ... principles". They are both based on "normative involuntariness". They both differ from self-defence as the source of the danger is a third party and not the victim.
The defence of duress is available "when a person commits an offence while under compulsion of a threat made for the purpose of compelling him or her to commit it".
The defence of duress exists both in statute under s. 17 of the criminal Code and under the common law.
The common law defence pre-dates the provisions of s. 17, however, by function of s. 8 of the Criminal Code, which preserves all common law defences, the broader common law defence is still considered.
The distinction between the two is that the statutory defence does not apply to parties, including whether they are aiders and abettors. The common law, however, can still apply for parties to the offence.
There is a further distinction of the statutory defence excluding certain types of defences while common law would apply to all types of offences.
The tests for applying the defence should be "largely the same" as between the statutory and common law versions of the defence.
R v Hibbert, 1995 CanLII 110 (SCC),  2 SCR 973 at para 19
R v Ryan, 2013 SCC 3 (CanLII) at para 13 to 33
- R v Ryan at para 17
- R v Sheridan, 2010 CarswellOnt 11203(*no link)
- R v Hibbert, 1995 CanLII 110 (SCC),  2 SCR 973 (“the similarities between the two defences are so great that consistency and logic require that they be understood as based on the same juristic principles”)
- R v Ryan at para 18
- R v Ryan at para 2
- Section 8 (3) state:
Common law principles continued
(3) Every rule and principle of the common law that renders any circumstance a justification or excuse for an act or a defence to a charge continues in force and applies in respect of proceedings for an offence under this Act or any other Act of Parliament except in so far as they are altered by or are inconsistent with this Act or any other Act of Parliament.
R.S., 1985, c. C-46, s. 8; 1993, c. 28, s. 78; 2002, c. 7, s. 138.
R v Paquette, 1976 CanLII 24 (SCC),  2 SCR 189 per Martland J.
R v Wilson, 2011 ONSC 3385 (CanLII) at para 50
R v Paquette
R v Wilson
R v Ryan at para 36
- R v Ryan at para 83, 84
- R v Ryan, at para 81
Compulsion by threats
17. A person who commits an offence under compulsion by threats of
immediatedeath or bodily harm from a person who is present when the offence is committedis excused for committing the offence if the person believes that the threats will be carried out and if the person is not a party to a conspiracy or association whereby the person is subject to compulsion, but this section does not apply where the offence that is committed is high treason or treason, murder, piracy, attempted murder, sexual assault, sexual assault with a weapon, threats to a third party or causing bodily harm, aggravated sexual assault, forcible abduction, hostage taking, robbery, assault with a weapon or causing bodily harm, aggravated assault, unlawfully causing bodily harm, arson or an offence under sections 280 to 283 (abduction and detention of young persons).
R.S., 1985, c. C-46, s. 17; R.S., 1985, c. 27 (1st Supp.), s. 40.
The requirements of s.17 to have “presence” and “immediacy” is unconstitutional for violating s.7. Thus, that portion of the section has no force or effect. The listed excluded offences have been found to be unconstitutional and so must be read out of the language of s. 17. That includes robbery.
Despite the existence of the common law defence, all offences listed as defence exceptions in s.17 cannot be covered by common law. Any included offences to offences to the exempted offences listed in s. 17 are also exempted from the statutory defence.
The statutory defence requires: 
- there must be a threat of bodily harm directed against a 3rd party;
- the accused must believe that the threat will be carried out;
- the offence must not be listed as exempted in s. 17; and,
- the accused cannot be a party to a conspiracy or criminal association such that the person is subject to compulsion.
In addition to the statutory elements, the applicant must also satisfy three additional common law requirements at the same time:
- no safe avenue of escape
- a close temporal connection
Section 18 removes the common law presumption that a woman who commits an offence is doing so at the compulsion of her husband. (known as the doctrine of marital coercion)
In the context of murder, s 17 must be read down requiring that there be immediate threat of death while in the presence of the threatener. The principal must have no other avenue of escape and the act must be proportionate. Proportionality is limited by the number of deaths, where enough deaths cannot ever be justified.
The exclusion of "robbery" and "assault with a weapon" from the defence of duress violates s. 7 of the Charter and should be struck out of the legislation.
The offences explicitly excluded from the statutory defence of duress under s. 17 are:
- high treason or treason (47),
- murder (239),
- piracy (74,75),
- attempted murder,
- sexual assault (271),
- sexual assault with a weapon (272),
- threats to a third party or causing bodily harm,
- aggravated sexual assault (273),
- forcible abduction,
- hostage taking (279.1),
- robbery (343, 344),
- assault with a weapon or causing bodily harm (267),
- aggravated assault (268),
- unlawfully causing bodily harm (269),
- arson (433) or
- offences under sections 280 to 283 (abduction and detention of young persons).
- R v Ruzic 2001 SCC 24 (CanLII)
- R v Ryan at para 36
- R v Mohamed, 2012 ONSC 1715 (CanLII) at para 20
- R v Li 2002 CanLII 18077 (ONCA) -- kidnapping charge was also exempted as part of the abduction charge
- R v Ruzic
R v Ryan at para 43
R v Ruzic at para 55
R v Ryan at para 44-46
R v Sheridan, 2010 CarswellOnt 11203 (*no link)
c.f. R v Sandham, 2009 CanLII 58605 (ON SC) - concluding s. 17 does not apply to a principal to murder
- R v Allen, 2014 SKQB 402 (CanLII)
At common law, duress is an available defence to any offences short of murder. It must be shown that the accused's will was overborne by threats of death or serious personal injury such that accused is not acting voluntarily.
There are three elements to the defence. It must be established that:
- the accused must be subject to a “threat of death or serious physical injury”
- on an objective standard, no safe avenue of escape existed  or any “reasonable opportunity to render the threat ineffective.”
- “there must be proportionality between the threat and the criminal act alleged”
The elements have been set out as: 
- a threat of death or bodily harm to the accused by a third person;
- the accused reasonably believed that the threat could be carried out;
- the accused had no safe avenue of escape;
- close temporal connection between the threats and the harm threatened
- proportionality between the harm threatened and the harm inflicted on an modified objective standard; and
- the accused was not party to a conspiracy or association where the accused knew that threats or coercion were a possible result to the activity.
As with all affirmative defences, if the defence is raised, the Crown has the burden of proving beyond a reasonable doubt that at least one of the elements is not available.
The threat need not be of immediate death or bodily harm. 
The defence will not be available through the common law where the accused puts themselves in a position where they are likely to receive threats.
The standard used is "objective-subjective", which is the same for the defence of necessity.
The test under the common law is “arguably more stringent than s. 17” as the provision “is entirely subjective and does not require that the accused's belief be reasonable”
R v Sandham, 2009 CanLII 58605 (ON SC) at para 7 - the common law has always excluded murder from duress defences
- R v T.L.C., 2004 ABPC 79 (CanLII)
- R v Wilson 2011 ONSC 3385 (CanLII) at para 61
- R v Hibbert, 1995 CanLII 110,  2 SCR 973
R v Keller, 1998 ABCA 357 (CanLII)
- Wilson at para 61
- Wilson at para 61
R v Yumnu, 2010 ONCA 637 (CanLII), 260 CCC (3d) 421, citing R v Hibbert at paras 51-62
R v Ryan at para 55
- Wilson at para 63
- R v Ruzic,  1 SCR 687, 2001 SCC 24 (CanLII)
- R v Li, 2002 CanLII 18077 (ON CA)
- Ruzic at para 71
- Ruzic at p. 35
Threat of Bodily Harm or Death
Other instances of this requirement have stated that there must be "serious" or "grevious" bodily harm.  However, the seriousness of harm is best dealt with in the proportionality element rather than this one.
- e.g. R v Yumnu 2010 ONCA 637 (CanLII), appealed to SCC
- R v Ryan at para 55
Reasonable Belief That the Threat will be Carried Out
Close Temporal Connection
This requirement is tied to the element of "no safe avenue of escape" since an absence of temporal connection necessarily gives rise to the possibility of a safe avenue of escape.
- R v Ryan, 2013 SCC 3 (CanLII) at para 48
No Safe Avenue of Escape
This element is evaluated on a modified objective standard.
- R v Ryan, 2013 SCC 3 (CanLII) at para 47, 65
Proportionality concerns "whether the harm threatened [was] equal or greater than the harm caused". This requirement is integral to the principle of moral voluntariness since the greater the gap between harm threatened and the harm imposed leads to the likelihood that the harm imposed was voluntary.
This is divided into two inquiries:
- the harm threatened must be equal or greater than the harm inflicted by the accused
- the accused's actions must "accord with what society expects from a reasonable person similarly situated in that particular circumstance." This involves considering what is "normal" resistance to a threat.
These elements are considered on a modified objective standard.
- R v Ryan, 2013 SCC 3 (CanLII) at para 70
- Perka at p. 252, 259
- R v Perka at p. 252
also Ryan at para 73
- R v Ryan at para 72, 73