
263 S.W.3d 120 (2006)
In re Rodney JONES.
No. 01-06-01061-CV.
Court of Appeals of Texas, Houston (1st Dist.).
November 22, 2006.
*121 Rhonda Jo Session, Angleton, for Relator.
Sherill Dean, Houston, for Real Party In Interest.
Panel consists of Justices NUCHIA, JENNINGS, and HIGLEY.

OPINION
TERRY JENNINGS, Justice.
By petition for writ of mandamus, relator, Rodney Jones, challenges the district court's November 14, 2006 Temporary Restraining Order excluding him from possession of his minor child, L.M.J., and designating real party in interest, Erika M. Delgado, as the conservator of the child with the exclusive right to designate the primary residence of the child.[1] He also requests that we direct the district court *122 to grant his petition for writ of habeas corpus for possession of his child.
We conditionally grant the writ.

Background
Jones is the biological father of L.M.J., born January 17, 1996. He was adjudicated as her father on March 11, 1999 by a court order that named L.M.J.'s mother, Leslee Castillo, managing conservator and named Jones possessory conservator. On September 15, 2006, Castillo died in a motor vehicle accident.
On October 14, 2006, Jones filed a petition for writ of habeas corpus, seeking return of his daughter from Delgado, her maternal aunt. On November 6, 2006, Delgado filed in the district court an Original Petition in Suit Affecting the Parent-Child Relationship, seeking sole managing conservatorship of L.M.J. Subsequently, on November 14, 2006, Delgado amended her petition and obtained an ex parte temporary restraining order designating her as L.M.J.'s conservator and excluding Jones from possession of or access to L.M.J. The district court further ordered Jones to appear for a hearing on November 27, 2006, to determine, among other things, whether the temporary restraining order should be made a temporary injunction.
After learning of the district court's order, Jones filed his petition for writ of mandamus asking this Court to direct the district court "to vacate all temporary restraining orders in effect, to dismiss the suit in which Erika Delgado, who has no standing, sought sole managing conservatorship of the child, and order the [district] court to grant the [petition for] writ of habeas corpus for possession of the child."

Standard of Review
Mandamus relief is available only to correct a "clear abuse of discretion" when there is no adequate remedy by appeal. Walker v. Packer, 827 S.W.2d 833, 839 (Tex.1992) (orig.proceeding). "A trial court clearly abuses its discretion if `it reaches a decision so arbitrary and unreasonable as to amount to a clear and prejudicial error of law.'" Id. at 839 (citing Johnson v. Fourth Court of Appeals, 700 S.W.2d 916, 917 (Tex.1985) (orig.proceeding)). Mandamus is a proper remedy to attack issuance of a temporary restraining order issued in a custody proceeding because such orders are not subject to interlocutory appeal. TEX. FAM.CODE ANN. § 105.001(e) (Vernon Supp.2006); Dohrn v. Delgado, 941 S.W.2d 244, 246 (Tex.App.-Corpus Christi 1996, orig. proceeding); see Dancy v. Daggett, 815 S.W.2d 548, 549 (Tex.1991) (orig.proceeding); see also Bosakewich v. Webb, No. 01-91-00089-CV, 1991 WL 17061, at *2 (Tex.App.-Houston [1st Dist.] Feb. 14, 1991, orig. proceeding). Mandamus will issue when there is a legal duty to perform a nondiscretionary act, a demand for performance, and a refusal. O'Connor v. First Court of Appeals, 837 S.W.2d 94, 96 (Tex.1992) (orig. proceeding).

Habeas Corpus
"In the absence of specific provisions to the contrary in an order establishing conservatorship, the death of the managing conservator ends the conservatorship order." Greene v. Schuble, 654 S.W.2d 436, 437-38 (Tex.1983) (orig.proceeding). The Family Code provides:
If the right to possession of a child is not governed by an order, the court in a habeas corpus proceeding involving the right of possession of the child:
(1) shall compel return of the child to the parent if the right of possession is between a parent and a nonparent and a suit affecting the parent-child relationship has not been filed; or

*123 (2) may either compel return of the child or issue temporary orders under Chapter 105 if a suit affecting the parent-child relationship is pending and the parties have received notice of a hearing on temporary orders set for the same time as the habeas corpus proceeding.
TEX. FAM.CODE ANN. § 157.376(a) (Vernon 2002). A district court must hear an application for writ of habeas corpus concerning the proper legal custodian of a child and make its determination solely on the basis of who, at that time, has the legal right to custody. Greene, 654 S.W.2d at 438; Bosakewich, 1991 WL 17061, at *2. Moreover, "in the event of the death of the managing conservator, the surviving parent has a right to possession of the children." Greene, 654 S.W.2d at 438. Where a parent has a clear right to possession of a child and has filed a petition for writ of habeas corpus, the issuance of that writ is not discretionary but is a matter of right. Id. "The issuance of the writ should be automatic, immediate, and ministerial." Id.
A court may enter a temporary order for the temporary conservatorship of a child in a suit affecting the parent-child relationship. TEX. FAM.CODE ANN. § 105.001(a). Generally, a temporary order may be granted without the necessity of a verified pleading or an affidavit stating specific facts showing that immediate and irreparable injury, loss, or damage will result before notice can be served; however, an affidavit or verified pleading is required before a court may issue temporary orders "excluding a parent from possession of or access to a child." Id. § 105.001(b), (c). Moreover, "the rebuttable presumptions established in favor of the application of the guidelines for a . . . standard possession order under Chapters 153 and 154 apply to temporary orders." Id. § 105.001(g). Specifically, the Family Code establishes the presumption that a parent should be appointed managing conservator:
Subject to the prohibition in Section 153.004, unless the court finds that appointment of the parent or parents would not be in the best interest of the child because the appointment would significantly impair the child's physical health or emotional development, a parent shall be appointed sole managing conservator or both parents shall be appointed as joint managing conservators of the child.
TEX. FAM.CODE ANN. § 153.131(a) (Vernon 2002).[2]
In this case, the right to possession of L.M.J. is not governed by a court order because Castillo's death terminated the conservatorship order. See Greene, 654 S.W.2d at 437-38. Moreover, the petition for writ of habeas corpus was filed before the suit affecting the parent-child relationship. At the time that Jones filed his petition for writ of habeas corpus, no suit affecting the parent-child relationship had been filed. At that time, as between Jones, a parent, and Delgado, a nonparent, Jones had a superior legal right to possession of L.M.J. TEX. FAM.CODE ANN. § 157.376(a)(1); Greene, 654 S.W.2d at 438; Bosakewich, 1991 WL 17061, at *2.
Furthermore, at the time that the district court granted the temporary restraining order, both a petition for writ of habeas corpus and a suit affecting the parent-child relationship were pending. Accordingly, the district court should have *124 heard both the petition for writ of habeas corpus and the motion for temporary restraining order at the same time, after notice to all the parties. TEX. FAM.CODE ANN. § 157.376(a)(2). The district court did not do so. Instead, it granted a temporary restraining order without notice to Jones and without hearing the petition for writ of habeas corpus at the same time. In doing so, the district court clearly abused its discretion.
Finally, because Jones has a clear right to possession of L.M.J., the district court had a nondiscretionary duty to grant his petition for writ of habeas corpus. It did not do so, and mandamus will issue to correct the district court's violation of its nondiscretionary duty. O'Connor, 837 S.W.2d at 96.
Accordingly, we hold that the district court abused its discretion in granting the temporary restraining order, which among other things excluded Jones from possession of or access to his daughter, without notice and without hearing Jones's petition for writ of habeas corpus at the same time. We further hold that the district court violated its nondiscretionary duty in failing to grant Jones's petition for writ of habeas corpus. See Greene, 654 S.W.2d at 438. ("The issuance of the writ should be automatic, immediate, and ministerial.")

Conclusion
We conditionally grant Jones's petition for writ of mandamus and direct the district court to vacate its November 14, 2006 order and grant Jones's petition for writ of habeas corpus. We deny the petition for writ of mandamus to the extent that Jones asks us to dismiss the suit in which Delgado seeks sole managing conservatorship of L.M.J. We are confident that the district court will promptly comply, and our writ will issue only if it does not.
NOTES
[1]  The underlying suit is In the Interest of L.M.J., A Child, No. 5151OB98, In the 300th Judicial District Court of Brazoria County, Texas, Honorable Robert May, presiding.
[2]  Section 153.004 addresses family violence, abuse, and neglect. TEX. FAM.CODE ANN. § 153.004 (Vernon Supp.2006).
