Habeas corpus is used to challenge the legality of the detention or restraint of a person and to obtain the person's prompt release. Writ of Habeas Corpus a civil case number and assign it to the judge assigned to the pending writ with the lowest case number.The Writ of Habeas Corpus is one of the most aggressive and optimal tools for a defendant who has been convicted and wrongfully incarcerated. 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. Who Should Use This Form. You should use this form if. The "Great Writ" of habeas corpus is a fundamental right in the Constitution that protects against unlawful and indefinite imprisonment. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. 'Habeas Corpus' literally means "to have a body of". This writ is used to release a person who has been unlawfully detained or imprisoned.