Rightful Custody Rule

The remedy of habeas corpus has one objective: to inquire into the cause of detention of a person, and if found illegal, the court orders the release of the detainee. If, however, the detention is proven lawful, then the habeas corpus proceedings terminate. (In the Matter of the Petition for Habeas Corpus of Kunting; G.R. No. 167193, April 19, 2006)