Procedure for Habeas Corpus. R. v. Codina
In R. v. Codina (Ont CA, 2021) the Court of Appeal considered a habeas corpus application:
 There are two stages in determining whether a habeas corpus application should be granted. First, the court must determine whether reasonable and probable grounds exist for the complaint. Second, if the court is satisfied that the grounds exist, then the application is heard on its merits: R. v. Olson, 1989 CanLII 120 (SCC),  1 S.C.R. 296, at p. 298.. 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.. Brown v. Canada (Public Safety)
 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 Brown v. Canada (Public Safety) (Ont CA, 2020) the Court of Appeal emphasized that a habeas corpus application should normally be considered promptly:
 Although I acknowledge that superior courts have broad discretion as to the scheduling of proceedings, they should not combine the hearing of both a habeas corpus application and a Charter damages application, as was done here.. Wang v Canada
 Because of the importance of the interests at stake, habeas corpus is intended to be a manner of quickly resolving the issue of the lawfulness of a person’s deprivation of liberty: May v. Ferndale Institution, 2005 SCC 82,  3 S.C.R. 809, at para. 69. Courts are to give priority to such applications as they are deemed to be urgent.
 If, as here, a habeas corpus application is allowed to be joined with a claim for Charter damages, it distorts what is otherwise intended to be an expeditious process. It inevitably results in significant delays to the hearing of the habeas corpus application and gives the Charter damages claim a higher priority for hearing than it would otherwise receive.
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.