The Writ of Habeas Corpus protects prison inmates from false imprisonment to ensure people are not thrown into jail unlawfully. A habeas corpus petition cannot act as a second direct appeal.A petition for writ of habeas corpus is a legal action that allows individuals to challenge their unlawful imprisonment or restraint. The writ of Habeas Corpus is the legal system's last line of defense against unlawful incarceration. A writ of habeas corpus is a petition that an individual uses to challenge their conviction or sentence in California. The inmate may file a petition for writ of habeas corpus. Habeas corpus is a legal instrument that allows you to contest your incarceration, conviction, or sentencing conditions.