A petition for writ of habeas corpus is a legal action that allows individuals to challenge their unlawful imprisonment or restraint. Kids DefinitionKids; Legal DefinitionLegal; More from MW.The "Great Writ" of habeas corpus is a fundamental right in the Constitution that protects against unlawful and indefinite imprisonment. A writ of habeas corpus is a petition that an individual uses to challenge their conviction or sentence in California. Prisoners can sometimes use a petition for writ of habeas corpus to challenge the legality of a criminal conviction or inhumane prison conditions. A writ of habeas corpus is used to bring a prisoner or other detainee (e.g. A habeas corpus is a legal document used to bring a person who is being detained or imprisoned before a court. This petition, called a writ of Habeas Corpus, is filed in Federal Court (US District Court ) whether you are serving time in a federal or state prison. Habeas corpus is a legal instrument that allows you to contest your incarceration, conviction, or sentencing conditions. A successful Writ of Habeas Corpus may result in a reduction of a prison sentence, a new trial, or even a person's freedom.