
126 S.W.3d 565 (2003)
Ex Parte Reginald Demond GRAY.
No. 06-03-00167-CR.
Court of Appeals of Texas, Texarkana.
Submitted December 18, 2003.
Decided December 31, 2003.
Discretionary Review Dismissed March 24, 2004.
*567 Gary D. Young, Young & Young, PC, Paris, for appellant.
Mark S. Burtner, Lamar County Dist. Atty., Gary L. Waite, Asst. County Atty. Appellate Section, Paris, Val Varley, Red River County & Dist. Atty., Clarksville, for state.
Before MORRISS, C.J., ROSS and CARTER, JJ.

OPINION
Opinion by Justice CARTER.
In 2001, Reginald Demond Gray pled guilty to arson and was placed on deferred community supervision pursuant to a negotiated plea agreement. In 2003, Gray challenged the voluntariness of that plea in an application for writ of habeas corpus, filed pursuant to Article 11.08 of the Texas Code of Criminal Procedure. See Tex. Code Crim. Proc. Ann. art. 11.08 (Vernon 1977). In the writ application, Gray contended he received ineffective assistance of counsel at the time of the original guilty plea because his trial counsel did not assert an insanity defense based on Gray's 1997 acquittal by reason of insanity for a charge of aggravated assault. The trial court denied relief. We affirm.
Factual And Procedural Background
The record shows Gray has a lengthy history of severe mental illness. In 1995, Gray was charged with indecency of a child in two cases. On August 31, 1995, the State dismissed both indecency charges based on the psychologist's report that Gray was insane at the time of the alleged offenses. Later that evening, Gray was arrested and charged with the stabbing of his grandfather (Gray's primary caretaker), in trial court cause number 16643. See Tex. Pen.Code Ann. § 22.02(a)(2) (Vernon Supp.2004). Gray was also subsequently indicted for a November 15, 1996, arson, trial court cause number 16556.[1]See Tex. Pen.Code Ann. § 28.02 (Vernon 2003). On June 25, 1997, a jury found Gray not guilty of aggravated assault by reason of insanity. Gray was committed to Terrell State Hospital for psychiatric evaluation and treatment, then released from the psychiatric hospital sometime before March 2001.
Subsequent to his release from the hospital, Gray pled guilty on March 30, 2001, to both the aggravated assault and the arson in trial court cause numbers 16643 and 16556, respectively, the former being the same charge of which a jury had previously acquitted Gray by reason of insanity. The trial court accepted Gray's plea and found the evidence substantiated Gray's guilt in both cases, but deferred a finding of guilt and placed Gray on community supervision for a period of five years pursuant to a negotiated plea agreement. The record reflects neither the State nor defense counsel knew of Gray's earlier acquittal of the aggravated assault charge.
On August 1, 2002, the State filed a motion to adjudicate Gray's guilt in cause number 16556 (arson). On February 24, 2003, the State asked the trial court to set aside its judgment in the aggravated assault *568 case.[2] The State's motion conceded Gray had previously been acquitted of the aggravated assault charge by reason of insanity, and the State further acknowledged that a computer error contributed to the State's erroneous March 2001 prosecution of that charge. The trial court granted the State's motion, voided the judgment of community supervision on the aggravated assault charge, and dismissed that case for lack of jurisdiction.
With the motion to revoke on the arson charge still pending as of June 2, 2003, Gray filed a pre-conviction application for writ of habeas corpus in cause number 16556.[3] Gray alleged he received ineffective assistance of counsel at the time of his original guilty plea, in violation of the Sixth Amendment to the United States Constitution. Because Gray had previously been acquitted of aggravated assault by reason of insanity, Gray alleged his trial counsel on the arson plea was ineffective for failing to pursue an insanity defense on that charge. After conducting a hearing, in which the trial court heard testimony from seven live witnesses, the trial court denied Gray's application for writ of habeas corpus on June 20, 2003. It is from this determination that Gray appeals.
Analysis of the Issue Presented
Gray contends he received ineffective assistance of counsel at his original guilty plea. Both the United States and Texas Constitutions guarantee a criminal defendant the effective assistance of counsel at every stage of trial. U.S. Const. amend. VI; Tex. Const. art. I, § 10; Powell v. Alabama, 287 U.S. 45, 53 S.Ct. 55, 77 L.Ed. 158 (1932); Ex parte Harris, 596 S.W.2d 893, 894 (Tex.Crim.App.1980). "A guilty plea rendered without effective assistance of counsel (or a knowing and intelligent waiver of counsel) is not a voluntary and knowledgeable act, and habeas corpus relief will be granted" if the record supports a finding of ineffective assistance. Harris, 596 S.W.2d at 894. To attack a guilty plea because the defendant allegedly received ineffective assistance of counsel at the time of the plea, "a defendant must show counsel's alleged deficiencies caused [the defendant's] plea to be unknowing and involuntary. This standard requires a defendant to show there is a reasonable *569 probability that, but for counsel's errors, defendant would not have pled guilty, but would have insisted on going to trial." Hernandez v. State, 84 S.W.3d 26, 35 (Tex. App.-Texarkana 2002, pet. ref'd). An allegation of ineffective assistance must be "firmly rooted" in the record, and the Court must afford great deference to counsel's trial strategy in accordance with the strong presumption that counsel's actions fell "within the wide range of reasonable professional assistance." Id.
In this case, Barney Sawyer testified at the hearing on Gray's habeas application. Sawyer, an attorney with over twenty years' experience, served as defense counsel when Gray pled guilty to aggravated assault and arson in cause numbers 16443 and 16556, respectively. Sawyer stated he has known Gray and his family for over fifteen years and was well aware of Gray's history of mental illness at the time Gray pled guilty to arson. Sawyer admitted he did not review the district clerk's file on the aggravated assault charge and was not aware, at the time of Gray's plea, that Gray had previously been acquitted of aggravated assault by reason of insanity. However, Sawyer did know the State had previously dismissed two charges against Gray because the State believed Gray was insane at the time he allegedly committed the offenses.
In testimony during the habeas evidentiary hearing, Sawyer said he had discussed the arson charge with Gray's former defense attorney, Scott McDowell, and had reviewed a March 4, 1997, report from Dr. Randy Crittenden, a psychologist, who found Gray was sane at the time he allegedly set fire to his grandfather's house. Sawyer had also discussed the arson charge with the State and with Gray's grandfather, both of whom believed Gray was sane. According to Sawyer's testimony, the negotiated plea agreement required the State to recommend Gray receive deferred adjudication on the aggravated assault and arson charges in exchange for Gray's guilty plea, with the stipulation that the State then dismiss three additional charges of indecency with a minor (which included the two previously dismissed but recently refiled charges, plus a separate, new case charge of indecency).[4] The negotiated plea agreement therefore resolved five pending cases against Gray, with none resulting in an immediate adjudication of guilt.
Sawyer explained that, before encouraging Gray to plead guilty on the arson charge, Sawyer had several fears about the potential resolutions to Gray's cases, which he discussed with both Gray and his grandfather: First, Sawyer was doubtful that an insanity defense would be successful. Second, if Gray unsuccessfully gambled on obtaining a verdict of not guilty by reason of insanity and received one or more prison sentences, Sawyer believed Gray would not fare well in the penitentiary given his mental illness. Third, if Gray was found guilty of all the charges, but received community supervision, Sawyer believed Gray would quickly violate community supervision by failing to register as a sex offender, thereby aggravating his situation with the potential of imprisonment *570 on both the five current charges as well as a new felony charge of failing to register as a sex offender. See Tex.Code Crim. Proc. Ann. art. 62.01(6) (Vernon Supp.2004) ("sexually violent offense" includes conviction for indecency with a child); TEX.CODE CRIM. PROC. ANN. art. 62.06(a) (Vernon Supp.2004) (a person who commits a sexually violent offense is required to register every ninety days); and Tex.Code Crim. Proc. Ann. art. 62.10(a)(3) (Vernon Supp.2004) (failure to register as a sex offender when required every ninety days is a second-degree felony).
The State's offer of a deferred sentence (when combined with the dismissal of the indecency charges), however, avoided the registration requirements and, by requiring Gray to live with his sister in Dallas, provided a structured environment that offered the best chance of success with both resolving his criminal charges and ensuring consistency with his mental health treatment. After weighing all these options, Sawyer made the strategic decision to recommend Gray accept the State's offer of a deferred sentence. According to Sawyer's testimony at the habeas hearing, even had he reviewed all the relevant files and known at the time of Gray's guilty plea all that Sawyer now knows about Gray's involvement with the criminal justice system, Sawyer would still have recommended Gray accept the State's offer because Sawyer believed the negotiated plea agreement was the best possible outcome for Gray.
McDowell, now a district court judge, was also called as a witness. McDowell testified that, had he remained on Gray's case, he would have mounted an insanity defense on all the charges rather than recommending Gray accept the State's negotiated plea offer. McDowell based such a strategy on his review of Gray's psychiatric and police records, his discussions with Dr. Crittenden and Gray's grandfather, and his belief that, at the time the offenses were committed, Gray did not know right from wrong. Nonetheless, McDowell conceded he understood why Sawyer recommended Gray accept the State's plea offer, given Gray's mental health problems. McDowell also acknowledged that, just a few months after the arson took place, Dr. Crittenden had authored a report finding Gray sane at the time of the alleged offense.
Dr. David Bell, a psychologist appointed by the trial court to review Gray's case for the habeas corpus petition, testified about his October 2002 examinations of Gray. At that time, Dr. Bell found Gray incompetent.[5] In a later evaluation on March 27, 2003, Dr. Bell found Gray had regained competency to stand trial. Dr. Bell, however, disagreed with the report of Dr. Crittenden; Dr. Bell found Gray was not sane in 1996 at the time Gray allegedly committed the arson offense, even though Dr. Bell later testified "[t]here are no objective measures that could be used [in 2003] to go back and judge his [Gray's] mental status at the time of the offense, unfortunately." Dr. Bell also acknowledged that, like competency, sanity can come and go; "it's possible ... for a person to be sane for one offense and insane for another offense."
In his testimony before the habeas trial court, Dr. Crittenden disagreed with Dr. Bell's conclusion that Gray was insane and that there was no way to effectively judge Gray's sanity at the time of the alleged offense. Dr. Crittenden explained that *571 one could determine sanity by looking for evidence of delusional thoughts about the incident, by examining whether the defendant was reacting appropriately to stressors that typically trigger psychotic or abnormal behavior, and by determining whether the defendant is able to recall events regarding the alleged offense that demonstrated a factual awareness of the defendant's conduct, the rightness or wrongness of that conduct, and an understanding of behavioral consequences. Dr. Crittenden also reiterated his belief that Gray was sane at the time he allegedly committed the arson in 1996 based on Gray's descriptions of his interactions with the arresting officers and the recorded observations of Gray by the arresting officers.
Another former defense attorney also testified. Before becoming the current County Attorney for Lamar County, Mark Burtner previously represented Gray in several competency hearings. Burtner testified he had talked to Gray on several occasions when Gray knew right from wrong. Burtner informed the trial court that for Gray, both competency and sanity ebbed and flowed, depending on whether Gray took his medication and whether he had used any illegal street drugs. Most importantly, Burtner agreed there were times when Gray was both competent and sane.
In his appeal to this Court, Gray assumes that, had Sawyer mounted an insanity defense on the arson charge, any potential jury would necessarily have acquitted Gray because (1) a different jury had already acquitted Gray of the aggravated assault charge by reason of insanity, and (2) the State had previously dismissed two indecency charges on the belief that Gray was not sane at the time he allegedly committed those offenses. These facts, however, would not necessarily and inevitably lead a subsequent jury to conclude Gray was insane at the time of the alleged arson offense. First, the unequivocal testimony from both lay and expert witnesses was that Gray's sanity was something that was not constant: Gray had moments of lucidity as well as periods of mental incapacity. Second, there was specific evidence that Gray was, in fact, sane at the time he allegedly committed the arson. Dr. Crittenden testified he believed Gray was sane at the time of the alleged arson offense. And there was evidence that Gray's grandfather believed Gray was sane at that time.
The general rule in Texas is that the prosecution does not have to prove the defendant was sane at the time the defendant committed a criminal offense. Riley v. State, 830 S.W.2d 584, 584 (Tex.Crim. App.1992). Instead, the Texas Penal Code defines insanity as an affirmative defense, the burden of proof for which usually rests with the defendant. See Tex. Pen.Code Ann. §§ 2.04, 8.01 (Vernon 2003); Riley, 830 S.W.2d at 585. The burden of disproving insanity, however, shifts to the State if there is a prior adjudication for insanity by a court of competent jurisdiction. Arnold v. State, 873 S.W.2d 27, 30 (Tex.Crim.App. 1993). Thus, evidence of a prior judgment of insanity may provide "presumptive or prima facie evidence of insanity as to the time covered by the finding of the mental status of the party prior to the adjudication." Witty v. State, 69 Tex.Crim. 125, 153 S.W. 1146, 1146 (1913). The State may nonetheless rebut this presumption by proving the accused was sane at the time of the charged offense beyond a reasonable doubt. Id. at 1146-47.
If the case now before us were tried to a jury, Gray's insanity adjudication during the aggravated assault trial would necessitate the State proving, beyond a reasonable doubt, that Gray was sane at *572 the time he allegedly set fire to his grandfather's home. See Arnold, 873 S.W.2d at 30. This is because the prior jury had found Gray insane at the time he committed the aggravated assault, an event occurring before Gray's alleged commission of the arson. See id. (defendant having been adjudged insane before the offense is presumed insane at the time of the subsequent offense). There was evidence from several sources, including both an expert and Gray's grandfather, that would support the State's position Gray was sane at the time he allegedly set fire to the victim's home. A defense expert's opinion contradicts those claims. Regardless, given the evidence both supporting and controverting an insanity defense, the jury's decision is one that would ultimately rest on which witness(es) the jury found most believable and credible. Sawyer knew each of the lay witnesses, had reviewed the expert reports, had known Gray personally for many years, and had discussed the case in detail with both the State and Gray's former attorneys. Sawyer had been an attorney in the area for many years. He was in an excellent position to predict how receptive a potential jury might be to testimony from each of the prospective lay and expert witnesses. Given these considerations, and when weighed against the potential adverse outcome of five felony convictions (including three convictions for sex offenses), Sawyer's trial strategyof encouraging Gray to enter into a negotiated plea agreement for a deferred sentence, avoiding prosecution of three other sex offensesdid not fall below an objective standard of reasonableness and was within the wide range of reasonable professional assistance. Even McDowell, Gray's former defense attorney, conceded he understood why Sawyer pursued the chosen trial strategy.
Conclusion
Sawyer's representation of Gray did not fall below an objective standard of reasonableness. We overrule Gray's point of error and affirm the trial court's denial of habeas relief.
NOTES
[1]  According to witness testimony, the indictment charged Gray with setting fire to his grandfather's home. The record before us, however, does not contain a copy of the indictment.
[2]  The State did not file a similar motion to vacate the judgment in the arson case. The record before this Court does not suggest there was ever a trial on the arson charge.
[3]  We have jurisdiction over this case because Gray's habeas application concerns a pre-adjudication application for relief pursuant to Article 11.08 of the Texas Code of Criminal Procedure. See Donovan v. State, 68 S.W.3d 633, 638 (Tex.Crim.App.2002); Nix v. State, 65 S.W.3d 664, 669 (Tex.Crim.App.2001). Under Article 11.08 of the Texas Code of Criminal Procedure, a criminal defendant who has been indicted, but not yet convicted, may file an application for writ of habeas corpus that is returnable to the court in which the defendant stands indicted. Tex.Code Crim. Proc. Ann. art. 11.08 (Vernon 1977); see also Tex. Const. art. V, § 8 (district judges have power to issue writs as provided by statute); Solomon v. State, 39 S.W.3d 704, 706 (Tex. App.-Corpus Christi 2001, no pet.) (defendant placed on deferred or adjudicated community supervision may seek habeas relief by filing application returnable to trial court, appeal from which is to courts of appeals). The court of return distinguishes the pre-conviction writ from the post-conviction writ, the latter being made returnable to the Texas Court of Criminal Appeals after review by the trial court. Tex.Code Crim. Proc. Ann. art. 11.07, § 3(a) (Vernon Supp.2004). In this case, Gray's application was made while he was still on community supervision pursuant to a deferred sentence. Gray was not convicted of the offense, and his appeal concerns the denial of his pre-conviction writ of habeas corpus. Thus, we have jurisdiction to consider the issues raised in this case. Ex parte McCullough, 966 S.W.2d 529, 531-32 (Tex. Crim.App.1998); Solomon, 39 S.W.3d at 706.
[4]  At oral argument, Gray's appellate counsel contended only two indecency charges were ever filed against Gray, rather than three charges as suggested by Sawyer's trial testimony. Nothing in the record now before us contradicts Sawyer's testimony about there being five different charges filed against Gray. Gray's trial counsel on this application, who was also his counsel on appeal, did not challenge Sawyer on this issue before the trial court, and there is nothing in the record before us to support this contention by Gray's appellate counsel during oral argument.
[5]  A finding of incompetency is not the same as a finding the defendant was legally insane at the time of the alleged offense. See Manning v. State, 730 S.W.2d 744, 746-48 (Tex. Crim.App.1987) (explaining the difference between competency and sanity).
