A habeas corpus petition cannot act as a second direct appeal. The Writ of Habeas Corpus protects prison inmates from false imprisonment to ensure people are not thrown into jail unlawfully.A petition for writ of habeas corpus is a legal action that allows individuals to challenge their unlawful imprisonment or restraint. Federal habeas corpus is a procedure under which a federal court may review the legality of an individual's incarceration. Habeas corpus means demand of body. A writ of habeas corpus is a petition filed with the court when a prisoner wishes to contest the legality of his imprisonment. As appellate counsel, we are all familiar with petitions for writs of habeas corpus. On August 24, 2014, petitioner filed a petition for writ of habeas corpus in the Sacramento County Superior Court. ' You can file this type of writ petition when a person is illegally detained.