Canadian Criminal Procedure and Practice/Pre-Trial Matters/Habeas Corpus
Habeas corpus refers to the common law prerogative writ of relief that challenges the detention of a detainee. This prerogative writ was also imported into section 10(c) of the Charter:
10. Everyone has the right on arrest or detention...
- c) to have the validity of the detention determined by way of habeas corpus and to be released if the detention is not lawful.
A prerogative writ is a manner of correcting errors of jurisdiction made by inferior courts as well as correcting failures of natural justice or procedural fairness.
An application for habeas corpus requires: 
- a deprivation of liberty and
- that the deprivation be unlawful
The onus of proof to establish the deprivation rests on the applicant while the onus to establish the lawfulness of the deprivation rests on the detaining authority.
The "double bunking" of inmates is generally not considered a form of deprivation of residual liberty. Similarly, housing an inmate in a double occupancy room instead of a usual single occupancy does not engage a deprivation of liberty.
- R. v. Forsythe ,  2 S.C.R. 268, 53 C.C.C. (2d) 225
- May v. Ferndale Institution 2005 SCC 82, (2005), 3 S.C.R. 809 at 74
- May, supra
See: B.R.L. v. Canada,  F.C.J. No. 108
Robert Collin v. The Solicitor General of Canada,  1 F.C. 496
Piche v. Canada (Solicitor General),  F.C.J. No. 204
- Mennes v. Canada (Attorney General), 2008 CanLII 6424 (ON SC)