What is the Prerogative Writ of Habeas Corpus

Habeas Corpus is a royal prerogative writ involving a petition made to the sovereign, in Canada in the form of her Superior Court Justices, that if granted would compel a prison official to "produce the body" and justify authority for why a person is being detained. If justification for detention is inadequate, then the person must be released.  

Why Seek Habeas Corpus

The writ has fallen into disuse in Canada since the advent of elaborate judicial interim release provisions in the Criminal Code and the Charter where s. 10 guarantees upon arrest or detention that everyone has the right "to have the validity of the detention determined by way of habeas corpus and to be released if the detention is not lawful." But some cases will still fall through cracks, like national security immigration detentions of persons never charged with any crime where the Supreme Court of Canada has found habeas corpus to be an appropriate remedy. 

How to Apply for Habeas Corpus

Only a court of "original inherent jurisdiction" has authority under the common law to grant the writ of habeas corpus, which in Ontario is the Superior Court of Justice. 

Habeas corpus is sought by way of notice of application, and supporting affidavit with exhibits, explaining where and under what conditions the affected person is being held, and why there appears to be no lawful authority to hold that person. 

It's possible to appeal a habeas corpus decision by a Superior Court up to the Court of Appeal.