Habeas Corpus1. Overview
2. Test for Habeas Corpus
3. Procedure for Habeas Corpus
4. Detention Need not be Incarceration
5. Exceptions to Habeas Corpus
6. Civil versus Criminal
7. Standard of Review
1. Overview. Wang v Canada
In Wang v. Canada (Ont CA, 2018) the court canvasses the history and purpose behind the writ of habeas corpus:
 I begin with the decision in May v. Ferndale Institution, 2005 SCC 82 (CanLII),  3 S.C.R. 809. While May involved a challenge by federal inmates to the reclassification of their security level within the federal penitentiary system, and was thus factually distinct from the situation here, the importance of the decision for current purposes lies in its review of the history and principles surrounding habeas corpus.
 The majority in May reviewed the purpose behind the writ of habeas corpus. Fish and LeBel JJ., at para. 21, quoted from a decision of Black J. in the United States Supreme Court where he said that the purpose of habeas corpus was “the protection of individuals against erosion of their right to be free from wrongful restraints upon their liberty”. That protection was stated in broad terms. It was not restricted to imprisonment but to any restraint on a person’s liberty. Such restraints can take many different forms.
 The decision in May went on to consider other cases that had touched on the purpose of habeas corpus. It referred to the Supreme Court of Canada’s trilogy of decisions in R. v. Miller, 1985 CanLII 22 (SCC),  2 S.C.R. 613; Cardinal v. Director of Kent Institution, 1985 CanLII 23 (SCC),  2 S.C.R. 643; Morin v. National Special Handling Review Committee, 1985 CanLII 24 (SCC),  2 S.C.R. 662. The court pointed out, at para. 31, that in Miller, Le Dain J. had also described habeas corpus as “the traditional means of challenging deprivations of liberty”. Again, there was no suggestion that the remedy was restricted to incarceration. The court then went on to consider the exceptions to the general right of an individual to resort to habeas corpus to challenge their detention, a subject to which I will return shortly.
 Lastly, the court reinforced the importance of the remedy of habeas corpus and the care which courts ought to take in making any determination that it was not available as a route to challenge restrictions on a person’s liberty. Fish and LeBel JJ. said, at para. 50:
Given the historical importance of habeas corpus in the protection of various liberty interests, jurisprudential developments limiting habeas corpus jurisdiction should be carefully evaluated and should not be allowed to expand unchecked. The exceptions to habeas corpus jurisdiction and the circumstances under which a superior court may decline jurisdiction should be well defined and limited.
2. Test for Habeas Corpus. Boone v Ontario (Community Safety and Correctional Services)
In Boone v Ontario (Community Safety and Correctional Services) (Ont CA, 2014) the court simply sets out the test for habeas corpus:
 To be successful, an applicant for habeas corpus must show (a) a deprivation of liberty and (b) that the deprivation of liberty was unlawful: ...
3. Procedure. Boone v Ontario (Community Safety and Correctional Services)
As to what the procedure is for habeas corpus, the court in Boone v Ontario (Community Safety and Correctional Services) (Ont CA, 2014) states:
 First, once a deprivation of liberty has been shown, and the applicant has raised a legitimate ground on which to question its validity, the onus shifts to the Crown to show that the deprivation was lawful. Secondly, where a deprivation of liberty has occurred, and a legitimate ground to question its validity has been raised, the hearing judge must proceed to a hearing; there is no discretion to do otherwise. Finally, the hearing judge retains a “residual discretion” at this second stage of the proceedings to decide, after reviewing the record, whether to discharge the applicant: see Khela, at paras. 30 and 78.. Wang v Canada
 It is true that habeas corpus is a remedy that issues as of right (ex debito justitiae) once the unlawful nature of the detention is established. It cannot be denied because another, equally effective remedy – such as judicial review – exists. That was the issue debated in May and Khela. As LeBel J. affirmed in Khela, however, the non-discretionary nature of the writ relates to whether the applicant has raised a legitimate basis for questioning the legality of the detention, not to the ultimate determination of whether, on the whole of the record, the unlawful nature of the detention is established. There remains a residual discretion in this regard. At paras. 77 and 78, he said:
First, the traditional onuses associated with the writ will remain unchanged. Once the inmate has demonstrated that there was a deprivation of liberty and casts doubt on the reasonableness of the deprivation, the onus shifts to the respondent authorities to prove that the transfer was reasonable in light of all the circumstances. Where there has been a denial of the right to a fair hearing, the administrative decision will always be unlawful. However, not all procedural breaches will necessarily result in procedural unfairness and the denial of the right to a fair hearing: see Khela, at para. 90; Canadian College of Business and Computers Inc. v. Ontario (Private Career Colleges Act, Superintendent), 2010 ONCA 856 (CanLII), 2010 ONCA 856, at paras. 65-67; and Uniboard Surfaces Inc. v. Kronotex Fussboden GmbH and Co. KG (F.C.A.), 2006 FCA 398 (CanLII), 2006 FCA 398,  4 F.C.R. 101, at para. 24.
Second, the writ remains non-discretionary as far as the decision to review the case is concerned. If the applicant raises a legitimate doubt as to the reasonableness of the detention, the provincial superior court judge is required to examine the substance of the decision and determine whether the evidence presented by the detaining authorities is reliable and supports their decision. Unlike the Federal Court in the context of an application for judicial review, a provincial superior court hearing a habeas corpus application has no inherent discretion to refuse to review the case (see Farbey, Sharpe and Atrill, at pp. 52-56). However, a residual discretion will come into play at the second stage of the habeas corpus proceeding, at which the judge, after reviewing the record, must decide whether to discharge the applicant.
In Wang v Canada (Ont CA, 2018) the court comments on procedure as follows:
 This conclusion is also consistent with the proper approach to be taken to habeas corpus applications. As pointed out in Mission Institution v. Khela, 2014 SCC 24 (CanLII),  1 S.C.R. 502 at para. 30, habeas corpus applications proceed in two stages. First, the applicant must show that he or she has been deprived of liberty and that there is a legitimate ground upon which to question the legality of the detention. If the applicant succeeds in meeting that threshold, the onus shifts to the authorities to show that the deprivation of liberty is lawful.. Forster v Canada (Correctional Services)
 It is the first stage that we are concerned with in this case. Importantly, the first stage is not described as requiring the applicant to be detained in custody, or to be incarcerated, or to be held in a custodial facility, or any other such language. The key to the first stage is simply, but crucially, a deprivation of liberty. ...
In Forster v. Canada (Correctional Service) (Ont CA, 2019) the court discussed a complex habeas corpus case where the matter was really criminal but was advanced under the Rules of Civil Procedure:
 The importance of habeas corpus can hardly be understated. The right to test the validity of one’s detention by habeas corpus is guaranteed by s. 10(c) of the Charter. The scope of the protection afforded by this right is complex and has required guidance from the Supreme Court of Canada on many occasions. In May v. Ferndale Institution, 2005 SCC 82 (CanLII),  3 S.C.R. 809, the Court held that there is a limited power in the Superior Courts to decline to exercise habeas corpus jurisdiction. LeBel and Fish JJ. wrote, at para. 44:
Habeas corpus should not be declined merely because another alternative remedy exists and would appear as or more convenient in the eyes of the court….Only in limited circumstances will it be appropriate for a provincial superior court to decline to exercise its jurisdiction. For instance, in criminal law, where a statute confers jurisdiction on a court of appeal to correct a lower court and release the applicant if need be, habeas corpus will not be available…Jurisdiction should also be declined where there is in place a complete, comprehensive and expert procedure for review of an administrative decision. [Emphasis added.]In para. 68 of his reasons, the application judge relied on May as a basis for “declining to hear this case.”
 Declining to exercise habeas corpus jurisdiction is different from striking out an application on a summary basis. In Mission Institution v. Khela, 2014 SCC 24 (CanLII),  1 S.C.R. 502, at para. 78, the Court held that “[u]nlike the Federal Court in the context of an application for judicial review, a provincial superior court hearing a habeas corpus application has no inherent discretion to refuse to review the case.” Stated differently, “if the prisoner does raise an arguable issue there is no room for discretion: the matter should proceed to hearing so that a full and proper determination can be made. The non-discretionary nature of habeas corpus is an important difference between it and other prerogative writs:” Judith Farbey, Robert J. Sharpe and Simon Atrill, The Law of Habeas Corpus, 3rd ed. (New York: Oxford University Press, 2011), at p. 53.
 As noted above, the respondent relied on the civil rules as the foundation for its pre-emptive motion to strike this habeas corpus application. However, this reliance was misplaced in a number of respects. First, the respondent relied on r. 21.01(3)(a) – “lack of jurisdiction over the subject matter.” However, it would appear that the application judge did not apply this sub-rule. Instead, he found that it was “plain and obvious” that the appellant’s claim could not succeed. This language – “plain and obvious” – is more appropriate to r. 21.01(1)(b), which governs a “motion to strike out a pleading on the ground that it discloses no reasonable cause of action or defence”: see Paton Estate v. Ontario Lottery and Gaming Commission, 2016 ONCA 458 (CanLII), 131 O.R. (3d) 273, at para. 12; and R. v. Imperial Tobacco Canada Ltd., 2011 SCC 42 (CanLII),  3 S.C.R. 45, at paras. 17-22.
 More profoundly, neither civil rule was applicable in the circumstances of this case. This habeas corpus application was criminal in nature; it arises directly from the imposition of a penal sanction under the Criminal Code: see Vukelich v. Mission Institution, 2005 BCCA 75 (CanLII), 252 D.L.R. (4th) 634, at para. 32. Accordingly, this application was governed by the Criminal Proceedings Rules for the Superior Court of Justice (Ontario), SI/2012-7 (“the criminal rules”). Rule 43 provides the foundation for prerogative relief applications, including habeas corpus.
 On appeal, the respondent’s position has shifted. It now relies on a number of criminal rules (rr. 1.04(1), (2), 2.01, and 6.11). Moreover, the respondent attempts to fortify its position by invoking R. v. Jordan, 2016 SCC 27 (CanLII),  1 S.C.R. 631, stressing the need to prevent the criminal courts from becoming clogged by unmeritorious cases such as the appellant’s.
 The criminal rule that is most applicable to these proceedings is r. 6.11(2), which provides:
Upon application by the respondent that a notice of application does not show a substantial ground for the order sought, a judge of the court may, if he or she considers that the matter is frivolous or vexatious and can be determined without a full hearing, dismiss the application summarily and cause the applicant to be advised accordingly. [Emphasis added.] This rule sets the bar quite high. The application must fail to show a “substantial ground for the order sought”; it must be “frivolous and vexatious”; and it must be capable of being determined “without a full hearing.” Even if these criteria are met, the power to dismiss remains discretionary. The test for dismissal under r. 6.11(2) differs substantially from, and is more onerous than, the tests under r. 21.01(1)(b) and r. 21.01(3)(a) of the civil rules. Moreover, unlike the r. 21.01 tests, the test under s. 6.11(2) contemplates summary dismissal without notice to the applicant – in other words, an application so devoid of merit it can be disposed of ex parte.
 In my view, it cannot be said that the appellant’s claim “does not show a substantial ground” or that it is “frivolous or vexatious”, for the following three reasons. First, when his previous habeas corpus application was terminated, it was “without prejudice” to commencing a new application. The appellant did just that by launching his new application. The new application is not, therefore, vexatious.
 Second, the appellant raises grounds that are arguably unique, operating outside of the Lyons/Gamble/Sarson/Gallichon framework. The appellant’s habeas corpus claims do not challenge the legality of his continued detention on the basis of legislative shifts; instead, he argues that the initial warrant of committal was invalid at the time it was issued.
 Third, whether the appellant could have raised these complaints at his 1995 appeal from sentence is not a foregone conclusion; it is a live issue, the resolution of which may well turn on the scope of this court’s dispositional powers under s. 759 of the Criminal Code that were in force at the time of the 1995 appeal.
 I return to the authorities (in para. 9, above) that were urged on the application judge by the respondent in support of its motion to strike. They have no application to this case. Those decisions involved prisoners seeking habeas corpus relief in response to lateral transfers between maximum security institutions. In each case, it was determined that there was no cognizable deprivation of liberty for habeas corpus purposes. This is very different from the situation faced by the appellant who, after 30 years, seeks to challenge the legality of his initial and continued detention as a dangerous offender.
 I acknowledge that the application judge provided detailed reasons for his decision. He grappled with the merits of the application. However, his judgment was rendered in response to a motion for summary dismissal, predicated on inapplicable civil rules. Given the unique nature of the appellant’s habeas corpus application, it was neither expedient nor in the interests of justice to short circuit his application through a procedure not contemplated by the criminal rules.
 The appellant argues that, if the application judge erred in striking his application, this court should consider the habeas corpus claim on the merits and grant him the relief that he seeks. The respondent resists this approach. It claims that the case cannot be decided on the merits because the record is incomplete. The respondent wishes to adduce evidence in support of its position.
 Even though the record is incomplete as a result of the respondent’s misplaced motion to strike, I would not be prepared to adjudicate on the merits of the appellant’s claim on the record that is presently before this court, and without the benefit of any further findings that a judge may make after a full hearing on the merits.
5. Exceptions to Habeas Corpus. Wang v Canada
In Wang v. Canada (Ont CA, 2018) the court states exceptions to the application of the common law writ of habeas corpus:
 As referenced in May, there are two exceptions to the availability of habeas corpus. One is where a statute confers jurisdiction on a court of appeal to correct the errors of a lower court and to release the affected person, if necessary. The other is where a legislator has put in place a complete, comprehensive and expert procedure for review of an administrative decision affecting a person’s liberty.
4. Detention Need not be Incarceration. Wang v Canada
In Wang v. Canada (Ont CA, 2018) the court states the 'detention' need not be situations of formal incarceration:
 In my view, the application judge erred in the above conclusion [whether there was no 'detention': ed.]. He did so in two related respects. One is that he equated detention for the purposes of habeas corpus with incarceration in a custodial facility. The other is that he appears to have restricted the operation of habeas corpus only to situations where a person is formally detained rather than to broader situations where liberty interests are infringed. Put more simply, the application judge wrongly concluded that in order for there to be an infringement of liberty, to which the writ of habeas corpus could apply, there had to be a detention of the individual in a custodial facility. That view does not find support in the case law nor does it accord with the fundamental constitutional values that underlie the important remedy reflected in the principle of habeas corpus. ....
 Admittedly, the most common use of the writ of habeas corpus is where a person is being held in custody and they have not, for whatever reason, been granted a hearing respecting their qualification for release from custody. But there is nothing in the history of the remedy that would justify limiting its reach solely to situations where a person is being held in custody. The most common use should neither eclipse nor exclude other possible uses.
 The core protection afforded by the writ of habeas corpus is the protection of a person’s liberty. That is, the protection of the right that every individual has to go about their daily life without interference by the state. Where the state acts to restrict the liberty of the individual, then the individual must have the right to seek a review of the legitimacy of those restrictions. As Rouleau J.A. said in Chaudhary, at para. 94:
Habeas corpus issues as of right once a detainee proves a deprivation of liberty and raises a legitimate ground upon which to question the legality of that deprivation. (Emphasis added).....
 As the decision in May makes clear, habeas corpus potentially applies to any situation where the state restrains the liberty of the subject. A person subject to house arrest is a person who has had their liberty restricted. They are unable to do that which every other ordinary citizen is entitled to do. As Sharpe J.A. aptly put it in his dissenting reasons in R. v. Panday, 2007 ONCA 598 (CanLII), 87 O.R. (3d) 1, at para. 63:
Bail and jail are different points on a continuum between complete freedom and total deprivation of liberty. Strict conditions amounting to house arrest significantly constrain liberty and push bail towards the total deprivation of liberty end of the continuum.See also R. v. Downes (2006), 2006 CanLII 3957 (ON CA), 79 O.R. (3d) 321 (C.A.), at para. 29.
 A further decision of importance to this issue is R. v. Gamble, 1988 CanLII 15 (SCC),  2 S.C.R. 595, where the writ of habeas corpus was used to challenge a parole ineligibility provision. Parole, of course, takes effect after a person is released from custody. In commenting on the flexibility that is important to the remedy, especially in the context of Charter rights, Wilson J. said, at para. 64:
There is no doubt that considerable uncertainty has clouded the scope of review open to a court on an application for habeas corpus and it is understandable that courts have, in general, not bound themselves to limited categories or definitions of jurisdictional review when the liberty of the subject was at stake. [Citations omitted.]
6. Civil versus Criminal. Canada (Attorney General) v. Samuel
In Canada (Attorney General) v. Samuel (Ont CA, 2019) the Court of Appeal considers for cost purposes whether habeas corpus proceedings are civil or criminal:
 The authority to award costs in habeas corpus proceedings depends on whether the matter is characterized as civil or criminal in nature. In Re Storgoff, 1945 CanLII 17 (SCC),  S.C.R. 526 states that it is “the nature and character of the proceeding in which habeas corpus is sought” which determines whether it is a criminal matter.
 Re Ange, 1970 CanLII 275 (ON CA),  3 O.R. 153 (C.A.) establishes the principle that there is no jurisdiction to award costs for habeas corpus in criminal matters. The issue in that case was the expiry date of concurrent and overlapping periods of imprisonment, requiring interpretation of the Criminal Code and the Parole Act. This court found that the determination of the expiry date was a criminal matter and the court did not have jurisdiction to award costs.
 On the other hand, it is well-established that habeas corpus proceedings arising from prison discipline and transfer decisions are characterized as civil in nature and that costs may therefore be awarded: Oliver v. Attorney General (Canada), 2010 ONSC 6431 (CanLII). A habeas corpus application arising from prison disciplinary proceedings is considered a civil matter, “because it deals with an inmate’s obligation to conduct himself in accordance with prison rules rather than calling him to account to society for a crime violating the public interest” and because it relates “to the administration of the lawful sentence by public authorities, rather than the legality of the original conviction or indictment”: R. v. Campbell, 2010 ONSC 6619 (CanLII), at para. 1
 Similarly, in Karafa v. The Attorney General of Canada, 2016 ONSC 2604 (CanLII), the court awarded costs in a habeas corpus application relating to an involuntary transfer to medium security. Habeas corpus matters where inmates seek release from segregation have been found to be civil matters: Vukelich v. Mission Institution, 2005 BCCA 75 (CanLII), 38 B.C.L.R. (4th) 132, at paras. 33-38. Transfer decisions between institutions and decisions about re-classifications are also considered to be civil in nature: Ross v. Riverbend Institution (Warden), 2008 SKCA 19 (CanLII), 310 Sask. R. 9; Hertrich v. Her Majesty the Queen, 2010 ONSC 6334 (CanLII), at para. 3; Olivier.
 The appellant submits that as the impugned decision resulted in re-incarceration on his criminal sentence and was motivated by a penal intent, it ought to be regarded as criminal in nature.
 The respondent argues that parole revocation is an administrative decision governed by a comprehensive administrative scheme in the Corrections and Conditional Release Act, S.C. 1992, c. 20 (“CCRA”) and therefore is more akin to disciplinary proceedings than to a criminal proceeding. The respondent argues that habeas corpus should only be regarded as criminal in nature if it arises from proceedings directly related to the criminal trial process, including a challenge to the warrant of committal, and that anything related to the execution or administration of the sentence is properly regarded as civil in nature.
 Counsel were unable to point to any case law on the question of whether a habeas corpus application challenging the revocation of parole is characterized as criminal or civil in nature. The respondent relies on Lee v. Canada (Attorney General), 2018 ABQB 40 (CanLII), 403 C.R.R. (2d) 194, where the court struck out a confused application alleging that the applicant’s detention on a life sentence for murder had become unlawful because the Parole Board refused to consider his application for parole and because he had not committed any violent act while in prison. The court described his application as badly framed, “gibberish” and an abuse of process and ordered him to pay $2,000 costs.
 Lee is not binding on this court and in any event I do not regard it as determinative of the issue before us. It was not even clear that the application the court struck out could be considered a habeas corpus application. If it was, in fact, a habeas corpus application, the case did not involve the revocation of parole and it presented many other features crying out for a costs award that are not present here.
 The respondent’s submission that this is a civil matter has to be assessed in the light of the language and purpose of the statutory scheme that governed the decision the appellant seeks to challenge. Section 135(1) of the CCRA provides for the suspension of parole and re-incarceration of the offender “when an offender breaches a condition of parole or statutory release or when…it is necessary and reasonable to suspend the parole or statutory release in order to prevent a breach of any condition thereof or to protect society”. Section 135(7) provides “where…the continued parole or statutory release of an offender would constitute an undue risk to society by reason of the offender reoffending”, parole may be terminated or revoked. Where the offender is returned to custody by virtue of these provisions, the offender “continues to serve the offender’s sentence”: s. 135(10).
 In my view, s. 135 indicates that parole revocation has a criminal law purpose and rationale, namely, the protection of society. The reason given for the warrant of apprehension and suspension of the appellant’s day parole was “the protection of society” and the Parole Board revoked the appellant’s day parole release because he presented an “undue risk to society”. These stated reasons track the criminal rationale of s. 135. The appellant was not, as in the case of the prison discipline and transfer cases, subjected to an administrative sanction in order the maintain control within a prison, but rather ordered to “continue to serve” the sentence that the court had imposed in order to protect society.
 In the prison discipline and prison transfer cases, the criminal law sentence serves as merely part of the background. It is the reason why the applicant is in the institution and subject to prison discipline. The sanction an applicant would challenge is an administrative order that is quite distinct from the sentence imposed by the criminal court.
 In the case of parole revocation, the purpose of the challenged decision is the protection of society, not maintaining order within the institution, and the justification for the detention that is at issue on the habeas corpus application is the re-institution of the criminal sentence imposed by the court. In my view, such an application is properly characterized as being criminal rather than civil in nature.
 I conclude, accordingly, that the application judge erred by characterizing this as a civil case and awarding costs.
7. Standard of Review. Wang v Canada
In Wang v. Canada (Ont CA, 2018) the court notes that the standard of judicial review is one of 'correctness'. In judicial review cases the law distinguishes 'correctness' from 'reasonableness', the latter being more forgiving of the tribunal below and the former requiring that the decision below be simply 'correct'.
 Before embarking on that review, however, I would point out that the scope of the writ of habeas corpus constitutes a question of law. The standard of review is, thus, one of correctness: Housen v. Nikolaisen, 2002 SCC 33 (CanLII),  2 S.C.R. 235, at para. 8.-----------------------------
Cases to be integrated
Chaudhary v. Canada (Public Safety and Emergency Preparedness) (Ont CA, 2015) paras 38-43
Canada (Public Safety and Emergency Preparedness) v. Chhina (SCC, 2019)