OPINION
HOLLIS HORTON, Justice.This is an appeal from a denial of a writ of habeas corpus proceeding that questioned the advice the defendant was given by his attorney concerning the consequence of pleading guilty on the defendant’s status as a legal immigrant. In this appeal, we consider whether further proceedings are required to allow the parties to present testimony for the trial court to consider before it determines if Julian Hernandez received ineffective assistance of counsel and, if so, whether he was prejudiced by his attorney’s advice. We conclude the trial court erred by considering only the record of the guilty plea hearing in deciding the disputed issues; as a result, further proceedings are required.
In July 2012, Hernandez filed an application for writ of habeas corpus claiming that his attorney failed to advise him that pleading guilty to possessing alprazolam would result in his removal from the country. See 8 U.S.C.A. § 1101(a)(48) (West 2005) (defining the term “conviction” for immigration purposes to include cases where the adjudication and the sentence is not imposed). Hernandez argues that had he been provided with accurate information about the immigration consequences of pleading guilty, he would not have pled guilty to possessing alprazolam. See Padilla v. Kentucky, 559 U.S. 856, 130 S.Ct. 1473, 176 L.Ed.2d 284 (2010).
In his application for the writ, Hernandez sought to establish that his plea counsel failed to properly advise him of the consequences of his guilty plea, making his plea involuntary, and that he was prejudiced by his attorney’s incorrect advice. See Tex.Code Crim. Proc. Ann. art. 11.072 § 1 (West 2005) (establishing procedures for an application for a writ of habeas corpus for cases that concern orders imposing community supervision). According to .the application, Hernandez’s plea counsel advised him that a guilty plea to the offense at issue might result in his deportation, but did not advise him that pleading guilty would “result in certain deportation[.]” Hernandez further alleged that “if he had been so advised by either his lawyer or [the trial] court, he would not have pled guilty but tendered defenses for the crime.” Hernandez verified the statements in his application under oath.
*371The record reflects that Hernandez has been living in the United States since 1991, and in 2007, he became a lawful permanent resident.1 In 2010, the State charged Hernandez with possessing alprazolam, a Class A misdemeanor. See Tex. Health & Safety Code Ann. §§ 481.104, 481.117(b) (West 2010). The record also shows Hernandez was admonished, in writing, that a plea of guilty “may result in your deportation, exclusion from admission to the country or denial of naturalization under federal law.” See Tex.Code Crim. Proc. Ann. art. 26.18(a)(4) (West Supp.2012) (providing that prior to accepting a plea of guilty or nolo contendere the court shall admonish the defendant of the “fact that if the defendant is not a citizen of the United States of America, a plea of guilty or nolo contende-re for the offense charged may result in deportation, the exclusion from admission to this country, or the denial of naturalization under federal law”). Hernandez chose to plead guilty to possession; however, the trial court did not pronounce a sentence. Instead, the trial court deferred the adjudication of Hernandez’s guilt and placed him on community supervision for one year. After completing the conditions that were required of him by the community supervision order, the trial court discharged Hernandez and dismissed the case.
Subsequently, Hernandez was arrested for an immigration violation — based on his guilty plea to the previously discussed drug crime — and is being held by a federal law enforcement agency, the United States Immigration and Customs Enforcement. The record from the habeas proceeding reflects that the United States is seeking to remove Hernandez from the United States because he was “convicted in the County Court of Jefferson County ... for the offense of Possession of a Controlled Substance[.]” See 8 U.S.C.A. § 1227(a)(2)(B)(i) (West 2005 & Supp.2010) (providing that “[a]ny alien who at any time after admission has been convicted of a violation of ... any law or regulation of a State, the United States, or a foreign country relating to a controlled substance, ... other than a single offense involving possession for one’s own use of 80 grams or less of marijuana, is deportable”); see Padilla, 130 S.Ct. at 1477 n. 1 (“[Virtually every drug offense[,] except for only the most insignificant marijuana offenses, is a deportable offense under 8 U.S.C.fA.] § 1227(a)(2)(B)(i).”).
Although the collateral consequences of Hernandez’s guilty plea arose because federal law treats a deferred adjudication on a case as a conviction, that restraint may be addressed in a habeas proceeding. See Ex parte Hargett, 819 S.W.2d 866, 867 (Tex. Crim.App.1991), superseded by statute, Tex.Code Crim. Proc. Ann. art. 11.072 (West 2005) (involving a habeas proceeding that challenged .validity of applicant’s guilty plea based on a claim of ineffective assistance because the plea affected the applicant’s military retirement benefits). Hernandez challenged the restraint created by his guilty plea through a writ of habeas corpus, which “is the remedy to be used when any person is restrained in his liberty.” Tex.Code Crim. Proc. Ann. art. 11.01 (West 2005). The writ of habeas corpus “is an order issued by a court or judge of competent jurisdiction, directed to any one having a person in his custody, or under his restraint, commanding him to produce such person, at a time and place *372named in the writ, and show why he is held in custody or under restraint.” Id. Under Chapter 11 of the Code of Criminal Procedure, which governs writs of habeas corpus, a “restraint” is “the kind of control which one person exercises over another, not to confine him within certain limits, but to subject him to the general authority and power of the person claiming such right.” Id. art. 11.22 (West 2005). Also, under Chapter 11, a writ of habeas corpus is the appropriate vehicle to challenge “all such cases of confinement and restraint!.]” Id. art. 11.23 (West 2005). We conclude that Hernandez may challenge the restraint at issue by filing a writ of habeas corpus.
The trial court’s decision to dismiss the drug possession case after Hernandez successfully completed the requirements of his deferred adjudication did not render Hernandez’s application moot. See Tatum v. State, 846 S.W.2d 324, 327 (Tex.Crim. App.1993) (“A judgment of conviction for a misdemeanor offense may have detrimental collateral consequences whether or not probation is completed without a hitch or jail time is actually served.”); Ex parte Ormsby, 676 S.W.2d 130, 131 (Tex.Crim. App.1984) (stating that “mootness cannot prohibit a collateral attack [by habeas] if prior discharged convictions may have collateral consequences to a criminal defendant”). Thus, if Hernandez’s plea was not voluntary, as he contends, and if he succeeds in proving he suffered prejudice because he received ineffective assistance of counsel, the trial court has the power to remove the restraint at issue. See Tatum, 846 S.W.2d at 327 (suggesting that a misdemeanor judgment could be void and collaterally attacked, whether or not a term of probation was successfully served out); Ormsby, 676 S.W.2d at 132 (removing restraint created by invalid conviction by ordering the habeas applicant “released from every manner of restraint in his personal liberty as a consequence of that conviction”). In cases that involve deferred adjudications, as is the ease here, the restraint can be removed by a trial court issuing an order vacating the applicant’s plea. See Ex parte Sudhakar, No. 14 — 11— 00701-CR, 2012 WL 6061859, at *1-2, 5-6, 2012 Tex.App. LEXIS 10068, at *2-4, 16-17 (Tex.App.-Houston [14th Dist.] Dec. 6, 2012, no pet.) (mem. op., not designated for publication) (vacating plea in a misdemean- or drug case because of ineffective assistance resulting in involuntary plea where counsel failed to properly advise applicant regarding the immigration consequences of the plea).
In this case, the trial court entered an order stating that the attorney who represented Hernandez when he pled guilty “rendered all necessary paperwork in the hearing!,]” and denied Hernandez’s application on its merits. The trial court did not dismiss the application as frivolous. See Tex.Code Crim. Proc. Ann. art 11.072 § 7(a) (West 2005) (allowing the trial court to enter an order denying the application as frivolous or to enter a written order including findings of fact and conclusions of law). To evaluate the application’s merits, the trial court conducted a hearing. See Ex parte Villanueva, 252 S.W.3d 391, 394 (Tex.Crim.App.2008) (noting that “a hearing held to determine whether a writ should issue or whether the merits of claims should be addressed is not the same as one that is held to resolve the merits of an applicant’s allegations”) (citing Ex parte Hargett, 819 S.W.2d at 868). It is apparent from the hearing the trial court conducted that the trial court did not believe it needed to consider anything other than the written record from the proceedings that resulted in Hernandez’s guilty plea. During the hearing on Hernandez’s request for habeas relief, Hernandez’s ha-*373beas counsel indicated that before the hearing, he inquired about having a bench warrant issued to secure Hernandez’s presence, but his request was not honored; then, habeas counsel advised the court that he could get Hernandez to the hearing. At that point, the trial court responded: “No. I have reviewed your writ.” Thus, it appears the trial court did not believe it should consider Hernandez’s testimony about why he had chosen to plead guilty, or any testimony relevant to proving how Hernandez had suffered prejudice by following his attorney’s advice.
It also appears the trial court felt the testimony of the attorney who represented Hernandez when he pled guilty was unnecessary. The record of the habeas proceeding reflects that habeas counsel advised the trial court that Hernandez’s plea counsel told Hernandez before he pled guilty that his guilty plea may result in his deportation. When habeas counsel asked to present evidence on the issue of prejudice by affidavit, the trial court stated: “I will stipulate to the written documents that you have cited. They speak for themselves.” This exchange reinforces our conclusion that the trial court thought that the issues in dispute could be resolved by examining the existing record, and that testimony was unnecessary. For example, during the habeas hearing, the trial court stated that it was not interested in hearing testimony, stating that “any decision I make would be exclusively on the documentation.” Despite habeas counsel’s offers to develop the record, the record before us reflects that no witnesses testified during the habeas hearing. After denying Hernandez an evidentiary hearing, the trial court denied Hernandez’s request for relief.
Shortly after the habeas hearing, and before the trial court entered an order denying the writ on the merits, habeas counsel filed an offer of proof. The offer of proof reflects that habeas counsel requested but was denied a bench warrant that was intended to require Hernandez to appear at the habeas hearing. The offer of proof reiterates that Hernandez’s plea counsel failed to advise Hernandez that choosing to plead guilty made his deportation certain. The offer of proof also asserts that Hernandez would not have pled guilty had he known he would be deported. On the afternoon after the offer of proof was' filed, the trial court issued an order denying Hernandez’s writ.
After Hernandez appealed, we abated the appeal and asked the trial court to enter findings of fact and conclusions of law. See Tex.R.App. P. 31.3. Subsequently, the trial court found that it had not “wrongfully exclude[d] evidence or testimony[ ]” and that Hernandez had the burden of proof. Then, the trial court concluded that Hernandez “failed to [sustain] his burden of proof[.]” Although the findings made clear that the trial court decided the writ on the merits, it is not clear whether the trial court found that Hernandez failed to prove that he received inaccurate legal advice regarding the consequences of the plea to his status as an immigrant, or that he failed to prove he was prejudiced by his attorney’s inaccurate advice, or both. Nevertheless, our disposition of Hernandez’s appeal does not depend on whether the trial court ruled against Hernandez on one or both of these issues.
Generally, a trial court’s decision on an application for writ of habeas corpus is reviewed for abuse of discretion. Kniatt v. State, 206 S.W.3d 657, 664 (Tex.Crim. App.2006). With respect to an evidentiary ruling, the evidence introduced in a hearing is reviewed in the light most favorable to the trial court’s ruling. Id. The two-pronged Strickland v. Washington test ap*374plies to challenges to guilty pleas based on ineffective assistance of counsel for failing to provide accurate information about the immigration consequences of a plea. Padilla, 130 S.Ct. at 1482-84 (citing Strickland v. Washington, 466 U.S. 668, 688, 694, 104 S.Ct. 2052, 80 L.Ed.2d 674 (1984)). To obtain habeas relief on the ground of ineffective assistance, a defendant must show that his counsel’s representation fell below the standard of prevailing professional norms; he must also show that but for counsel’s deficiency, the result of the trial would have been different. See Strickland, 466 U.S. at 687, 104 S.Ct. 2052.
To prove a guilty plea was involuntary because of ineffective assistance, a defendant must show (1) counsel’s plea advice did not fall within the range of competence demanded of attorneys in criminal cases; and (2) there is a reasonable probability that, but for counsel’s deficient performance, defendant would have insisted on going-to trial rather than accepting the offer and pleading guilty. Hill v. Lockhart, 474 U.S. 52, 56, 59, 106 S.Ct. 366, 88 L.Ed.2d 203 (1985); Ex parte Harrington, 310 S.W.3d 452, 458 (Tex.Crim. App.2010). If plea counsel fails to advise a noncitizen defendant about deportation consequences that are “truly clear,” plea counsel’s performance is deficient. See Padilla, 130 S.Ct. at 1483; Aguilar v. State, 375 S.W.3d 518, 524 (Tex.App.Houston [14th Dist.] 2012, pet. filed).
In this case, the trial court apparently did not believe that any testimony was necessary to decide the issues raised by Hernandez’s writ, as it refused counsel’s offer to provide testimony to prove the allegations that led to the filing of the writ. After limiting the evidence that it would consider, the trial court denied the writ on the merits, basing its decision on a failure of proof. In our opinion, the issues raised by Hernandez in his application allowed the parties to develop the record beyond the written record of the prior plea proceedings, and a further development of the record is required so the trial court may make an informed decision on the issues in dispute. The trial court, under the circumstances, had several options to allow Hernandez’s testimony to be placed in evidence before deciding how to rule on the writ: it could have conducted an evidentia-ry hearing and allowed Hernandez and others the opportunity to testify; or, if Hernandez’s actual appearance was impractical because he is being detained by federal authorities, the trial court could have allowed the parties to take Hernandez’s deposition and present it during the hearing; or, the trial court could have allowed Hernandez to present his sworn testimony by teleconference. Instead, the trial court failed to provide habeas counsel with an adequate opportunity to develop the record with evidence relevant to the issues in dispute.
Under Rule 31.2, the “sole purpose of the appeal [of a habeas matter] is to do substantial justice to the parties.” Tex. R.App. P. 31.2. Rule 31 expressly applies to article 11.072 writs of habeas corpus. See Tex.Code Crim. Proc. Ann. art. 11.072 § 8 (West 2005). Rule 31.3 goes on to provide that “[t]he appellate court will render whatever judgment and make whatever orders the law and the nature of the case require.” Tex.R.App. P. 31.3. When a habeas record requires factual development, the Code of Criminal Procedure empowers the trial court to “order affidavits, depositions, interrogatories, or a hearing, and [the court] may rely on the court’s personal recollection.” Tex.Code Crim. Proc. Ann. art 11.072 § 6(b) (West 2005).
An appellate court may remand a habeas proceeding to the trial court for further proceedings if the factual record has not been sufficiently developed. See *375Ex parte Cherry, 232 S.W.3d 305, 308 (Tex.App.-Beaumont 2007, pet. ref'd). Additionally, an appellate court may remand where, as here, the record is not sufficiently developed regarding alleged prejudice. See Aguilar, 375 S.W.3d at 526 (remanding a habeas proceeding for development of record regarding alleged prejudice).
We conclude the trial court erred by announcing that it would not consider anything but the record of the prior proceedings and then ruling on the application’s merits. We hold the trial court improperly restricted the evidence to the prior plea, proceedings in face of habeas counsel’s efforts to offer other clearly relevant evidence. Because the trial court unduly restricted the development of the record, the trial court should be required to conduct further proceedings' to allow Hernandez and the State to develop relevant evidence addressing the issues in dispute. See Ex parte Sudhakar, 2012 WL 6061859, at *5-6, 2012 Tex.App. LEXIS 10068, at *16-17 (mem. op., not designated for publication). Accordingly, we reverse the trial court’s order denying the writ and remand the case for further proceedings consistent with this opinion.
REVERSED AND REMANDED.
. "The term 'lawfully admitted for permanent residence’ means the status of having been lawfully accorded the privilege of residing permanently in the United States as an immigrant in accordance with the immigration laws, such status not having changed.” 8 U.S.C.A. § 1101(a)(20) (West 2005).