Answer this writ, stating the authority under which you restrain the prisoner. Exercise custody over the minor child.A Writ of Habeas Corpus challenges the legality of your incarceration. The purpose of a writ of habeas corpus is to show that the court decision to imprison a person was based on a legal or factual error. (M) Habeas Corpus to Obtain Custody of Child. A writ of habeas corpus is a court order requiring a person in custody to be brought before a judge or into court. This course will primarily focus on the writ as a post-conviction remedy for illegal detentions resulting from flawed state criminal convictions. For example, they may be able to file appeals or petition the court for a writ of habeas corpus. A court of record may issue a writ of habeas corpus directing that a prisoner in a jail or prison in Michigan be brought to testify. Thus, habeas corpus cannot serve as a substitute for an appeal or writ of error and cannot be used to review the merits of a criminal conviction. 7.