Every person restrained of his or her liberty under any pretense whatever, may prosecute a writ of habeas corpus to inquire into the cause of the restraint. Filing a Petition for Writ of.Writ of Habeas Corpus: This is the legal instrument through which the right of Habeas Corpus is exercised. Information on what a parenting plan is and how to get one in Washington state. It demands a person's release from unlawful detention. A writ of habeas corpus requires that a person who is in custody be brought before a judge or court and that they be able to challenge that custody. It tests the legality of a detention or a restraint and the goal is to use it really almost i guess it's an emergency basis. United States law affords persons the right to petition the federal courts for a writ of habeas corpus. In many countries, authorities may incarcerate someone for months or years without charging them. The cases included here are cited as examples only and do not represent an exhaustive search of the case law in all federal circuits.