OPINION Appellant Louie Carbajal filed a petition for a writ of habeas corpus contending that his constitutional rights were violated because he was unable to receive an expunction of a felony charge that the State had previously dismissed. The trial court refused to issue the writ, finding that Carbajal had not alleged any facts to support a finding that he was being illegally confined or restrained, and this appeal followed. For the reasons set forth below, we conclude that the trial court’s order refusing to issue the writ is not reviewable on appeal, and we therefore dismiss the appeal for lack of jurisdiction. PROCEDURAL AND FACTUAL BACKGROUND In 2016, Carbajal was indicted by a grand jury on one count of continuous sexual abuse of a child under the age of 14. The State later filed a motion to dismiss the indictment on the following grounds: “Prosecutorial Discretion-mother of complaining witness juvenile refuses to participate in prosecution.” Carbajal subsequently filed a petition seeking an expunction of the records of the dismissed charge, but the county attorney answered the petition, arguing that he was not entitled to an expunction under applicable state law. Carbajal then filed the current application for a writ of habeas corpus in which he apparently acknowledged that he was not entitled to an expunction under existing Texas law. Rather, he argued that his inability to obtain an expunction violated various provisions in the Texas Constitution, including the right to equal protection under the law, the right to a speedy trial, and the right to “due course of law.”[1] In his habeas application, Carbajal requested a finding that the statutes violated the Texas Constitution, and that he was therefore entitled to have his record expunged. Although no writ had issued requiring a response to the application, the El Paso District Attorney’s Office filed a response which asserted that because expunction is a statutory privilege rather than a right, the Texas Legislature was entitled to limit the privilege in any way it deemed proper. Accordingly, Carbajal’s inability to obtain an expunction did not deprive him of any of his constitutional rights. See Matter of A.H., 580 S.W.3d 841, 846 (Tex.App.–El Paso 2019, no pet.) (a petitioner’s ability to obtain an expunction is purely a matter of statutory privilege, and a petitioner therefore has no right to obtain an expunction unless the requirements of the expunction statutes are met). Following a hearing at which both Carbajal’s attorney and the district attorney’s office appeared, the trial court issued an order stating that it lacked jurisdiction to consider the writ petition because Carbajal was not being restrained of his liberty and was therefore not entitled to the issuance of a writ. Carbajal thereafter filed a notice of appeal from that order. DISCUSSION Although Carbajal contends that the trial court erred in denying his writ petition, and that the trial court was instead required to issue the writ to provide him with the opportunity to argue the merits of his claim attacking the constitutionality of the expunction statutes, we agree with the State that the trial court’s order refusing to issue the writ is not subject to appellate review.[2] Applicable Law A person who believes they are being unlawfully restrained of liberty may file a petition for a writ of habeas corpus. See TEX.CODE CRIM.PROC.ANN. ART. 11.01. The writ itself is simply an order requiring the person who is restraining the petitioner to appear in court, along with the petitioner, to show cause why the petitioner is being restrained. TEX.CODE CRIM.PROC.ANN. ARTS. 11.01, 11.31 (the person on whom the writ is served shall bring before the judge the person in his custody, or under his restraint); Ex parte Hargett, 819 S.W.2d 866, 868 (Tex.Crim.App. 1991) (en banc) (recognizing that a writ of habeas corpus is an order from a judge commanding a party, who is alleged to be restraining the applicant in some way, to appear before the court with the object of alleged restraint and explain the reasons for the restraint). To be entitled to the issuance of a writ, the writ petition must contain sworn allegations that the petitioner is being illegally confined or restrained in their liberty and must name the persons who is effecting the restraint. TEX.CODE CRIM.PROC.ANN. ART. 11.14(1), (5); see also City of El Paso v. Alvarez, 931 S.W.2d 370, 379 (Tex.App.–El Paso 1996, no writ) (recognizing that a writ petition must contain sworn allegations of fact stating that the petitioner is being illegally restrained in his or her liberty). Before a court addresses the issue of whether to grant or deny the ultimate relief requested, the court must first review the petition itself to “determine whether there is sufficient cause for the writ to be issued.” See Hargett, 819 S.W.2d at 868; see also Ex parte Walker, 489 S.W.3d 1, 7 (Tex.App.–Beaumont 2016, pet. ref’d) (before a trial court addresses the issue of whether to grant or deny the ultimate relief requested in an application for writ of habeas corpus, it must first determine whether to issue the writ itself). A court is not required to issue the writ if it is “manifest from the petition itself, or some documents annexed to it, that the party is entitled to no relief whatever.” TEX.CODE CRIM.PROC.ANN. ART. 11.15; Lofton v. State, 777 S.W.2d 96, 97 (Tex.Crim.App. 1989) (en banc) (court need not issue a writ if it is “manifest” from the face of the writ application that a petitioner is not entitled to relief). In general, when a petition does not allege sufficient facts to support a finding that a petitioner is actually being restrained of their liberty (whether legally or not), a court lacks jurisdiction to issue the writ. See Alvarez, 931 S.W.2d at 380; see also Ex parte Cathcart, 13 S.W.3d 414, 417 (Tex.Crim.App. 2000) (en banc) (petitioner who filed an application for a pretrial writ of habeas corpus seeking to challenge a delay in her indictment failed to properly invoke the court’s habeas corpus jurisdiction as she was not being restrained of her liberty at the time she filed her application); see generally Ex parte Weise, 55 S.W.3d 617, 619 (Tex.Crim.App. 2001) (writ petitioner must be illegally restrained to be entitled to habeas corpus relief); Gibson v. State, 921 S.W.2d 747, 753-54 (Tex.App.–El Paso 1996, writ denied) (petitioner must show not only that he is being restrained, but that the restraint is unlawful). Also a general rule, when a court issues an order refusing to issue a writ of habeas corpus on jurisdictional grounds, without reaching the merits of the petitioner’s underlying claims, there is no appeal from the court’s order, as it is not considered a final judgment or order. Ex parte Villanueva, 252 S.W.3d 391, 395 (Tex.Crim.App. 2008) (holding that no appeal can be had from a refusal to issue or grant a writ of habeas corpus, where the court did not reach the merits of the petition).[3] And this is true even when, as here, the court has held a hearing on the petition to determine if it will issue the writ. See Hargett, 819 S.W.2d at 868 (distinguishing between hearings in which court determines whether it will address the merits of a writ application, which does not give rise to appellate review, and hearings where the merits of the application are addressed and resolved, which does give rise to appellate review). Of course, if a court does not formally issue a writ, but nevertheless resolves a habeas petition on its merits, the writ will be considered to have been impliedly issued, and the court’s order resolving the petition will be considered appealable. See Villanueva, 252 S.W.3d at 395; see also Ex parte Gonzales, 12 S.W.3d 913, 914 (Tex.App.–Austin 2000, pet. ref’d) (“If the trial court reaches the merits of the habeas corpus application, its ruling is appealable even if it comes in the form of an order refusing to issue the writ.”). Therefore, in determining whether a trial court’s order denying a writ petition is subject to appellate review, the key question is whether or not the court addressed the merits of the petitioner’s underlying claim. See, e.g., Ex Parte Betancourt, No. 08-05-00063-CR, 2006 WL 1875576, at *3 (Tex.App.–El Paso July 6, 2006, no pet.) (not designated for publication). Analysis In the present case, Carbajal acknowledged in the trial court, as he does on appeal, that the trial court never issued a writ requesting a response from the district attorney’s office, and that to the contrary, the trial court expressly refused to issue the writ.[4] Accordingly, the only remaining issue for our consideration is whether the trial court considered the merits of Carbajal’s arguments in refusing to issue the writ. Upon reviewing the record in its entirety, we conclude that the trial court did not. In making this determination, we are assisted by the trial court’s own statements at the hearing, as well as its written order, in which it expressly found that it lacked jurisdiction to issue the writ given Carbajal’s failure to demonstrate that he was actually being restrained of his liberty. Moreover, there is nothing in the record to reflect that the trial court expressed any opinion on the merits of Carbajal’s underlying claim regarding the constitutionality of the Texas expunction statutes in rendering its decision. To the contrary, although the district attorney briefly addressed the merits of Carbajal’s claim at the hearing, Carbajal himself repeatedly urged the trial court not to consider his claim at that time, and instead urged the court to only consider the jurisdictional question of whether or not to issue the writ. And, as Carbajal himself acknowledges, the trial court agreed and therefore declined to consider the “ultimate” issue raised in his petition, i.e., whether he was being deprived of his constitutional rights, and instead based its refusal to issue the writ solely on a finding that Carbajal was not being restrained of his liberty. And finally, although Carbajal contends that the trial court erred in determining that he was not being restrained of his liberty, this question is not properly before us.[5] As explained above, a court lacks jurisdiction to issue a writ of habeas corpus if it finds as a preliminary matter that the petitioner is not being restrained of his liberty. See Alvarez, 931 S.W.2d at 380. And in turn, when a court denies a writ application based solely on a jurisdictional finding that there is no restraint, that denial is not subject to appellate review, and we therefore have no jurisdiction to review the trial court’s finding on that issue. See, e.g., Maddox v. State, No. 08-01-00490-CR, 2002 WL 504971, at *2 (Tex.App.–El Paso Apr. 4, 2002, no pet.) (not designated for publication) (where trial court dismissed petitioner’s application for writ of habeas corpus on “jurisdictional grounds” based on petitioner’s failure to allege any type of “restraint,” and did so without resolving the petitioner’s underlying claims, the trial court’s decision was not subject to appellate review); Ex parte Tisdale, No. 03-13-00785-CR, 2014 WL 1432359, at *2 (Tex.App.–Austin, Apr. 10, 2014, pet. ref’d) (mem. op., not designated for publication) (trial court’s determination that it lacked jurisdiction to hear petitioner’s application for writ of habeas corpus, where petitioner challenged the validity of a fine-only offense for which he was never confined, was not reviewable on appeal). CONCLUSION Because the trial court did not reach the underlying merits of the ultimate claim set forth in Carbajal’s writ petition, the court’s refusal to issue the writ is not subject to appellate review, and we therefore lack jurisdiction to hear this appeal. Accordingly, Carbajal’s appeal is dismissed. JEFF ALLEY, Justice March 19, 2021 Before Rodriguez, C.J., Palafox, and Alley, JJ. (Do Not Publish)