The court will decide based on the best interests of the child who should have custody. However, a writ of habeas corpus cannot be brought to modify custody.In all writs of habeas corpus sought on account of the detention of a spouse or child, the court on hearing all the facts may exercise its discretion. This article discusses registering other states' custody and support orders in Texas so that Texas courts can change and enforce them. A Writ of Habeas Corpus literally means bring the body before the court, and therefor the state needs to prove why the detention is proper. A habeas petition would be appropriate wherein the child is being held. However, there may be further remedies available. You should definitely file a Petition for Writ of Habeas Corpus and Emergency Motion for Return of Child. Here you will find the form. (a) The relator may file a petition for a writ of habeas corpus in either the court of continuing, exclusive jurisdiction or in a court with jurisdiction.