Opinion
LIU, J.The statutory scheme for extending the involuntary commitment of a mentally disordered offender (hereafter sometimes MDO) beyond termination of parole requires the trial court to “advise the person of his or her right to be represented by an attorney and of the right to a jury trial” and to hold a jury trial “unless waived by both the person and the district attorney.” (Pen. Code, § 2972, subd. (a) (hereafter section 2972(a)).) We granted review to decide whether a trial court must advise the defendant personally of his or her right to a jury trial and whether the trial court must obtain a personal waiver of that right from the defendant before holding a bench trial to extend the defendant’s commitment as a mentally disordered offender.
We conclude that the trial court must advise the MDO defendant personally of his or her right to a jury trial and, before holding a bench trial, must obtain a personal waiver of that right from the defendant unless the court finds substantial evidence — that is, evidence sufficient to raise a reasonable doubt — that the defendant lacks the capacity to make a knowing and voluntary waiver, in which case defense counsel controls the waiver decision.
Here, the trial court did not advise defendant Bruce Lee Blackburn of his right to a jury trial, did not obtain Blackburn’s personal waiver of that right, *1117and did not find that there was substantial evidence that Blackburn lacked the capacity to make a knowing and voluntary waiver. Thus, the trial court erred in conducting a bench trial that extended Blackburn’s commitment. When a trial court errs in completely denying an MDO defendant his or her statutory right to a jury trial, the error constitutes a miscarriage of justice and automatically requires reversal. In Blackburn’s case, however, because the trial court and the parties, in reliance on prior law, likely did not contemplate the need to make a record in conformity with today’s holding, we reverse the Court of Appeal’s judgment upholding the extension order and remand the case to that court with directions to remand to the trial court for a proper determination of whether Blackburn personally made a knowing and voluntary waiver of his right to a jury trial or whether, at the time of counsel’s waiver, there was substantial evidence that Blackburn lacked the capacity to make a knowing and voluntary waiver.
I.
In 2004, Blackburn was convicted of first degree burglary and forcible false imprisonment. Blackburn had entered the home of an 85-y ear-old woman at night, and she awoke to find him naked and lying on top of her. He pinned her down with his legs and restrained her by pulling her hair, but the woman managed to escape. When the police arrived, they found Blackburn sitting naked on the toilet, eating pork chops, and speaking incoherently. In December 2006, he was declared a mentally disordered offender and committed to Atascadero State Hospital as a condition of parole. His commitment was extended in 2009 and again in 2010.
In April 2011, the Santa Clara County District Attorney filed a third petition to extend Blackburn’s commitment. No record was kept of the relevant pretrial proceedings. However, according to a settled statement requested by the Court of Appeal, defense counsel notified the trial court that Blackburn opposed an extension of his commitment and wanted a trial. Defense counsel requested a bench trial, and the prosecutor agreed.
At trial, Dr. Kevin Perry testified that Blackburn suffered from “schizoaffective disorder, bipolar type” and was not in remission. He noted that Blackburn was paranoid, believed that other patients were stealing from him, believed that he is the Son of God, and suggested that he could communicate over long distances without technology. Blackburn appeared to understand the purpose of the evaluation but jumped from topic to topic without logical connections. Blackburn generally continued to take his medication after a court order compelling him to take it had expired and realized that it was helpful to attend group therapy. When asked about the basis for his conclusion that Blackburn presented a risk to the community, Dr. Perry responded *1118that he showed “active symptoms of the same disorder that was previously adjudicated as a causal or an aggravating factor in a violent crime.” Dr. Perry also explained that before Blackburn could be released, he needed to develop a discharge plan to help identify and manage his symptoms, and that Blackburn had not completed a viable plan. Blackburn did not testify and did not attempt to undermine Dr. Perry’s testimony. The court sustained the petition and extended Blackburn’s commitment.
Blackburn appealed, arguing that the trial court prejudicially erred by failing to advise him of the right to a jury trial and by conducting a bench trial without first obtaining his personal waiver of that right. Although Blackburn’s commitment had expired, the Court of Appeal exercised its discretion to address his claims because the issues are recurring and would otherwise evade review. The court held that the language of section 2972(a) “imposes a mandatory duty” on the trial court to advise the defendant and “reflects a legislative intent to judicially ensure that ‘the person’ knows that he or she has the right to a jury trial.” (All subsequent statutory references are to the Penal Code unless otherwise indicated.) The Court of Appeal found that the trial court had not advised Blackburn of his right to a jury trial, but held that the omission was harmless because it was not reasonably probable Blackburn would have obtained a more favorable result had he been advised of his right to a jury trial.
The Court of Appeal further held that section 2972(a) does not require personal waiver of the right to a jury trial. However, the court said, because the purpose of the jury trial advisement is “to inform the MDO of the right to a jury trial so that he or she can decide whether to waive it,” section 2972(a)’s waiver requirement cannot reasonably be read to give counsel “exclusive control” over the decision whether to waive a jury trial. Instead, the court explained, counsel may waive a jury trial only “at the MDO’s direction or with his or her knowledge and consent,” or “over an MDO’s objection when the circumstances cast reasonable doubt on the MDO’s mental capacity to determine what is in his or her best interests.” The court found that because counsel had likely informed Blackburn of his rights and there was no indication he disagreed with counsel’s decision to waive a jury trial, Blackburn could not meet his burden to show error. Further, even if Blackburn could establish error, he could not establish prejudice in light of Dr. Perry’s uncontested adverse testimony.
Finally, the Court of Appeal observed: “The best assurance of compliance is a record that reflects it.” Accordingly, the court created a prospective rule for lower courts requiring that, when a trial court conducts a bench trial to extend an MDO defendant’s commitment without receiving a personal waiver *1119from the defendant, the record must reflect the facts establishing the defendant’s awareness of the right to a jury and the validity of counsel’s waiver. Alternatively, the record must contain an advisement and waiver form signed by the defendant.
We granted review in this case and in the companion case of People v. Tran (2015) 61 Cal.4th 1160 [191 Cal.Rptr.3d 251, 354 P.3d 148], which presents similar issues in the context of commitment extension proceedings for persons found not guilty of a criminal offense by reason of insanity (§ 1026.5, subd. (b)).
II.
“[C]ivil commitment for any purpose constitutes a significant deprivation of liberty . . . .” (Addington v. Texas (1979) 441 U.S. 418, 425 [60 L.Ed.2d 323, 99 S.Ct. 1804] (Addington); see Foucha v. Louisiana (1992) 504 U.S. 71, 80 [118 L.Ed.2d 437, 112 S.Ct. 1780]; Humphrey v. Cady (1972) 405 U.S. 504, 509 [31 L.Ed.2d 394, 92 S.Ct. 1048] [commitment to a mental hospital produces “a massive curtailment of liberty”]; People v. Barrett (2012) 54 Cal.4th 1081, 1098 [144 Cal.Rptr.3d 661, 281 P.3d 753] (Barrett) [“civil commitment for any purpose can affect liberty and other vital interests”].) “Moreover, it is indisputable that involuntary commitment, to a mental hospital after a finding of probable dangerousness to self or others can engender adverse social consequences to the individual. Whether we label this phenomena ‘stigma’ or choose to call it something else is less important than that we recognize that it can occur and that it can have a very significant impact on the individual.” (Addington, at pp. 425-426; see Vitek v. Jones (1980) 445 U.S. 480, 492 [63 L.Ed.2d 552, 100 S.Ct. 1254] [“The loss of liberty produced by an involuntary commitment is more than a loss of freedom from confinement.”]; Conservatorship of Roulet (1979) 23 Cal.3d 219, 223 [152 Cal.Rptr. 425, 590 P.2d 1] [involuntary “confinement in a mental hospital . . . deprived appellant of freedom in its most basic aspects and placed a lasting stigma on her reputation”].)
At the same time, a civil commitment proceeding is not a criminal proceeding, even though it is often collateral to a criminal trial. We have recognized that some constitutional protections available in the criminal context apply as a matter of due process to defendants in certain commitment proceedings. (See People v. Allen (2008) 44 Cal.4th 843, 870 [80 Cal.Rptr.3d 183, 187 P.3d 1018] (Allen) [defendant in sexually violent predator (SYP) proceeding has due process right to testify over the objection of counsel]; People v. Burnick (1975) 14 Cal.3d 306, 322-323 [121 Cal.Rptr. 488, 535 P.2d 352] (Burnick) [requirement of proof beyond a reasonable doubt]; People v. Feagley (1975) 14 Cal.3d 338 [121 Cal.Rptr. 509, 535 P.2d 373] (Feagley) *1120[jury verdict must be unanimous].) But we have also found various constitutional protections inapplicable. (See People v. McKee (2010) 47 Cal.4th 1172, 1193-1195 [104 Cal.Rptr.3d 427, 223 P.3d 566] (McKee) [SVP commitment statute is not punitive and thus does not violate ex post facto clause]; Conservatorship of Ben C. (2007) 40 Cal.4th 529, 539 [53 Cal.Rptr.3d 856, 150 P.3d 738] [due process does not require independent appellate review of whether there is any arguable issue on appeal from the imposition of a conservatorship]; see also Kansas v. Hendricks (1997) 521 U.S. 346, 369 [138 L.Ed.2d 501, 117 S.Ct. 2072] [initiation of civil commitment proceeding “does not constitute a second prosecution” for double jeopardy purposes].)
In In re Gary W. (1971) 5 Cal.3d 296 [96 Cal.Rptr. 1, 486 P.2d 1201], a case involving the extension of confinement of a minor ward of the California Youth Authority, we observed that “[t]he right to a jury trial in an action which may lead to . . . involuntary confinement” is “fundamental” (id. at p. 306) and emphasized that when individuals are “threatened with involuntary confinement, [the right to a jury trial is] equally important whether the threat of confinement originates in a civil action or a criminal prosecution” (id. at p. 307). However, we have not previously addressed whether a mentally disordered offender has a constitutional right to a jury trial in a commitment extension proceeding, and we do not address that question here. In the wake of decisions of this court finding various due process guarantees applicable to certain commitment proceedings (see In re Moye (1978) 22 Cal.3d 457, 467 [149 Cal.Rptr. 491, 584 P.2d 1097]; Burnick, supra, 14 Cal.3d at pp. 324-325; Feagley, supra, 14 Cal.3d at p. 350), the Legislature enacted the MDO statute in 1985, setting forth procedural protections generally available only in the criminal context, including the right to a jury trial. (Stats. 1985, ch. 1418, § 1, pp. 5009-5010.) The Legislature later moved these protections to sections 2966 and 2972. (Stats. 1986, ch. 858, §§ 4, 7, pp. 2953-2954, 2955-2956.) The MDO commitment scheme has thus been described as “something of a hybrid, a civil hearing with criminal procedural protections.” (People v. Montoya (2001) 86 Cal.App.4th 825, 830 [103 Cal.Rptr.2d 579] (Montoya); see People v. Harrison (2013) 57 Cal.4th 1211, 1229 [164 Cal.Rptr.3d 167, 312 P.3d 88] [“Although a civil commitment proceeding is not criminal in nature, it does afford the prisoner many of the protections of a criminal defendant. . . .”].)
In People v. Masterson (1994) 8 Cal.4th 965 [35 Cal.Rptr.2d 679, 884 P.2d 136] (Masterson), we held that counsel can waive the right to a jury trial, “even over the defendant’s objection,” in a proceeding under section 1368 to determine a defendant’s competence to stand trial. (Masterson, at p. 974.) Our reasoning in Masterson provides guidance on the proper analytical approach to the case before us. There we began by citing the general proposition that “ ‘counsel is captain of the ship’ ” and has authority to bind the client in procedural aspects of litigation. (Id. at p. 969.) But we did not *1121rely on that general proposition to resolve the case, nor did we “decide whether . . . there are some statutory rights that counsel may not waive.” (Id. at p. 970.) “Rather,” we said, “we base our conclusion upon an examination of the nature of competency proceedings as well as the jury trial right at issue.” (Id. at pp. 970-971.)
In addition to noting that the right to a jury trial in a competency proceeding “is statutory, not constitutional,” we observed in Masterson that the applicable statutes neither require an advisement nor address the issue of waiver. (Masterson, supra, 8 Cal.4th at p. 969, citing §§ 1368, 1369.) We explained: “The sole purpose of a competency proceeding is to determine the defendant’s present mental competence, i.e., whether the defendant is able to understand the nature of the criminal proceedings and to assist counsel in a rational manner. (Pen. Code, § 1367; [citations].) Because of this, the defendant necessarily plays a lesser personal role in the proceeding than in a trial of guilt. How can a person whose competence is in doubt make basic decisions regarding the conduct of a proceeding to determine that very question?” (Masterson, at p. 971.) Crucial to our reasoning was the fact that “ ‘[a] section 1368 hearing is held only after there has been a prima facie showing of mental incompetence.’ ” (Id. at p. 972; see id. at p. 974 [“the court here declared a doubt as to defendant’s competence”]; former § 1367.1, subd. (a), added by Stats. 1992, ch. 722, p. 3354 and repealed by Stats. 2014, ch’. 759 [judicial finding based on “the defendant’s behavior or other evidence” that “there is reason to believe that the defendant is mentally disordered and as a result may be incompetent to stand trial . . .” is a prerequisite to a § 1368 competency hearing].) “ ‘Of necessity, therefore, defendant’s attorney must play a greater role in making fundamental choices for him, and cannot be expected to seek approval of strategic decisions made in the course of obtaining and presenting proof of incompetence.’ ” (Masterson, at p. 972.)
Thus, Masterson focused on the particular statutory scheme and nature of the “ ‘special proceeding’ ” at issue. (Masterson, supra, 8 Cal.4th at p. 969.) The statutes at issue in Masterson make clear that there has already been a prima facie showing of incompetence by the time a defendant faces a competency hearing, and thus it is sensible that counsel’s decisions may trump the defendant’s. In resolving the present case, we focus our attention on the statutory scheme for extending an MDO defendant’s commitment and on the nature and purpose of those proceedings.
III.
Unlike the competency hearing statutes considered in Masterson, the statutory scheme that governs MDO commitment proceedings expressly *1122provides for advisement and waiver of the right to a jury trial. We briefly describe the scheme and then focus on its specific provisions addressing the right to a jury trial.
A.
The Mentally Disordered Offender Act “provides that individuals convicted of certain enumerated violent offenses caused or aggravated by a severe mental disorder, and who pose a substantial threat of harm to others, may be required to receive mental health treatment as a condition of parole.” (Lopez v. Superior Court (2010) 50 Cal.4th 1055, 1057 [116 Cal.Rptr.3d 530, 239 P.3d 1228] (Lopez); see McKee, supra, 47 Cal.4th at pp. 1201-1202.) An MDO commitment is neither penal nor punitive; it has “the dual purpose of protecting the public while treating severely mentally ill offenders.” (Lopez, at p. 1061.) “Any commitment under this article places an affirmative obligation on the treatment facility to provide treatment for the underlying causes of the person’s mental disorder.” (§ 2972, subd. (f).)
A mentally disordered offender may be involuntarily committed at three different stages: as a condition of parole (§ 2962), in conjunction with the extension of parole (§ 2966, subd. (c)), and following release from parole (§§ 2970, 2972). (See Lopez, supra, 50 Cal.4th at pp. 1061-1062.) At issue in this case is the third stage.
The district attorney may seek continued treatment and commitment of a mentally disordered offender beyond the termination of parole by filing a petition in the superior court alleging that the individual suffers from a severe mental disorder that is not in remission and that he or she poses a substantial risk of harm to others. (§ 2970.) Section 2972(a) sets forth the procedures applicable to a hearing on such a petition. Its full text, with italics identifying the two sentences central to this dispute, reads: “The court shall conduct a hearing on the petition under Section 2970 for continued treatment. The court shall advise the person of his or her right to be represented by an attorney and of the right to a jury trial. The attorney for the person shall be given a copy of the petition, and any supporting documents. The hearing shall be a civil hearing, however, in order to reduce costs the rules of criminal discovery, as well as civil discovery, shall be applicable. [¶] The standard of proof under this section shall be proof beyond a reasonable doubt, and if the trial is by jury, the jury shall be unanimous in its verdict. The trial shall be by jury unless waived by both the person and the district attorney. The trial shall commence no later than 30 calendar days prior to the time the person would otherwise have been released, unless the time is waived by the person or unless good cause is shown.” (§ 2972(a), italics added.) The same protections apply to a hearing in the superior court on a petition challenging an MDO *1123commitment at either of the other two phases, except that a hearing must be conducted “within 60 calendar days after the petition is filed, unless either time is waived by the petitioner or his or her counsel, or good cause is shown.” (§ 2966, subd. (b) (hereafter section 2966(b)).)
B.
We review de novo questions of statutory construction. (Imperial Merchant Services, Inc. v. Hunt (2009) 47 Cal.4th 381, 387 [97 Cal.Rptr.3d 464, 212 P.3d 736].) In doing so, “ ‘our fundamental task is “to ascertain the intent of the lawmakers so as to effectuate the purpose of the statute.” ’ ” (Mays v. City of Los Angeles (2008) 43 Cal.4th 313, 321 [74 Cal.Rptr.3d 891, 180 P.3d 935].) We begin with the text, “giv[ing] the words their usual and ordinary meaning [citation], while construing them in light of the statute as a whole and the statute’s purpose [citation].” (Pineda v. Williams-Sonoma Stores, Inc. (2011) 51 Cal.4th 524, 529-530 [120 Cal.Rptr.3d 531, 246 P.3d 612] (Pineda).) “If no ambiguity appears in the statutory language, we presume that the Legislature meant what it said, and the plain meaning of the statute controls.” (People v. Gray (2014) 58 Cal.4th 901, 906 [168 Cal.Rptr.3d 710, 319 P.3d 988].)
We first address whether the trial court erred in failing to advise Blackburn of his right to a jury trial. The advisement provision states: “The court shall advise the person of his or her right to be represented by an attorney and of the right to a jury trial.” (§ 2972(a).) The meaning of this text is unambiguous. The court must advise the defendant of the right to counsel and the right to a jury trial. And the court must make this advisement to “the person,” not to his or her attorney. This plain meaning is confirmed by the very next sentence of section 2972(a), which distinguishes between “the person” and his or her “attorney.” (Ibid. [“The attorney for the person shall be given a copy of the petition, and any supporting documents.”].)
The Attorney General argues that when counsel is present, the required advisement is “moot” because counsel is obligated to advise the client of his or her rights. But the statutory mandate contains no mootness exception. Moreover, because mentally disordered offenders have not only a right to counsel but a right to appointed counsel in case of indigence (§ 2972, subd. (b)), the Attorney General’s view would suggest that the Legislature intended the advisement provision to apply only when a defendant chooses to represent himself or herself and is sufficiently competent to do so. We find this narrow inference of legislative intent improbable in light of the statute’s unqualified directive.
It may be argued that it is sufficient for the trial court to give the advisement to counsel, who is then obligated to advise the client. But this, *1124too, would empty the advisement provision of meaningful content, for it is hard to see what purpose would be served by advising counsel when counsel is already presumed to know the law. (See Tubbs v. Southern Cal. Rapid Transit Dist. (1967) 67 Cal.2d 671, 679 [63 Cal.Rptr. 377, 433 P.2d 169].) The Legislature saw fit to include the statutory provision requiring an advisement even though MDO defendants are often represented by counsel and even though counsel is presumed to know the defendant’s rights and is obligated to advise the defendant accordingly. The meaning of the provision is clear. As the Court of Appeal explained, “[i]t reflects a legislative intent to judicially ensure that ‘the person’ knows that he or she has the right to a jury trial.” We conclude that section 2972(a) requires the trial court to directly advise the MDO defendant on the record in a court proceeding.
In this case, the record does not indicate that the trial court advised Blackburn of his right to a jury trial as section 2972(a) requires. This omission was error.
C.
We next address whether section 2972(a)’s waiver provision requires an MDO defendant to personally waive his or her right to a jury trial before the court may hold a bench trial. We again begin with the text, “giv[ing] the words their usual and ordinary meaning [citation], while construing them in light of the statute as a whole and the statute’s purpose [citation].” (Pineda, supra, 51 Cal.4th at pp. 529-530.) The waiver provision says: “The trial shall be by jury unless waived by both the person and the district attorney.” (§ 2972(a).)
In construing these words, we recognize that in ordinary civil actions, the “general rule” is that counsel has authority to bind the client in virtually all aspects of litigation, including waiver of the state constitutional right to a jury trial. (In re Horton (1991) 54 Cal.3d 82, 94-95 [284 Cal.Rptr. 305, 813 P.2d 1335]; see id. at p. 95 [“counsel is captain of the ship”]; Zurich G. A. & L. Ins. Co., Ltd. v. Kinsler (1938) 12 Cal.2d 98, 105 [81 P.2d 913]; Code Civ. Proc., § 283, subd. 1.) Commitment proceedings, however, are not ordinary civil actions; they are “ ‘special proceedings of a civil nature.’ ” (In re Gary W., supra, 5 Cal.3d at p. 309; see People v. Yartz (2005) 37 Cal.4th 529, 536 [36 Cal.Rptr.3d 328, 123 P.3d 604].) And they threaten the possibility of “a significant deprivation of liberty.” (Addington, supra, 441 U.S. at p. 425.) As in Masterson, we train our attention on the text and purpose of the particular statutes that govern this special proceeding to determine whether the decision to waive a jury trial must be made by the defendant or may be made by counsel notwithstanding the defendant’s wishes.
*1125Ultimately, we construe the waiver provision of section 2972(a) to establish a default rule that a court must obtain a personal waiver of the defendant’s right to a jury trial before holding a bench trial. But when the trial court finds substantial evidence that defendant lacks the capacity to make a knowing and voluntary waiver, control of the decision shifts to defense counsel.
1.
Several considerations suggest that section 2972(a) gives the defendant, not counsel, primary control over the waiver decision. First, as explained above, the first two usages of “the person” in section 2972(a) refer specifically to the defendant and cannot be read to mean “the defendant or his or her attorney.” The third usage of “the person” in section 2972(a) appears in the waiver provision, and “it is generally presumed that when a word is used in a particular sense in one part of a statute, it is intended to have the same meaning if it appears in another part of the same statute.” (People v. Dillon (1983) 34 Cal.3d 441, 468 [194 Cal.Rptr. 390, 668 P.2d 697] (Dillon).)
Second, reading the waiver provision together with the advisement provision, as we must, confirms that the waiver decision belongs to the defendant in the first instance. The purpose of an advisement is to inform the defendant of a particular right so that he or she can make an informed choice about whether to waive that right. (See Barrett, supra, 54 Cal.4th at p. 1105 [“[A]bsent any requirement of a personal waiver, the person facing commitment has no need for an express court advisement of the right to request a jury trial.”]; People v. Koontz (2002) 27 Cal.4th 1041, 1070 [119 Cal.Rptr.2d 859, 46 P.3d 335] [purpose of admonitions under Faretta v. California (1975) 422 U.S. 806 [45 L.Ed.2d 562, 95 S.Ct. 2525] is “to ensure a clear record of a defendant’s knowing and voluntary waiver of counsel”].) If the Legislature had intended to allow counsel to waive a jury trial notwithstanding the defendant’s wishes, it would not have needed to require the trial court to expressly advise the defendant. As the Court of Appeal explained, the purpose of the mandatory advisement is “to inform the MDO of the right to a jury trial so that he or she can decide whether to waive it.”
Third, we note that in various provisions other than those describing trial procedures in sections 2966(b) and 2972(a), the MDO statute distinguishes between “the person,” “the patient,” or “the prisoner” and his or her attorney or representative. (See §§ 2964, subd. (a) [when an MDO defendant returns to a facility, a hearing must be held within 15 days “unless the patient or the patient’s attorney agrees to a continuance”], 2964, subd. (b) [“the prisoner or any person appearing on his or her behalf’ can request the appointment of psychological professionals], 2966, subd. (a) [same], 2972.1, subd. (c)(1) *1126[“both defense counsel and the person on outpatient status shall sign and return to the court a form” concerning continued treatment], 2972.1, subd. (c)(2) [“If the person on outpatient status refuses or is unable to sign the form, his or her counsel shall indicate, in writing, that the form . . . [was] explained to the person and the person refused or was unable to sign the form.”].) Again, we presume the Legislature intended such usage to have consistent meaning throughout the same statute. (See Dillon, supra, 34 Cal.3d at p. 468.)
The Court of Appeal contrasted section 2972(a) with Welfare and Institutions Code section 1801.5, which provides for a trial by jury in proceedings to extend the commitment of a juvenile who is “physically dangerous to the public because of his or her mental or physical deficiency, disorder, or abnormality which causes the person to have serious difficulty controlling his or her dangerous behavior,” unless the right is “personally waived.” (Italics added.) The court concluded that, since the Legislature used the phrase “personally waived” in Welfare and Institutions Code section 1801.5, but not in section 2972(a), it must not have intended section 2972(a) to require a personal waiver. But two considerations argue against an inference that the Legislature intended the waiver procedures for juvenile offenders to be different from those for adult mentally disordered offenders.
First, the legislative history of Welfare and Institutions Code section 1801.5 suggests that the Legislature did not intend the language of personal waiver to be a departure from the requirements in existing civil commitment statutes. The original language of section 1801.5, enacted in 1971, provided for a right to a jury trial but did not include any mention of personal waiver. (Stats. 1971, ch. 1680, § 1, p. 3606.) When the phrase “personally waived” was added in 1998 (Stats. 1998, ch. 267, § 2, p. 1181), the legislative commentary noted: “This bill’s provisions are modeled on, and are analogous to, procedures used for MDOs and [sexually violent predators].” (Assem. Com. on Public Safety, Analysis of Sen. Bill No. 2187 (1997-1998 Reg. Sess.) as amended Apr. 28, 1998, p. 7.) The Legislature thus adopted the current scheme for committing dangerous juvenile offenders on the understanding that its procedures were “modeled” on those in the MDO scheme. (Ibid.)
Second, to conclude that the Legislature intended mentally disordered juvenile offenders, but not mentally disordered adult offenders, to control the decision to waive a jury trial would raise serious equal protection concerns. (See Barrett, supra, 54 Cal.4th at p. 1107 [“Because of the fundamental interests at stake, equal protection principles are often invoked in civil commitment cases to ensure that the statutory scheme applicable to a particular class of persons has not treated them unfairly in comparison with other groups with similar characteristics.”].) Such differential treatment would *1127be rather peculiar insofar as it suggests that adult mentally disordered offenders are less capable of voluntary and intelligent waivers than similarly situated juvenile offenders. By construing the waiver provision of section 2972(a) to mean the defendant controls the waiver decision, we avoid this constitutional concern. (See People v. Gutierrez (2014) 58 Cal.4th 1354, 1373 [171 Cal.Rptr.3d 421, 324 P.3d 245].)
2.
The considerations above suggest that the waiver decision belongs to the defendant in the first instance. But that is not the end of the matter because we must construe the waiver provision in light of the purpose of the MDO scheme. By its terms, the MDO statute addresses the treatment and civil commitment of offenders who suffer from a “severe mental disorder.” (§ 2960.) “The term ‘severe mental disorder’ means an illness or disease or condition that substantially impairs the person’s thought, perception of reality, emotional process, or judgment; or which grossly impairs behavior; or that demonstrates evidence of an acute brain syndrome for which prompt remission, in the absence of treatment, is unlikely.” (§ 2962(a)(2).) In light of this definition, we presume the Legislature was aware that many MDO defendants lack the capacity to make knowing and voluntary waivers of their right to a jury trial, and we doubt the Legislature intended to require courts to obtain a jury trial waiver from such persons. Indeed, assigning that decision to a person who is unable to exercise it competently would undermine the purpose of the advisement and waiver provisions, for those provisions are intended to ensure that the person makes a knowing and voluntary choice about whether to waive a jury trial. (See Pate v. Robinson (1966) 383 U.S. 375, 384 [15 L.Ed.2d 815, 86 S.Ct. 836] [“it is contradictory to argue that a defendant' may be incompetent, and yet knowingly or intelligently ‘waive’ his right[s] . . .”].)
Our cases have recognized that defendants whose competence has been called into doubt necessarily exercise a lesser degree of control over proceedings than defendants whose competence has not been called into doubt. In Masterson, we held that the trial court did not err when it allowed counsel to waive the requirement that the jury be composed of 12 members in a proceeding to determine the defendant’s competency to stand trial. (Masterson, supra, 8 Cal.4th at p. 974.) We emphasized the “respective roles of counsel and client in competency hearings,” which are “ ‘held only after there has been a prima facie showing of mental incompetence.’ ” (Id. at p. 972.) “ ‘[I]f counsel represents a defendant as to whose competence the judge has declared a doubt sufficient to require a section 1368 hearing, he should not be compelled to entrust key decisions about fundamental matters to his client’s apparently defective judgment.’ ” (Ibid.)
*1128Similarly, we held in Barrett that the decision to waive a jury trial belongs solely to counsel in commitment proceedings for persons alleged to be developmentally disabled and dangerous. (Barrett, supra, 54 Cal.4th at p. 1105.) We explained that “[t]he significant cognitive and intellectual deficits that [severe developmental disability] entails, which appear early in life and never recede, affect the ability to ‘make basic decisions’ regarding the conduct of the [Welfare and Institutions Code] section 6500 proceeding. [Citation.] Such an individual thus plays a limited ‘personal role’ in the case, and must rely on counsel to decide all tactical and procedural matters, such as whether to exercise the jury trial right.” (Id. at pp. 1103-1104.) We concluded that the lack of advisement and personal waiver of the right to a jury trial in a Welfare and Institutions Code section 6500 proceeding does not violate due process of law. (Barrett, at p. 1105.)
The Attorney General contends that we can infer that nearly every defendant in an MDO commitment extension proceeding lacks the capacity to make a knowing and voluntary waiver from the preliminary showing required for the district attorney to file an extension petition. (See § 2970 [extension petition for an MDO defendant in a state hospital must be accompanied by a written medical evaluation finding that the defendant suffers from a severe mental disorder that “is not in remission or cannot be kept in remission” without treatment].) A similar inference led this court to conclude that counsel, in making fundamental litigation decisions, may override the wishes of a criminal defendant facing a competency hearing (Masterson, supra, 8 Cal.4th at p. 972) or a developmentally disabled person facing a commitment proceeding (Barrett, supra, 54 Cal.4th at pp. 1104-1105). But the reasoning of those cases does not extend to mentally disordered offenders.
Instead, we have observed that many persons who suffer from mental illness or related disorders can understand the nature of legal proceedings and determine their own best interests. In Barrett, we distinguished between developmental disability and mental illness in this regard. We said developmental disability involves “cognitive and intellectual deficits” that “appear early in life and never recede” and “affect the ability to ‘make basic decisions’ regarding the conduct of [a legal] proceeding.” (Barrett, supra, 54 Cal.4th at p. 1103.) By contrast, “[mjental illness and related disorders are said to be conditions that may arise suddenly and, for the first time, in adulthood.” (Id. at p. 1108.) “[T]he need for treatment may be temporary, and . . . disabling mental disorders may be intermittent or short lived.” (Ibid.) “Where present, . . . ‘ “mental illness ‘often strikes only limited areas of functioning, leaving other areas unimpaired, and consequently . . . many mentally ill persons retain the capacity to function in a competent manner: ” ’ (In re Qawi (2004) 32 Cal.4th 1, 17 [7 Cal.Rptr.3d 780, 81 P.3d 224], italics added . . . .)” (Barrett, at p. 1109.) Thus, the conditions that result from *1129a mental illness or related disorder, “though they include imminent dangerousness, do not necessarily imply incompetence or a reduced ability to understand, and make decisions about, the conduct of the proceedings.” (Ibid.; see Conservatorship of John L. (2010) 48 Cal.4th 131, 154 [105 Cal.Rptr.3d 424, 225 P.3d 554] [“it may not be presumed that . . . one who has been evaluated or treated for a mental disorder ... is incompetent to waive [trial] rights”]; Welf. & Inst. Code, § 5331 [“No person may be presumed to be incompetent because he or she has been evaluated or treated for mental disorder . . . , regardless of whether such evaluation or treatment was voluntarily or involuntarily received.”]; cf. In re Qawi, supra, 32 Cal.4th at p. 24 [“Although an MDO must be determined to have a ‘severe mental disorder,’ commitment for a mental disorder does not by itself mean that individuals are incompetent to participate in their own medical decisions.”].)
By definition, every mentally disordered offender has previously been deemed competent to stand trial, and the premise of the MDO statute is that severe mental disorders are “treatable.” (§ 2960; see § 2972, subd. (f) [declaring “affirmative obligation on the treatment facility to provide treatment”].) Although a petition for extended commitment must be supported by an evaluation finding that the defendant’s severe mental disorder “is not in remission or cannot be kept in remission without treatment” (§ 2970, subd. (a)), we have recognized that “[t]he ‘cannot be kept in remission without treatment’ standard can ... be found when a person ‘has not voluntarily followed the treatment plan’ during the year prior to the commitment or recommitment proceeding.” (In re Qawi, supra, 32 Cal.4th at p. 24.) A defendant’s compliance with treatment in advance of a commitment extension hearing may alleviate or attenuate, at least for the duration of the proceeding, any cognitive impairment associated with a particular mental disorder. The potentially transitory and treatable nature of mental illness and the potentially limited areas of functioning impaired by such illness preclude any categorical inference that an MDO defendant facing a commitment extension proceeding cannot competently decide whether to waive a jury trial.
We thus observe that the Legislature placed control of the decision to waive a jury trial in “the person” (§ 2972(a)), even as we infer that the Legislature did not intend the decision to be made by a defendant who lacks the capacity to make a knowing and voluntary waiver. In reconciling these objectives, a trial court need not conduct a full-blown competency hearing. The statute does not expressly provide for such a hearing, and we are mindful of “the ‘ “administrative burdens” ’ and ‘practical difficulties’ of demanding new procedures.” (Barrett, supra, 54 Cal.4th at p. 1106.) In Masterson, we found it dispositive that “ ‘[a] section 1368 hearing is held only after there has been a prima facie showing of mental incompetence’ ” and that “the court . . . declared a doubt as to defendant’s competence” based on such a *1130showing. (Masterson, supra, 8 Cal.4th at pp. 972, 974.) We adopt a similar approach here: In a section 2972(a) commitment extension hearing, the decision to waive a jury trial belongs to the defendant in the first instance, and the trial court must elicit the waiver decision from the defendant on the record in a court proceeding. But if the trial court finds substantial evidence that the defendant lacks the capacity to make a knowing and voluntary waiver, then control of the waiver decision belongs to counsel, and the defendant may not override counsel’s decision. In this context, evidence is substantial when it raises a reasonable doubt about the defendant’s capacity to make a knowing and voluntary waiver, and the trial court’s finding of a reasonable doubt must appear on the record. (Cf. People v. Lawley (2002) 27 Cal.4th 102, 131 [115 Cal.Rptr.2d 614, 38 P.3d 461]; Masterson, at p. 974.)
In this case, Blackburn did not personally waive his right to a jury trial. Nor, as the Court of Appeal observed, does the record “establish that during the pretrial period defendant was so affected by his mental disease as to raise doubt about his capacity” to make a knowing and voluntary waiver. Accordingly, we conclude that the trial court erred in accepting counsel’s waiver and holding a bench trial.
The Court of Appeal held that section 2972(a) does not require the trial court to obtain a personal waiver from the defendant. Rather, waiver by counsel must be “at the MDO’s direction or with the MDO’s knowledge and consent” unless “the circumstances cast reasonable doubt on the MDO’s mental capacity to determine what is in his or her best interests.” The Court of Appeal declined to find error in this case, explaining that because counsel waived Blackburn’s presence at every pretrial hearing, the trial court could “reasonably expect counsel to discuss all pertinent matters that will arise or that have arisen in pretrial hearings, including the right to a jury trial and whether to have one.” The Court of Appeal added that “this was not the first extension of defendant’s MDO commitment, and the record does not suggest that defendant was unaware of his right to a jury trial notwithstanding the lack of a judicial advisement. Nor does the record suggest that defendant was unaware that counsel intended to waive a jury and had done so or that defendant wanted a jury trial and objected (or would have objected) to counsel’s waiver.”
Unlike the Court of Appeal and our concurring and dissenting colleagues (cone. & dis. opn., post, at pp. 1143-1144, 1146-1148), we decline to infer from these circumstances that Blackburn knowingly and voluntarily waived his right to a jury trial. To presume Blackburn’s knowing and voluntary waiver, as the Court of Appeal did, would defeat the point of section 2972(a)’s advisement and waiver provisions. By providing a right to counsel for MDO defendants facing extended commitment, the Legislature enacted section *11312972(a) on the understanding that most defendants would be represented by counsel. If counsel could waive a jury trial based on the defendant’s presumed consent when the record does not expressly indicate the defendant’s wishes, and even when the defendant is not present when the waiver occurs, then the Legislature would have had no need to require the trial court to advise “the person” of his or her right to a jury trial or to obtain a waiver from “the person.” (§ 2972(a).) Instead, counsel would be authorized to make the waiver decision, and the onus would be on the defendant to prove lack of consent. But that is not the scheme the Legislature enacted. Section 2972(a) makes clear that “[t]he trial shall be by jury unless waived by both the person and the district attorney.” (Italics added.) The statute does not require the defendant to affirmatively show he or she wanted a jury trial; a jury trial is the default procedure absent a personal waiver. In sum, the trial court must elicit the waiver decision from the defendant in a court proceeding unless it finds substantial evidence of incompetence, in which case counsel controls the waiver decision.
3.
Our holding today is consistent with the result, if not the reasoning, of People v. Otis (1999) 70 Cal.App.4th 1174 [83 Cal.Rptr.2d 326] (Otis), which upheld the trial court’s acceptance of counsel’s jury trial waiver over the objection of an MDO defendant. The defendant in that case showed signs of cognitive impairment at the commitment hearing: “Otis . . . told the court that invisible police had been sexually assaulting him and were sexually assaulting him as he spoke to the court. The court stated for the record that Otis was not being assaulted in court.” (Id. at pp. 1175-1176.) The trial court’s direct observation of Otis provided ample basis to doubt that he was capable of making a knowing and voluntary waiver decision. (Id. at p. 1177.)
We agree with Otis that “[t]he Legislature must have contemplated that many persons, such as Otis, might not be sufficiently competent to determine their own best interests. There is no reason to believe the Legislature intended to leave the decision on whether trial should be before the court or a jury in the hands of such a person.” (Otis, supra, 70 Cal.App.4th at p. 1177.) However, we disapprove People v. Otis, supra, 70 Cal.App.4th 1174, and People v. Montoya, supra, 86 Cal.App.4th 825, to the extent they hold that control of the waiver decision in an MDO commitment hearing invariably belongs to counsel. That conclusion sweeps too broadly in light of the Legislature’s focus on “the person” in section 2972(a)’s advisement and waiver provisions as well as the potentially transitory, treatable, and variable nature of cognitive impairments that may afflict mentally disordered offenders.
*1132IV.
Having found that the trial court erred in accepting counsel’s waiver of Blackburn’s right to a jury trial, we now consider the appropriate remedy.
When “state standards alone have been violated, the State is free ... to apply its own state harmless-error rule to such errors of state law.” (Cooper v. California (1967) 386 U.S. 58, 62 [17 L.Ed.2d 730, 87 S.Ct. 788].) California’s harmless error rule is set forth in article VI, section 13 of our state Constitution. In People v. Watson (1956) 46 Cal.2d 818 [299 P.2d 243] (Watson), we made clear that a defendant who has established state law error must typically demonstrate that “it is reasonably probable that a result more favorable to [the defendant] would have been reached in the absence of the error.” (Id. at p. 836.) “As we have explained, however, ‘under the California constitutional harmless-error provision some errors ... are not susceptible to the “ordinary” or “generally applicable” harmless-error analysis — i.e., the Watson “reasonably probable” standard — -and may require reversal of the judgment notwithstanding the strength of the evidence contained in the record in a particular case.’ ” (People v. Lightsey (2012) 54 Cal.4th 668, 699 [143 Cal.Rptr.3d 589, 279 P.3d 1072] (Lightsey).)
The latter rule is consistent with the language of California Constitution, article VI, section 13, whose phrase “miscarriage of justice” encompasses not only errors affecting the outcome of the case, but also certain procedural errors that may or may not have affected the outcome. As this court explained in People v. O’Bryan (1913) 165 Cal. 55 [130 P. 1042] (O’Bryan) two years after our state harmless error rule was adopted; “When we speak of administering ‘justice’ in criminal cases, under the English or American system of procedure, we mean something more than merely ascertaining whether an accused is or is not guilty. It is an essential part of justice that the question of guilt or innocence shall be determined by an orderly legal procedure, in which the substantial rights belonging to defendants shall be respected. For example, if a court should undertake to deny to a defendant charged with a felony the right of trial by jury, and after a hearing of the evidence render a judgment of conviction, it cannot be doubted that such judgment should be set aside even though there had been the clearest proof of guilt.” (Id. at pp. 65-66.)
We have not previously determined the correct approach to review when a trial court fails to obtain a valid jury trial waiver from an MDO defendant and thereby denies the defendant his or her statutory right to a jury trial on the entire cause in a civil commitment proceeding. As explained below, we hold that the erroneous denial of a jury trial in this context is a “miscarriage *1133of justice” within the meaning of California Constitution, article VI, section 13 and requires reversal without inquiry into the strength of the evidence in a particular case.
This court and the high court have applied harmless error analysis to a wide range of errors and have recognized that most errors can be harmless. (See Allen, supra, 44 Cal.4th at p. 872; Arizona v. Fulminante (1991) 499 U.S. 279, 306 [113 L.Ed.2d 302, 111 S.Ct. 1246] (Fulminante).) But we have explained that certain errors, which operate to deny a defendant an “ ‘orderly legal procedure’ ” (People v. Cahill (1993) 5 Cal.4th 478, 501 [20 Cal.Rptr.2d 582, 853 P.2d 1037] (Cahill)), can entail a “miscarriage of justice” under California Constitution, article VI, section 13. In Lightsey, we held that a trial court’s failure to appoint counsel to represent a defendant during a mental competency proceeding, in violation of section 1368, was automatically reversible because it was “ ‘analogous to’ ” the “ ‘total deprivation of the right to counsel at trial.’ (Fulminante, [supra, 499 U.S.] at p. 309.)” (Lightsey, supra, 54 Cal.4th at p. 699.) We observed that the defendant “was completely deprived of the assistance of counsel at a critical stage of the trial proceedings in violation of section 1368. As with a pervasive Sixth Amendment violation, the statutory violation here cannot be likened to ‘trial error’ .... We cannot simply excise some item of evidence in order to ‘make an intelligent judgment’ [citation] about whether the competency determination might have been affected by the absence of counsel to represent defendant. . . . Attempting to assess the effect of the absence of counsel on the trial court’s finding of competence is, in truth, no different than attempting to assess the effect on a jury’s final verdict of the absence of counsel during a trial on substantive charges: there is no reasoned manner in which to do so because the lack of true adversarial testing denied defendant the basic procedure by which his competence should have been determined.” (Id. at p. 701.) We thus concluded that the denial of the defendant’s right to counsel under section 1368 automatically required reversal. (Lightsey, at pp. 699, 702.)
If the case now before us were a criminal matter involving the invalid waiver of a state or federal constitutional jury trial right, there could be no doubt that the error would constitute a “miscarriage of justice” requiring reversal without regard to the strength of the evidence. Under settled law, “a judgment in a criminal case resulting from a court trial must be reversed if the defendant did not expressly waive the right to a trial by jury.” (People v. Ernst (1994) 8 Cal.4th 441, 443 [34 Cal.Rptr.2d 238, 881 P.2d 298] (Ernst).) In Ernst, we held that the trial court erroneously deprived the defendant of a jury trial where the defendant himself never expressly waived the right, even though counsel stated that the defendant was prepared to waive the right and, at a subsequent proceeding, indicated that the right had been waived. (Id. at p. 446.) We observed that absent an express waiver by a defendant, trial to a *1134court deprives the defendant of a jury trial, and reversal is required. (Id. at p. 448.) Similarly, in People v. Collins (2001) 26 Cal.4th 297 [109 Cal.Rptr.2d 836, 27 P.3d 726] (Collins), we held that the defendant’s jury trial waiver was invalid because the trial court had obtained the waiver by assuring the defendant of an unspecified benefit. (Id. at p. 312.) We then explained that “a harmless error standard does not, and cannot, apply . . .” because “the right to a jury trial is fundamental, and its denial . . . result[s] in a ‘miscarriage of justice’ within the meaning of California Constitution, article VI, section 13, and requir[es] that the judgment of conviction be set aside.” (Id. at p. 311.)
The failure to obtain a valid jury trial waiver defies ordinary harmless error analysis. To speculate about whether a defendant would have chosen a jury trial if he or she had been in a position to make a personal choice would pose insurmountable difficulties, as would an inquiry into what effect, if any, that choice would have had on the outcome of the trial. As we said in Collins, “where a case improperly is tried to the court rather than to a jury, there is no opportunity meaningfully to assess the outcome that would have ensued in the absence of the error.” (Collins, supra, 26 Cal.4th at p. 313.) Accordingly, we treat a trial court’s failure to obtain a required personal jury trial waiver as tantamount to the denial of a jury trial, and as such, it constitutes a “miscarriage of justice” under California Constitution, article VI, section 13. (See People v. Breverman (1998) 19 Cal.4th 142, 174 [77 Cal.Rptr.2d 870, 960 P.2d 1094] (Breverman) [“In rare instances involving ‘fundamental “structural defects” ’ [citation] in a criminal proceeding (for example, the complete denial of the right to a jury, or to an impartial judge), it may be impossible, or beside the point, to evaluate the resulting harm by resort to the trial record, and a miscarriage of justice may arise regardless of the evidence.”]; Cahill, supra, 5 Cal.4th at p. 491 [“in some contexts — for example, the erroneous denial of a defendant’s right to jury trial — an error may result in a miscarriage of justice, and require reversal, regardless of the strength of the evidence properly received at trial”].)
Although we have not held that mentally disordered offenders have a state or federal constitutional right to a jury trial in commitment extension proceedings, this court and the high court have long recognized that such proceedings threaten the possibility of lasting stigma and a significant deprivation of liberty. (Ante, at p. 1119.) In enacting section 2972, the Legislature was cognizant of these consequences and sought to afford defendants in MDO commitment proceedings various procedural protections to which criminal defendants are entitled, including the right to a jury trial, the right to a unanimous jury verdict, and the right to be committed by proof beyond a reasonable doubt. (Ante, at p. 1122.) Accordingly, the MDO commitment scheme is best understood as “a civil hearing with criminal procedural protections” (Montoya, supra, 86 Cal.App.4th at p. 830), and we find it significant for purposes of determining the applicability of harmless *1135error analysis that the Legislature set forth protections in section 2972 that are borrowed directly from the criminal context. In an MDO commitment proceeding, as in a criminal trial, the “jury guarantee” is a basic protection “whose precise effects are unmeasurable” and whose denial “def[ies] analysis by ‘harmless-error’ standards.” (Sullivan v. Louisiana (1993) 508 U.S. 275, 281 [124 L.Ed.2d 182, 113 S.Ct. 2078].) Accordingly, the total deprivation of a jury trial without a valid waiver in an MDO commitment proceeding requires automatic reversal.
In urging the applicability of Watson’s harmless error test, the Attorney General relies on People v. Epps (2001) 25 Cal.4th 19 [104 Cal.Rptr.2d 572, 18 P.3d 2] (Epps). In Epps, after a jury found the defendant guilty of various offenses, the trial court dismissed the jury and, in a bench trial, found true several prior conviction allegations. (Id. at p. 22.) We held that the trial court erred under section 1025 in denying the defendant a jury trial on the prior conviction allegations. (Epps, at pp. 23-28.) We then observed: “When a state need not provide a jury trial at all, it follows that the erroneous denial of that right does not implicate the federal Constitution. [Citations.] Moreover, because the error is purely one of state law, the Watson harmless error test applies. (See, e.g., People v. Breverman[, supra,] 19 Cal.4th 142, 172, 178 . . . ; see also Cal. Const., art. VI, § 13.)” (Id. at p. 29.) We found the error harmless because the evidence of the prior convictions was uncontradicted, but we expressly reserved the question whether “we would find harmless error in a case involving contested factual questions.” (Id. at p. 30.)
The Attorney General reads Epps to hold that the Watson harmless error standard is the sole test for determining whether a purely state law error warrants reversal under California Constitution, article VI, section 13. But Epps’ s brief treatment of harmless error did not discuss or purport to abrogate our settled law distinguishing between errors that are and are not automatically reversible under article VI, section 13. (See People v. Anzalone (2013) 56 Cal.4th 545, 553 [155 Cal.Rptr.3d 352, 298 P.3d 849]; Lightsey, supra, 54 Cal.4th at p. 699.) Instead, Epps cited Breverman, which itself recognized that some errors of state law require automatic reversal and mentioned the complete denial of a jury trial in a criminal case as an example. (Breverman, supra, 19 Cal.4th at p. 174.)
Epps and Breverman, along with People v. Wims (1995) 10 Cal.4th 293 [41 Cal.Rptr.2d 241, 895 P.2d 77] (Wims), applied Watson’s harmless error standard to the erroneous denial of a jury determination of certain limited matters in a criminal jury trial. In Breverman, the trial court’s jury instructions erroneously omitted instructions on a heat of passion theory of the lesser included offense of voluntary manslaughter. (Breverman, supra, 19 Cal.4th at pp. 153-162.) We said “the failure to instruct sua sponte on a lesser *1136included offense in a noncapital case is, at most, an error of California law alone . . and, citing Wims, held that such misinstruction is “subject ... to the Watson harmless error test.” (Breverman, at pp. 165, 171.) In Wims, the trial court violated the defendant’s statutory right to a jury determination on allegations of use of a deadly and dangerous weapon when it failed to instruct the jury on the factual elements the prosecution was required to prove. (Wims, at pp. 302-303.) We observed that the Watson test “is ‘generally applicable under current California law’ ” and, upon reviewing the evidence, concluded it was not reasonably probable that the jury would have found the weapon use allegation untrue. (Wims, at p. 315.)
Whereas Wims, Breverman, and Epps each applied the Watson test to the erroneous denial of a jury determination of certain limited matters in a criminal jury trial, the issue before us involves a trial court’s acceptance of an invalid waiver that completely deprives an MDO defendant of his or her right to a jury trial under section 2972(a). As in Lightsey, the error here is one “ ‘affecting the framework within which the trial proceeds, rather than simply an error in the trial process itself.’ ” (Lightsey, supra, 54 Cal.4th at p. 700.) Such error denies the defendant “the basic procedure by which” the validity of his or her commitment “should have been determined” under a statutory scheme whose protections are borrowed directly from the criminal context. (Id. at p. 701.) We therefore conclude that when a trial court errs in completely denying an MDO defendant the right to a jury trial under section 2972(a), the error requires automatic reversal. We disapprove People v. Wrentmore (2011) 196 Cal.App.4th 921, 928-929 [127 Cal.Rptr.3d 309], and People v. Cosgrove (2002) 100 Cal.App.4th 1266, 1275-1276 [123 Cal.Rptr.2d 535], to the extent they are inconsistent with this opinion.
The concept of harmless error does have applicability in this context in the following limited sense. A trial court’s acceptance of counsel’s waiver without an explicit finding of substantial evidence that the defendant lacked the capacity to make a knowing and voluntary waiver may be deemed harmless if the record affirmatively shows that there was substantial evidence that the defendant lacked that capacity at the time of counsel’s waiver. (See, e.g., ante, at p. 1131 [discussing Otis].) In addition, a trial court’s failure to properly advise an MDO defendant of the right to a jury trial does not by itself warrant automatic reversal. Instead, a trial court’s acceptance of a defendant’s personal waiver without an express advisement may be deemed harmless if the record affirmatively shows, based on the totality of the circumstances, that the defendant’s waiver was knowing and voluntary. (Cf. People v. Howard (1992) 1 Cal.4th 1132, 1178 [5 Cal.Rptr.2d 268, 824 P.2d 1315]; Barrett, supra, 54 Cal.4th at p. 1114 (cone. & dis. opn. of Werdegar, J.) [finding advisement error harmless]; Barrett, at pp. 1151-1152 (cone. & dis. opn. of Liu, J.) [same].) In both scenarios, the requirement of an affirmative showing means that no valid waiver may be presumed from a silent record. *1137(Ante, at pp. 1130-1131.) Ultimately, we emphasize that the most certain means of ensuring a valid waiver is careful compliance with the express advisement and waiver process explained in this opinion.
V.
As noted, our decision today rejects the rule previously set forth in Otis, supra, 70 Cal.App.4th 1174, and Montoya, supra, 86 Cal.App.4th 825, that counsel invariably controls the decision to waive a jury trial in an MDO commitment proceeding. In this case, the trial court and the parties may have reasonably relied on that prior law in proceeding with a bench trial without making a record of Blackburn’s personal waiver or his inability to make a knowing and voluntary waiver. Accordingly, we remand this case to the Court of Appeal with directions to remand to the trial court so that the district attorney may submit evidence, if any, that Blackburn personally made a knowing and voluntary waiver or that he lacked the capacity to make a knowing and voluntary waiver at the time of counsel’s waiver. If the trial court finds by a preponderance of the evidence that Blackburn made a knowing and voluntary waiver, or if it finds substantial evidence that he lacked that capacity at the time of counsel’s waiver, then the court shall reinstate the extension order. This approach applies to all cases presently on direct appeal where the record does not reveal whether an MDO defendant personally waived his or her right to a jury trial or whether there was substantial evidence that the defendant lacked the capacity to make a knowing and voluntary waiver at the time of counsel’s waiver.
CONCLUSION
For the reasons above, we reverse the judgment of the Court of Appeal upholding the extension order and remand for proceedings not inconsistent with this opinion.
Werdegar, J., Corrigan, J., Cuéllar, J., and Kruger, J., concurred.