Twenty-two years ago, Nicandro Galaviz was committed to a state mental health institution for a term of 60 years to life after he was found not guilty by reason of insanity of possession of methamphetamine and assault with a deadly weapon. In July 2017, Galaviz filed a petition for a writ of habeas corpus in this court, challenging the commitment order.
Galaviz previously filed a petition for a writ of habeas corpus in the trial court. After holding an evidentiary hearing, the court referred to the hearing as something "akin to a retrospective competency hearing" and denied Galaviz's petition on the ground Galaviz failed to prove he was incompetent at the time of trial.
The petition for a writ of habeas corpus filed in this court is granted and the matter is remanded with directions. The trial court erred in 1996 by failing to hold a hearing to determine Galaviz's competence at the time of trial. Reports filed by mental health professionals in the months preceding trial raised serious doubt about Galaviz's competence to stand trial. This error constitutes reversible error unless it is feasible to conduct a retrospective competency hearing to now determine whether Galaviz had been competent to stand trial in 1996. ( People v. Lightsey (2012) 54 Cal.4th 668, 674, 143 Cal.Rptr.3d 589, 279 P.3d 1072 ( Lightsey ).)
*495The prosecution failed to carry its burden of showing that conducting such a retrospective competency hearing is feasible based on a totality of the circumstances in this case. ( Lightsey, supra, 54 Cal.4th at p. 710, 143 Cal.Rptr.3d 589, 279 P.3d 1072.) In addition to the passage of time, those circumstances include the evidence before the trial court of Galaviz's history of mental illness and incompetency, and reports by mental health professionals who had examined Galaviz within months preceding trial. Those reports raised a serious doubt about Galaviz's mental competence. There was also the absence of any mental health professional's opinion in that same time period supporting a finding Galaviz was competent.
We remand to the trial court to strike the commitment order and permit Galaviz to withdraw his plea of not guilty by reason of insanity to the charges alleged in the second amended information.
BACKGROUND
I.
NOVEMBER 1994-APRIL 1995: GALAVIZ IS CHARGED WITH METHAMPHETAMINE POSSESSION; SIX MONTHS LATER THE TRIAL COURT FINDS GALAVIZ MENTALLY INCOMPETENT, SUSPENDS CRIMINAL PROCEEDINGS, AND COMMITS HIM TO PATTON STATE HOSPITAL FOR TREATMENT .
In November 1994, Galaviz was charged in an information with one count of possessing a controlled substance (methamphetamine) in violation of Health and Safety Code section 11377, subdivision (a). The information contained an allegation that he had been previously convicted of a serious or violent felony, as defined by Penal Code section 667, subdivisions (d) and (e)(1), for which he served a prior prison term within the meaning of Penal Code section 667.5, subdivision (b).
One month later, the trial court appointed Dr. Ernest Klatte and Dr. Robert White to examine Galaviz and set a hearing *832under Penal Code section 1368.1 In March 1995, after reading White's and Klatte's reports, hearing testimony from White and Klatte, and having considered arguments of counsel, the trial court found Galaviz mentally incompetent to stand trial; the court found he was unable to cooperate with and assist his counsel and was otherwise unable *496to participate in his trial. Galaviz was remanded to custody. The trial court ordered the Director of the Orange County Mental Health Department to evaluate Galaviz and make recommendations within 15 days.
In April 1995, the trial court suspended proceedings and committed Galaviz to Patton State Hospital pursuant to Penal Code section 1368 as mentally incompetent.
One month later, medical staff at Patton State Hospital reported that a court-appointed evaluator had concluded Galaviz was incompetent to stand trial "due to his being grossly psychotic, with his thought processes being dominated by delusions of receiving messages from outer space." The report noted that Galaviz had a history of two prior suicide attempts. In 1969, when he was 12 years old, he cut his wrists and in 1989, he jumped off a bridge because he believed he received messages telling him to do so.
II.
AUGUST-OCTOBER 1995: PATTON STATE HOSPITAL CERTIFIES GALAVIZ'S MENTAL COMPETENCY IS RESTORED; THE TRIAL COURT IS WARNED THAT GALAVIZ IS "MARGINALLY COMPETENT," HE MUST REMAIN ON PRESCRIBED MEDICATION, AND A SPEEDY TRIAL "IS IMPORTANT FOR MAINTENANCE OF TRIAL COMPETENCY ."
In August 1995, medical staff at Patton State Hospital prepared a report recommending that Galaviz be returned to court to stand trial because he had been restored to competency. The report cautioned, however, "it is critical that Mr. Galaviz continue taking the prescribed medications while in custody to ensure continued competency." In September 1995, the medical director of Patton State Hospital certified that Galaviz was then mentally competent. The certification cautioned: "Please authorize a hearing in this matter. A speedy trial is important for maintenance of trial competency."
In a report dated October 1995, Dr. Klatte stated: "Mr. Galaviz suffers from a very severe and chronic mental illness and in all probability will remain so for the remainder of his life and will never be able to function on his own in society without some form of protective care. He still manifests most of the same delusions he expressed when I examined him in January 1995 however he has improved enough to be able to carry on a reasonable conversation. Regards his ability to stand trial his condition is marginal. ... Certainly he is not able to fully understand all the ramifications of his case however I believe he is as able to work with his attorney as well as he is going to get and he is willing to do so. I would be inclined to find him able to work with his attorney. Regards his condition at the time of the incidents there seems no *497question what[ ]so[ ]ever that at the time of the incidents he was so mentally ill that he would have been completely unable to understand the consequences of his acts or of their wrongfulness. He is in need of long term hospitalization in the type program designed for [ Penal Code section] 1026 patients which is somewhat *833different from the [ Penal Code section] 1368 program." (Italics added.)
III.
NOVEMBER 1995-JULY 1996: CRIMINAL PROCEEDINGS RESUME; THE TRIAL COURT APPOINTS DR. KAUSHAL SHARMA TO FILE A REPORT ADDRESSING WHETHER GALAVIZ WAS LEGALLY INSANE AT THE TIME OF THE COMMISSION OF THE CHARGED OFFENSES;2 IN HIS REPORT, DR. SHARMA EXPRESSES CONCERN ABOUT GALAVIZ'S MENTAL COMPETENCE.
In November 1995, the trial court found Galaviz was no longer mentally incompetent within the meaning of Penal Code section 1368 and terminated competency proceedings. At a hearing later that month, the prosecutor, Galaviz's counsel, and Galaviz himself stipulated that he was competent to stand trial and waived a jury trial. Galaviz "personally entered a plea of not guilty by reason of insanity." Galaviz was advised that he could spend the rest of his life in a mental health facility. The trial court appointed, inter alia, Dr. Kaushal Sharma to determine whether Galaviz was legally insane at the time he committed the offenses, and to prepare reports for the court.
In a report dated January 29, 1996 and filed with the trial court on February 26, 1996, Dr. Sharma confirmed the scope of his appointment to render an opinion pursuant to Penal Code section 1026 regarding Galaviz's sanity at the time of the commission of the charged offenses. In that report, Dr. Sharma stated that after he interviewed Galaviz on January 27 and reviewed relevant records, he concluded: "There is substantial likelihood that in the incident which led to the filing of the criminal charge of assault, the defendant was legally insane." Dr. Sharma stated he did not have any data to render an opinion regarding Galaviz's mental state at the time of the drug charge or to render any opinion on sanity with "a high degree of medical certainty" because he had not been provided with copies of the relevant police reports.
*498In the data and reasoning portion of his report, Dr. Sharma also opined Galaviz "presented himself during the interview as a quite confused, delusional and bizarre individual. I had questions regarding the defendant's ability to provide meaningful information and to rationally cooperate with others. However, I was not asked to address the issue of the defendant's competency. I was asked to assess the issue of the defendant's mental state under [Penal Code] Section 1026." (Italics added.)
Our record does not show that either counsel or the trial court followed up on Dr. Sharma's statements regarding his concerns about Galaviz's competence to stand trial. Instead, on April 29, 1996, Dr. Sharma was appointed to provide a supplemental report addressing Galaviz's sanity at the time of the commission of the two charged offenses. Dr. Sharma reexamined Galaviz on May 31 and was provided the relevant police reports he had referred to in his January report.
Dr. Sharma's supplemental report, dated July 29, 1996 and filed July 30, 1996 (the record does not explain two-month delay between the reexamination of Galaviz and the preparation of the supplemental report), reiterated the scope of his appointment: "[T]o assess the defendant's sanity for the two incidents of criminal behavior."
*834Dr. Sharma further stated: "This report should be read in conjunction with my earlier report of 1/29/96."
In the supplemental report, Dr. Sharma reiterated that Galaviz was a "chronically mentally ill individual who was suffering from a major mental illness at the time of both alleged crimes." In the report, Dr. Sharma described Galaviz's thinking and responses during the interview as "bizarre." The report further stated: "He wanted help of this examiner to return to his home. However he describes his home to be in another galaxy named 'Zexxe.' ... He claims he was hunted by other 'people' on his galaxy and his 'father' sent him to earth to be 'replaced.' His home galaxy is in the '7th dimension' and 17 light years from earth. He believes he has to be killed to return back to his native galaxy. He asks this examiner to call Dr. Kevorkian of Michigan to help him die. These are just some examples of his peculiar thinking." It is not clear whether Dr. Sharma's summary of Galaviz's comments was based on his prior interview of Galaviz or his May 1996 interview of Galaviz, or both. Dr. Sharma concluded that Galaviz's delusions caused him to believe he was protecting himself in committing the assault offense and thus Galaviz was legally insane at the time of the commission of that offense, but that "[t]he drug charge was not directly related to his mental illness, even though he was profoundly mentally ill and without medication."
Our record does not show Dr. Sharma, or any other mental health professional, was thereafter asked to address Galaviz's competence to stand trial.
*499IV.
AUGUST-SEPTEMBER 1996: GALAVIZ PLEADS NOT GUILTY BY REASON OF INSANITY TO THE CHARGES ALLEGED IN THE SECOND AMENDED INFORMATION AND WAIVES JURY TRIAL; THE TRIAL COURT FINDS GALAVIZ NOT GUILTY OF BOTH OFFENSES BY REASON OF INSANITY AND COMMITS GALAVIZ TO A STATE MENTAL HEALTH INSTITUTION FOR A TERM OF 60 YEARS TO LIFE .
On August 9, 1996, the prosecutor filed a second amended information containing the original charge of possession of methamphetamine and one new count of assault with a deadly weapon in violation of Penal Code section 245, subdivision (a)(1).3 The second amended information alleged Galaviz personally used a dangerous or deadly weapon and personally inflicted great bodily injury in committing the assault and that the offense constituted a serious felony within the meaning of Penal Code section 1192.7, subdivision (c)(8) and (23). The second amended information alleged Galaviz had previously been convicted of three prior serious felonies within the meaning of Penal Code sections 667, subdivision (a)(1) and 1192.7, subdivision (c), and had suffered 10 prior convictions of serious and/or violent felonies within the meaning of Penal Code sections 667, subdivisions (d) and (e)(2) and 1170.12, subdivisions (b) and (c)(2).
That same day, the trial court proceeded with trial of the charged offenses. Although the trial court's August 9 minute order states the trial court had read and considered Dr. Sharma's and Dr. Klatte's reports, neither the court nor counsel *835raised a doubt about Galaviz's competency or asked whether he should be reevaluated before trial.
Before trial began, the trial court advised Galaviz of his constitutional right to a jury trial; Galaviz waived that right and requested to proceed with a bench trial. Galaviz acknowledged receipt of the newly-filed second amended information and the court accepted his plea of not guilty by reason of insanity to all charges and allegations. Based on preliminary hearing transcripts and all other evidence, the court found Galaviz guilty of both counts, found true the infliction of great bodily injury sentencing enhancement allegation pursuant to Penal Code section 12022.7, and found true two prior conviction allegations pursuant to Penal Code section 667, subdivision (a)(1), qualifying Galaviz for a maximum prison sentence of 60 years to life.
*500The court then determined whether Galaviz was not guilty of the charged offenses because he was legally insane at the time of their commission within the meaning of Penal Code section 1026. Galaviz was again advised of and subsequently waived his constitutional right to a jury trial on the legal insanity issue and agreed to proceed by way of a bench trial. The trial court found (1) Galaviz insane under Penal Code section 1026, and thus not guilty of either count by reason of insanity; (2) Galaviz had not fully recovered his sanity and was still a danger to himself and others; and (3) he was not to be released from custody until after notice and a hearing in the trial court to determine if and when his sanity had been restored. The court ordered Galaviz to be committed to an institution of the Department of Mental Health for a maximum term of 60 years to life and remanded Galaviz to custody.
In September 1996, the trial court issued an order committing Galaviz for treatment in a state institution due to insanity under Penal Code section 1026. The order reflected that Galaviz faced a maximum term of 60 years if sentenced to state prison. Galaviz did not appeal from the order of commitment or any prior proceedings.
Five days after his admission to Patton State Hospital, medical staff reported on September 24, 1996 that Galaviz had been a difficult patient. The report stated: "He responds to unseen stimuli much of the time. On 9/20/96 he was found laying on dayroom floor not responding to verbal stimuli. When staff assisted him up, he became combative striking out at staff. He has required restraints continuously since, because of his ongoing symptoms of psychosis, hostility, and unpredictability."
The record also contains periodic reports regarding Galaviz's mental state during his commitment since September 1996, and the court's consideration and denials of Galaviz's periodic applications for a determination of the restoration of his sanity.
V.
AUGUST 2014: GALAVIZ FILES A PETITION FOR A WRIT OF HABEAS CORPUS IN THE TRIAL COURT, WHICH IS DENIED IN 2017 .
Beginning in November 2010, Galaviz filed petitions for a writ of habeas corpus in the trial court, in the California Supreme Court, and in the United States District Court.
In August 2014, Galaviz filed his most recent petition for a writ of habeas corpus in the trial court. The trial court issued an order to show cause and for formal briefing. The trial court thereafter held an evidentiary hearing over *501several months in 2016 to examine evidence regarding Galaviz's mental competency at the time of the 1996 trial. At the hearing, Galaviz's trial counsel, Charles Spagnola, testified that he believed Galaviz had been competent at *836the time of trial. Spagnola cited specific statements by Galaviz which he thought showed Galaviz understood the nature of his criminal proceedings, and was able to assist counsel in a rational manner. Galaviz's expert psychiatrist, Dr. Nathan E. Lavid, testified about Galaviz's likely mental incompetence at the time of trial based on his review of the record and in particular the mental health professionals' reports filed with the trial court in the months preceding trial.
After the hearing, the trial court denied the petition.4 In its May 2017 statement of decision, the trial court explained: "There is little doubt [Galaviz] has suffered from significant mental illness for most of his life starting at around age 13. Such circumstances alone, however, do not mean [Galaviz] was mentally incompetent at the time of trial. This court was tasked with holding an evidentiary hearing on issues raised by [Galaviz] thereby providing [Galaviz] a fair opportunity to prove his incompetency at the time of trial. Something akin to a retrospective competency hearing." The court stated it had reviewed the parties' briefs and exhibits.
In the statement of decision, the court continued: "A defendant's counsel is in the best position to evaluate a client's comprehension of the proceedings and 'will often have the best-informed view of the defendant's ability to participate in his defense' especially on the day of trial versus any observations made by Doctor[ ]s months before trial or Dr. Lavid." The court observed that "[a]long with the doctors that found [Galaviz] competent, [Galaviz]'s counsel, Charles Spagnola, also believed that [Galaviz] was competent, understood what was going on and was able to work with him." The court noted Spagnola "was the only percipient witness to [Galaviz]'s competence at the time of trial." Spagnola had testified he would have notified the court if he thought Galaviz lacked capacity to comprehend any matter during the trial. The court found Spagnola's testimony relevant and credible. The court found there was no evidence indicating Galaviz was not taking his medications while in custody.
The court's statement of decision also found Dr. Lavid's testimony and the foundation for his opinions to be "riddled with assumptions, speculation, conjecture and unreasonable inferences. His testimony and conclusions were *502unreliable and lacked credibility on the issues he testified to." The court explained that a trial court's decision not to order a competency hearing is entitled to great deference because the trial court is in the best position to observe the defendant during trial, and the court is not required to suspend proceedings to conduct a second competency hearing unless it " 'is presented with a substantial change of circumstances or with new evidence casting a serious doubt on the validity of that finding.' "
The court found there had been no substantial change in Galaviz's circumstances or new evidence presented that would have cast doubt on the court's prior finding of mental competency under state and federal law. The court concluded the trial court had no reason prior to the beginning of trial to entertain a reasonable, bona fide doubt about Galaviz's mental competency to warrant the need to conduct a second competency hearing. The court also rejected Galaviz's argument he had received ineffective assistance of counsel because *837Spagnola failed to request a second mental competency hearing prior to trial and further failed to file a notice of appeal on Galaviz's behalf.
VI.
JULY 2017: THE INSTANT PETITION FOR A WRIT OF HABEAS CORPUS IS FILED; ADDITIONAL BRIEFING AT OUR REQUEST
In July 2017, Galaviz filed the instant petition for a writ of habeas corpus in this court which states Galaviz remains involuntarily committed at Napa State Hospital. Galaviz is represented by the Federal Public Defender pursuant to the United States District Court's appointment of the Federal Public Defender in case No. CV-11-01352-ODW(SS) (C.D. Cal.). The petition states that pursuant to section 2254(b)(1)(A) of title 28 of the United States Code, Galaviz's petition in this court is necessary for him to exhaust available state court remedies before the federal court may grant relief. According to the petition, the United States District Court has not formally stayed its proceedings on Galaviz's second amended petition for a writ of habeas corpus, but has ordered counsel to provide periodic updates on the state court proceedings.
In the instant petition, Galaviz argues his constitutional rights were violated because (1) he was mentally incompetent at the time of trial; (2) the trial court should have held a mental competency hearing before proceeding with the trial; and (3) he received ineffective assistance of counsel because his trial counsel failed to request a competency hearing, failed to present *503evidence of Galaviz's mental incompetence to the trial court, and did not file a notice of appeal on Galaviz's behalf.5
After the Attorney General filed an informal response, we issued an order to show cause. We ordered the Attorney General to file a formal written return to the petition and Galaviz to file a traverse thereafter, and specified that the parties' pleadings should address the following issues: "(1) Assuming arguendo petitioner's due process rights were violated by the failure to hold a competency hearing before his trial went forward on August 9, 1996, can that due process violation be cured by a retrospective competency hearing in this case? (See People v. Ary (2004) 118 Cal.App.4th 1016, 1028-1029, 13 Cal.Rptr.3d 482 [trial court's ability to conduct a retrospective competency hearing depends on 'whether the available evidence and witnesses are sufficient to permit [the court] to reach a "reasonable psychiatric judgment" of defendant's competence to stand trial']; People v. Kaplan (2007) 149 Cal.App.4th 372, 387-389, 57 Cal.Rptr.3d 143 ; People v. Ary (2011) 51 Cal.4th 510, 520, fn. 3, 120 Cal.Rptr.3d 431, 246 P.3d 322 [factors relevant to 'feasibility of a postjudgment hearing on a defendant's mental competence when tried' are (1) the passage of time, (2) the availability of contemporaneous medical evidence, including medical records and prior competency determinations, (3) any statements by the defendant in the trial record, and (4) the availability of individuals and trial witnesses, both experts and non-experts, who were in a position to interact with [the] defendant before and during trial]; People v. Lightsey (2012) 54 Cal.4th 668, 710-711, 143 Cal.Rptr.3d 589, 279 P.3d 1072 ['the focus of the feasibility determination must be on whether a retrospective competency hearing will provide defendant a fair opportunity to prove incompetence, not *838merely whether some evidence exists by which the trier of fact might reach a decision on the subject'].) [¶] (2) If the answer to the preceding question is yes, was the evidentiary hearing the superior court conducted pursuant to its order of July 27, 2015, a retrospective competency hearing? If so, did the hearing cure any violation of petitioner's due process rights?"
Both parties filed briefs that included responses to our questions. On our own motion, as set forth in a prior order, we have taken judicial notice of the trial court record in People v. Galaviz, superior court case No. 94CF2702.
*504DISCUSSION
I.
WE INDEPENDENTLY REVIEW THE RECORD IN OUR CONSIDERATION OF THE INSTANT PETITION FOR A WRIT OF HABEAS CORPUS .
"Where, as here, the superior court has denied habeas corpus relief after an evidentiary hearing (viz., the hearing held on the order to show cause ordered in response to petitioner's first habeas corpus petition) and a new petition for habeas corpus is thereafter presented to an appellate court based upon the transcript of the evidentiary proceedings conducted in the superior court, 'the appellate court is not bound by the factual determinations [made below] but, rather, independently evaluates the evidence and makes its own factual determinations.' ... [¶] While our review of the record is independent and 'we may reach a different conclusion on an independent examination of the evidence ... even where the evidence is conflicting' [citation], any factual determinations made below 'are entitled to great weight ... when supported by the record, particularly with respect to questions of or depending upon the credibility of witnesses the [superior court] heard and observed.' [Citations.] On the other hand, if 'our difference of opinion with the lower court ... is not based on the credibility of live testimony, such deference is inappropriate.' " ( In re Resendiz (2001) 25 Cal.4th 230, 249, 105 Cal.Rptr.2d 431, 19 P.3d 1171 ; see In re Sodersten (2007) 146 Cal.App.4th 1163, 1223, 53 Cal.Rptr.3d 572 [same].)
II.
THE TRIAL COURT ERRED BY FAILING TO HOLD A MENTAL COMPETENCY HEARING BEFORE CONDUCTING THE TRIAL IN 1996 BECAUSE SUBSTANTIAL EVIDENCE RAISED A REASONABLE OR BONA FIDE DOUBT CONCERNING GALAVIZ'S COMPETENCE AT THAT TIME .
A.
The United States Constitution and Penal Code Section 1367 Prohibit Trying or Convicting a Criminal Defendant While He or She Is Mentally Incompetent.
In Lightsey, supra, 54 Cal.4th at pages 690 to 691, 143 Cal.Rptr.3d 589, 279 P.3d 1072, the California Supreme Court explained federal and state standards of mental competence as follows:
"The United States Supreme Court has 'repeatedly and consistently recognized that "the criminal trial of an incompetent defendant violates due *505process." ' [Citation.] A defendant is deemed incompetent to stand trial if he lacks ' " 'sufficient present ability to consult with his lawyer with a reasonable degree of rational understanding ... [or] a rational as well as factual understanding of the proceedings against him.' " ' [Citations.] 'Even when a defendant is competent at the commencement of his trial, a trial court must always be alert to circumstances suggesting a change that would render the accused unable to meet the standards of competence to stand trial .' [Citation.] State constitutional authority is to the same effect. [Citation.] *839"The applicable state statutes essentially parallel the state and federal constitutional directives. [Penal Code s]ection 1367, subdivision (a) provides: "A person cannot be tried or adjudged to punishment while that person is mentally incompetent. A defendant is mentally incompetent for purposes of this chapter if, as a result of mental disorder or developmental disability, the defendant is unable to understand the nature of the criminal proceedings or to assist counsel in the conduct of a defense in a rational manner." (Italics added.)6
The Supreme Court in People v. Mickel (2016) 2 Cal.5th 181, 195, 211 Cal.Rptr.3d 601, 385 P.3d 796 held: "When the court is presented with 'substantial evidence of present mental incompetence,' however, the defendant is 'entitled to a [Penal Code] section 1368 hearing as a matter of right.' [Citation.] On review, our inquiry is focused not on the subjective opinion of the trial judge, but rather on whether there was substantial evidence raising a reasonable doubt concerning the defendant's competence to stand trial . [Citation.] Evidence may be substantial even where it is contested or presented by the defense. [Citation.] A trial court reversibly errs if it fails to hold a competency hearing when one is required under the substantial evidence test." (Italics added; see Lightsey, supra, 54 Cal.4th at p. 691, 143 Cal.Rptr.3d 589, 279 P.3d 1072 ["a trial court is obligated to conduct a full competency hearing if substantial evidence raises a reasonable doubt that a criminal defendant may be incompetent. This is true even if the evidence creating that doubt is presented by the defense or if the sum of the evidence is in conflict. The failure to conduct a hearing despite the presence of such substantial evidence is reversible error"]; People v. Young (2005) 34 Cal.4th 1149, 1216, 24 Cal.Rptr.3d 112, 105 P.3d 487 [if a defendant produces substantial evidence of incompetence, " 'due process requires that a full competence hearing be held as a matter of right' " and the trial court has " 'no direction to exercise' "]; People v. Kaplan (2007) 149 Cal.App.4th 372, 383, 57 Cal.Rptr.3d 143 [federal due process and state law require a trial court to suspend trial proceedings and conduct a mental competency hearing when the court is presented with evidence that " 'raises a reasonable or bona fide doubt concerning the defendant's competence to stand trial' "].)
*506"When a competency hearing has already been held and the defendant has been found to be competent to stand trial, 'a trial court is not required to conduct [another] competency hearing unless "it 'is presented with a substantial change of circumstances or with new evidence' " that gives rise to a "serious doubt" about the validity of the competency finding.' " ( People v. Kaplan, supra, 149 Cal.App.4th at pp. 383-384, 57 Cal.Rptr.3d 143.)
B.
In the Time Period After Galaviz Had Been Found to Have Been Restored to Competency in November 1995 and Before the August 1996 Trial, the Trial Court Was Presented with Evidence Raising a Serious Doubt About Whether Galaviz Was Competent, but Did Not Hold Another Required Competency Hearing.
In April 1995, six months after Galaviz was charged with possession of methamphetamine, the trial court found Galaviz mentally incompetent, suspended criminal proceedings, and ordered him committed to Patton State Hospital pursuant to Penal Code section 1368. Five months later, the *840medical director at Patton State Hospital certified that Galaviz was then mentally competent but urged the court to authorize a hearing in the matter as "[a] speedy trial [wa]s important for maintenance of trial competency." In October 1995, Dr. Klatte filed a report with the court stating that while Galaviz remained delusional, he was "as well as he is going to get," and that, regarding his ability to stand trial, "his condition is marginal."
In November 1995, the trial court found Galaviz no longer mentally incompetent and terminated competency proceedings. The prosecutor, Galaviz, and Galaviz's attorney stipulated to Galaviz's competency to stand trial, and Galaviz entered a plea of not guilty by reason of insanity.
Dr. Sharma, who had been appointed by the court to evaluate whether Galaviz was legally insane at the time of the commission of the charged offenses, informed the court in his January 29, 1996 report (filed in the trial court on February 26, 1996) that he "had questions regarding defendant's ability to provide meaningful information and to rationally cooperate with others." He acknowledged, however, that he had not been tasked to evaluate Galaviz's competency to stand trial.
Notwithstanding Galaviz's marginal competence in November 1995 and Dr. Sharma's subsequent comments expressing concern that Galaviz was not competent to stand trial, our record does not show that either Dr. Sharma or any other mental health professional was asked by counsel or the court to *507evaluate Galaviz's competence after November 1995 but before trial in August 1996. In April 1996, Dr. Sharma was appointed to prepare a supplemental report regarding Galaviz's legal insanity at the time of the commission of the two charged offenses. Since the time of the January 29, 1996 report, Dr. Sharma was provided the police reports he needed to render an opinion with high medical certainty regarding Galaviz's sanity and he reexamined Galaviz for that purpose in May 1996. Dr. Sharma's supplemental report expressly stated the limited scope of his appointment to render an opinion on legal insanity at the time the crimes were committed. He further stated that the supplemental report must be read in conjunction with his January 29, 1996 report. Dr. Sharma's supplemental report did not suggest Galaviz's mental health had improved in any way and again described Galaviz's delusions and "peculiar thinking."7 The supplemental report was consistent with, if not largely duplicative of, the January 29, 1996 report.
The reports before the trial court more than constituted the requisite evidence raising a serious doubt regarding Galaviz's competency to stand trial. Those reports included Dr. Sharma's statements in his January 29, 1996 report questioning Galaviz's mental competence, Dr. Klatte's report a few months earlier stating that Galaviz was only marginally competent, the Patton State Hospital medical director's statement urging the trial court to conduct a speedy trial to ensure Galaviz maintained his competency, and Dr. Sharma's supplemental July 1996 report reiterating *841Galaviz's delusions. These reports triggered the trial court's obligation to hold another competency hearing. "[O]nce substantial evidence in the form of a psychiatric opinion of incompetence was presented, the court was required to hold a competency hearing. ... 'Once such substantial evidence appears, a doubt as to the sanity of the accused exists, no matter how persuasive other evidence-testimony of prosecution witnesses or the court's own observations of the accused-may be to the contrary.' " ( People v. Stankewitz (1982) 32 Cal.3d 80, 93, 184 Cal.Rptr. 611, 648 P.2d 578, italics omitted; see People v. Lewis and Oliver (2006) 39 Cal.4th 970, 1047, 47 Cal.Rptr.3d 467, 140 P.3d 775.)
The trial court therefore erred by failing to conduct a subsequent competency hearing, which constitutes reversible error unless it is feasible for that error to be cured by conducting a retrospective competency hearing. For the *508reasons we will explain, the prosecution failed to carry its burden of showing such a hearing was feasible in this case.
III.
BASED ON THE TOTALITY OF THE CIRCUMSTANCES, A RETROSPECTIVE COMPETENCY HEARING IS NOT FEASIBLE IN THIS CASE TO CURE THE TRIAL COURT'S OTHERWISE REVERSIBLE ERROR IN FAILING TO HOLD A SUBSEQUENT COMPETENCY HEARING BEFORE TRIAL .
A.
Retrospective Competency Hearings Generally
In People v. Kaplan, supra, 149 Cal.App.4th at pages 387 to 389, 57 Cal.Rptr.3d 143, a panel of this court reviewed the history of retrospective competency hearings as follows:
"The California Supreme Court in People v. Young, supra, 34 Cal.4th 1149, 1216-1217 [24 Cal.Rptr.3d 112, 105 P.3d 487], stated, 'where the substantial evidence test is satisfied and a full competence hearing is required but the trial court fails to hold one, the judgment must be reversed. [Citation.]' In a footnote, and without approving or disapproving the case, the Supreme Court cited People v. Ary (2004) 118 Cal.App.4th 1016, 1025-1029 [13 Cal.Rptr.3d 482]... for the proposition that 'in some circumstances, a remand may be appropriate and reversal for such error might be unnecessary.' ( People v. Young, supra, 34 Cal.4th at p. 1217, fn. 16 [24 Cal.Rptr.3d 112, 105 P.3d 487].)
"In People v. Ary, supra, 118 Cal.App.4th at pages 1027-1028 [13 Cal.Rptr.3d 482], the appellate court concluded that retrospective competency hearings might be constitutionally permissible in specific cases. (See Drope v. Missouri (1975) 420 U.S. 162, 183 [95 S.Ct. 896, 43 L.Ed.2d 103] [accepting possibility of constitutionally adequate postappeal evaluation of defendant's pretrial competence]; People v. Superior Court (Marks ) (1991) 1 Cal.4th 56, 67 [2 Cal.Rptr.2d 389, 820 P.2d 613] [citing reference in Drope v. Missouri about possibility of constitutionally adequate postappeal competency evaluation]; People v. Castro (2000) 78 Cal.App.4th 1402, 1419 [93 Cal.Rptr.2d 770] ['the California Supreme Court has adopted the view that the United States Supreme Court "accept[s] the possibility of a constitutionally adequate posttrial or even postappeal evaluation of the defendant's pretrial competence" '].)
"In People v. Ary, supra, 118 Cal.App.4th at page 1028 [13 Cal.Rptr.3d 482], the court stated, 'it is the rare case in which a meaningful retrospective competency determination will be possible. The inherent difficulty of such a determination, of *509course, is that there will seldom be sufficient evidence of a defendant's mental state at the time of trial on which to base a *842subsequent competency determination. [Citation.] This is because a trial court's initial failure to hold a timely competency hearing is almost always rooted in a fundamental inattentiveness to the defendant's mental condition. The record in such cases will, therefore, seldom contain useful contemporaneous information regarding a defendant's mental state at the time of trial and his ability, at that time, to understand the nature of the proceedings and assist in his defense. For this reason, courts have declined to permit a retrospective competency hearing after reversing a conviction because of the failure to hold such a hearing originally.' (See Pate v. Robinson (1966) 383 U.S. 375, 387 [86 S.Ct. 836, 15 L.Ed.2d 815] [noting 'the difficulty of retrospectively determining an accused's competence to stand trial'].)
"The court in People v. Ary, supra, 118 Cal.App.4th at page 1029 [13 Cal.Rptr.3d 482], concluded, '[i]t is only because of the highly unusual nature of this case that we remand this matter to the trial court for a determination as to whether such a hearing is possible. During pretrial hearings held in 1999 and 2000 on defendant's competence to waive his Miranda [v. Arizona (1966) 384 U.S. 436, 86 S.Ct. 1602, 16 L.Ed.2d 694] rights and the voluntariness of his confession, extensive expert testimony and evidence was proffered regarding defendant's mental retardation and his ability to function in the legal arena. Much of this information would be relevant in a competency hearing. Although we could remand this matter and order a competency hearing to be held, we instead take the additional step of directing the trial court to determine whether the available evidence and witnesses are sufficient to permit it to reach a "reasonable psychiatric judgment" of defendant's competence to stand trial. [Citation.] Pertinent to, but not necessarily determinative of, this issue is whether the experts who examined defendant in 1999 and 2000 are available and able to render an opinion about defendant's competence to stand trial in 1999 and 2000. On remand, therefore, the People will have the burden of establishing that a retrospective competency hearing can be held.' "
In Lightsey, supra, 54 Cal.4th at page 706, 143 Cal.Rptr.3d 589, 279 P.3d 1072, the California Supreme Court concluded that in the circumstances of the case, it was appropriate and permissible for the court to "order[ ] a limited reversal and remand for the trial court to determine whether a retrospective competency hearing is feasible and, if so, to conduct such a hearing."
*510B.
Unlike Kaplan and Lightsey, the Trial Court Has Already Conducted an Evidentiary Hearing "Akin to a Retrospective Competency Hearing" and the Record from that Hearing Shows that Under the Circumstances of this Case, a Retrospective Competency Hearing Is Not Feasible.
In Lightsey, supra, 54 Cal.4th at page 710, 143 Cal.Rptr.3d 589, 279 P.3d 1072, the California Supreme Court gave the trial court the following guidance in determining whether a retrospective competency hearing would be feasible: "Before conducting the retrospective competency hearing, the trial court must determine whether such a hearing will be feasible. What we stated in People v. Ary, supra, 51 Cal.4th 510 [120 Cal.Rptr.3d 431, 246 P.3d 322], regarding a retrospective competency hearing to remedy Pate [ v. Robinson ] error is equally applicable here: 'Feasibility in this context means the availability of sufficient evidence to reliably determine the defendant's mental competence when tried earlier. In the words of the Oklahoma Court of Criminal Appeals: "[T]he defendant will be placed in a position comparable *843to the one he would have been placed in prior to the original trial." ' [Citation.] In assessing whether a retrospective competency hearing is feasible, the trial court should consider ' " ' "(1) [t]he passage of time, (2) the availability of contemporaneous medical evidence, including medical records and prior competency determinations, (3) any statements by the defendant in the trial record, and (4) the availability of individuals and trial witnesses, both experts and non-experts, who were in a position to interact with [the] defendant before and during trial" ' " ' [citation], as well as any other facts the court deems relevant. We stress that the focus of the feasibility determination must be on whether a retrospective competency hearing will provide defendant a fair opportunity to prove incompetence, not merely whether some evidence exists by which the trier of fact might reach a decision on the subject."
In Lightsey, supra, 54 Cal.4th at pages 710 to 711, 143 Cal.Rptr.3d 589, 279 P.3d 1072, the Supreme Court further stated, referring to the facts of the case before it: "In making its feasibility determination, the court must consider the fairness of requiring defendant, who has already established a reversible statutory violation, to prove his incompetence to stand trial in 1994 with the now 18-year-old evidence of his prior mental condition still available to him today. ... Because of the inherent difficulties in attempting to look back to the defendant's past mental state [citation], the burden of persuasion will be on the People to convince the trial court by a preponderance of the evidence that a retrospective competency hearing is feasible in this case ." (Italics added.)
Here, unlike the circumstances of Kaplan and Lightsey , we do not need to remand to the trial court to conduct a hearing on whether a retrospective *511competency hearing would be feasible. The trial court already conducted an evidentiary hearing-which it stated was "akin to a retrospective competency hearing"-in resolving the petition for a writ of habeas corpus Galaviz filed in the trial court, although the court did not make a finding on the question of feasibility.8 The record of the habeas corpus proceedings in the trial court is part of the appellate record. Significantly, no party suggests there is additional evidence relevant to determining whether a retrospective evidentiary hearing would be feasible in this case that is not already in our record. At oral argument on the petition, counsel for both parties agreed this court could review that record and determine feasibility in the first instance. Therefore, we independently review whether such a hearing would be feasible.
After reviewing the record, we conclude a retrospective competency hearing is not feasible in this case. Applying the feasibility factors identified by the court in Lightsey, supra, 54 Cal.4th at page 710, 143 Cal.Rptr.3d 589, 279 P.3d 1072, we have considered the lengthy period of time (22 years) that has passed since Galaviz's August 1996 trial. As we have discussed, there was evidence raising a serious doubt about Galaviz's mental competence to stand trial, including evidence that seven months before trial, Dr. Sharma specifically *844raised concerns about it. His concerns were never followed up on or otherwise addressed before trial. No medical evidence supporting a finding of Galaviz's competence at or near trial was provided. (Dr. Lavid testified at the evidentiary hearing on Galaviz's petition for a writ of habeas corpus in the trial court that, based on his review of Galaviz's records, he believed Galaviz was most likely incompetent at the time of trial. The trial court, however, found Dr. Lavid's testimony lacked credibility. In any event, Dr. Lavid's medical opinion did not constitute contemporaneous medical evidence.) As to the existence of any statements by Galaviz at or near trial in the record, there are none. The only witness who interacted with Galaviz before and during trial was his attorney, Spagnola, who testified at the evidentiary hearing that he believed Galaviz was competent during the trial.
The prosecution had the burden of persuasion to show "a retrospective competency hearing would provide [Galaviz] a fair opportunity to prove incompetence" as opposed to showing "merely whether some evidence exists by which the trier of fact might reach a decision on the subject." ( Lightsey, supra, 54 Cal.4th at p. 710, 143 Cal.Rptr.3d 589, 279 P.3d 1072.) Viewing the totality of the circumstances, including the above-analyzed feasibility factors combined with Galaviz's *512history of severe mental illness and mental incompetence, we conclude the prosecution failed to carry its burden to show a retrospective hearing was feasible.
DISPOSITION
The petition for a writ of habeas corpus is granted. We remand to the trial court to strike the commitment order and permit Galaviz to withdraw his plea of not guilty by reason of insanity to the charges alleged in the second amended information.
WE CONCUR:
O'LEARY, P. J.
IKOLA, J.
Penal Code section 1368, subdivision (c) provides, in part: "[W]hen an order for a hearing into the present mental competence of the defendant has been issued, all proceedings in the criminal prosecution shall be suspended until the question of the present mental competence of the defendant has been determined."
At some point in time not specified in our record, Galaviz was also charged with one count of committing an assault with a deadly weapon on October 17, 1994 in violation of Penal Code section 245, subdivision (a)(1). Both charged offenses (methamphetamine possession and assault with a deadly weapon) are alleged in the second amended information filed in August 1996 and described, post .
A Patton State Hospital report dated October 8, 1996 described the circumstances underlying the assault count. The report stated that, according to police reports, on October 17, 1994, while already a jail inmate, Galaviz repeatedly struck his cellmate on the forehead with a cane and thereafter continued to beat him. Galaviz later explained his conduct, which was unprovoked. He stated his cellmate, among others, wanted to kill him and that Galaviz wanted to return to his " 'father in the galaxy of Zexxe,' by killing himself."
In its statement of decision, the trial court stated that its denial of the petition for a writ of habeas corpus was not on the ground the petition was repetitive or because it found the instant petition was brought after substantial delay without justification. The court stated that "[e]ven if the court were to find there was a substantial delay, the court would find that good cause existed to justify the delay."
We conclude the trial court's error in failing to hold a competency hearing is reversible and uncurable because a retrospective mental competency hearing is not feasible; we therefore do not need to address Galaviz's contention he received ineffective assistance of counsel.
After the opinion in Lightsey was filed, Penal Code section 1367, subdivision (a) was revised. The language added to the statute does not affect our analysis.
At oral argument, the Attorney General argued that the absence of any reference to Galaviz's competence in the supplemental report suggests Dr. Sharma no longer questioned Galaviz's competence to stand trial. The record does not support such an inference. Dr. Sharma expressly stated the limited scope of his appointment to evaluate Galaviz's legal insanity at the time of the commission of the charged offenses only. Nothing in the supplemental report suggests that Galaviz's mental health had improved or that Dr. Sharma's concerns about whether Galaviz was competent to stand trial had been alleviated. Instead, the supplemental report again confirmed the severity and chronic nature of Galaviz's mental illness and described Galaviz's bizarre delusions.
The Attorney General argues that a feasibility determination by the trial court should be implied. There are at least three flaws in this argument. First, we cannot assume the trial court analyzed the feasibility issue without any record that it did so. Second, a feasibility determination is not, as the Attorney General argues, "subsumed" in the question of incompetency. Third, instead of placing the burden of persuasion on the People to show feasibility, the court placed the burden on Galaviz to show he was incompetent at the time of trial. Thus, the first step in the analysis, namely, feasibility, was skipped and the burdens were shifted.