Answer this writ, stating the authority under which you restrain the prisoner. Exercise custody over the minor child.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. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. The court explained that a party filing a federal habeas corpus petition must exhaust their state court remedies prior to filing the petition. (M) Habeas Corpus to Obtain Custody of Child. Habeas corpus; refusal or neglect to obey; arrest; close custody; proceeding against sheriff; prisoner to be brought before court; power of county. A Habeas Corpus Petition must be filed in federal court within one (1) year and 90 days after the Michigan Supreme Court's ruling (465 days). When a law enforcement agency detains you, you have a right to challenge the legal basis, duration, and conditions of your incarceration. 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.