
216 Cal.App.3d 1510 (1990)
265 Cal. Rptr. 574
In re JAMES DODD ROBINSON on Habeas Corpus.
Docket No. G008592.
Court of Appeals of California, Fourth District, Division Three.
January 4, 1990.
*1512 COUNSEL
Stewart & Barnett and William J. Kopeny for Petitioner.
No appearance for Respondent.
Cecil Hicks, District Attorney, and Thomas J. Rees, Deputy District Attorney, for Real Party in Interest.
*1513 OPINION
SONENSHINE, J.
Petitioner James Dodd Robinson was charged in 1981 with burglary (Pen. Code, § 459)[1] and robbery (§ 211). On September 16, 1982, pursuant to a negotiated plea agreement, he withdrew his plea of not guilty and entered a sole plea of not guilty by reason of insanity (NGI). The matter was then submitted to the court on psychiatric reports and he was found NGI and committed to the Department of Mental Health. (§ 1026, subd. (a).) His maximum prison term was determined to be six years. (§ 1026.5, subd. (a)(1).) At the time of his plea, he was not advised of the consequences of an NGI commitment, i.e., that his term could be extended indefinitely. (§ 1026.5, subd. (b)(1);[2]In re Moye (1978) 22 Cal.3d 457 [149 Cal. Rptr. 491, 584 P.2d 1097].)
Five years later, on June 16, 1987, Robinson's commitment was extended two more years, without opposition from him or his court-appointed counsel. On February 23, 1989, a second petition for extension was filed, seeking another two-year commitment. This time Robinson moved to dismiss the petition, claiming his initial plea was defective because he had not been advised an NGI commitment carried the possibility of confinement beyond the six-year prison term. He maintained he would not have entered the plea had he been so advised. Moreover, at the time of the first extension, he was unaware such failure to advise was a possible basis for challenging the petition.
Robinson asked the superior court to deem his motion to dismiss, in the alternative, a petition for writ of habeas corpus. The court granted his request but later denied both the motion and the petition, on the basis he failed adequately to explain the delay in challenging the NGI plea. He petitioned this court for a writ of habeas corpus and we issued an order to show cause.
There is no record that Robinson, at the time of his initial NGI plea, was advised of the possibility of limitless extensions of his commitment. (People v. Lomboy (1981) 116 Cal. App.3d 67 [171 Cal. Rptr. 812].) The People, however, argue he has waived any claim of impropriety by failing to appeal his 1982 commitment and failing to challenge the 1987 extension when he was aware of the possibility of limitless extensions.
*1514 The People rely on the recent decision in People v. Superior Court (Wagner) (1989) 210 Cal. App.3d 1146 [258 Cal. Rptr. 740], which held appellant's unexcused delay in challenging his NGI plea resulted in a waiver of any defect in the plea. (Id., at p. 1150.)[3]
Robinson admits that within a year or two of his arrival at the hospital he learned from other patients (inmates) that commitments could be extended. It became a certainty when his commitment was in fact extended in 1987. He alleges, however, he was unaware of the legal effect of the initial failure to advise him. That is, he was not aware the failure to advise him of the possibility of extension was a basis for challenging his original plea. By the time he learned this, his appeal remedy had long since lapsed.
In Wagner, the challenge to defendant's original plea arose at the first attempt to extend his commitment when he brought a motion to dismiss the petition. The Court of Appeal reversed the order granting the motion, concluding Wagner had waited until he reaped all of the benefits but suffered none of the disadvantages of his plea before taking tactical advantage of the lack of advisement. Relying on In re Ronald E. (1977) 19 Cal.3d 315 [137 Cal. Rptr. 781, 562 P.2d 684], it held Wagner's unexcused delay in challenging the defective plea resulted in waiver of the defect. (People v. Superior Court (Wagner), supra, 210 Cal. App.3d at p. 1150.)
(1) Here, by contrast, Robinson's failure to raise the issue at his first extension hearing served only to increase his sentence. There could be no tactical advantage to him from lying in the weeds and every reason to have asserted it in 1987. This supports his argument he did not know then he could challenge the People's efforts to extend his commitment by attacking his original plea.[4]
Although he obviously realized he could be held longer than six years at the time his commitment was first extended, a waiver implies Robinson knew he could challenge the extension and chose not to do so. A timely exercise of rights cannot be demanded until a defendant has knowledge of those rights. These circumstances, unlike those in Wagner, disclose an excuse for the delay in raising the defect.
*1515 Moreover, the defendant in Wagner sought to avoid extension of his commitment without affirmatively alleging actual ignorance and lack of advisement of the penal consequences of his plea. (210 Cal. App.3d at p. 1154.) The Court of Appeal found these omissions fatal to a delayed collateral attack on the judgment. (Ibid.)
Similarly, in In re Ronald E., supra, 19 Cal.3d 315, the Supreme Court held entitlement to relief from a defective advisement is waived unless predicated upon proven allegations the petitioner did not know the consequences at the time his plea was entered or when he could have appealed the judgment, and would have acted differently had he known. (Id., at p. 325.)
By contrast, Robinson has properly alleged these facts. The allegations in his petition established a prima facie case for habeas corpus review and an excuse for his failure to appeal either the original judgment or the subsequent commitment extension order.[5] (See In re Ronald E., supra, 19 Cal.3d at p. 322, fn. 3; People v. Superior Court (Wagner), supra, 210 Cal. App.3d at p. 1154.)
The lower court heard Robinson's testimony and specifically found him credible. Under the standards of Ronald E. and Wagner, Robinson's testimony supports his request for relief. The evidence he was unaware of the basis for challenging his plea constitutes an adequate explanation for the delay in raising the issue. There was no waiver.[6]
The more troubling question is the form of relief to which Robinson is entitled. Citing People v. McIntyre (1989) 209 Cal. App.3d 548 [257 Cal. Rptr. 271], he urges the appropriate remedy is dismissal of the People's petition and his immediate release.
McIntyre was decided as a direct appeal from an order extending a commitment (§ 1237), in which the court of appeal found improper advice regarding the consequences of the defendant's plea justified reversing the judgment. The superior court was directed to dismiss the extension petition. For reasons we shall discuss, we believe the reasoning and the result in McIntyre were erroneous.
*1516 McIntyre had challenged the extension petition in the lower court by motion to dismiss, claiming a defective plea. After losing the motion and the ensuing trial, he raised the question of the validity of the plea on appeal. The court proceeded on the assumption the appeal of the judgment encompassed the denial of the motion, and did not discuss the adequacy of the showing on the motion. This presents two problems.
(2) The first was recognized by the court in Wagner, when it addressed a similar situation in the defendant's characterization of his collateral attack as a motion to dismiss: "From the principles set forth in Ronald E. and Sumstine [People v. Sumstine (1984) 36 Cal.3d 909], we conclude that for purposes of determining waiver of entitlement to challenge the 1983 NGI plea, defendant Wagner's motion to dismiss is identical in substance and purpose to the untimely habeas corpus challenge in Ronald E. .... [¶] To characterize his challenge as a motion to dismiss rather than a habeas corpus petition is solely one of form and will not permit him to avoid the Ronald E. standard. [Footnote omitted.]" (People v. Superior Court (Wagner), supra, 210 Cal. App.3d at pp. 1151-1152.)
The Wagner court recognized the defendant's attempt to skirt the elements of a collateral attack on a plea by simply entitling his pleading a "motion to dismiss." The McIntyre court did not address this issue, but at one point suggested the question of the timeliness of McIntyre's challenge was resolved in his favor by a silent record. (People v. McIntyre, supra, 209 Cal. App.3d at p. 558, fn. 13.) (3) This clearly contravenes the requirement a defendant affirmatively allege facts supporting the timeliness of his motion. (In re Ronald E., supra, 19 Cal.3d at p. 325.) More important, for our purposes, it suggests McIntyre was excused from compliance with these pleading requirements by virtue of the procedural mechanism he employed. To the extent it may be inferred from McIntyre that a motion to dismiss will excuse compliance with proper pleading requirements for collateral attacks set out in Ronald E., we disagree with its reasoning and adopt that of Wagner.
(4) The second problem with McIntyre is its assumption the appeal of the judgment on the extension petition encompassed the denial of the motion to dismiss. McIntyre's appeal could only be grounded on irregularities in the trial on the petition to extend his commitment. His motion to dismiss, insofar as it purported to attack collaterally his original plea, was not subject to direct appeal from the ensuing judgment and was not properly joined with that appeal.[7] Our understanding of Ronald E. makes it clear *1517 such a belated attack may be raised in an appellate court by petition for writ of habeas corpus or other similar vehicle. (See In re Ronald E., supra, 19 Cal.3d at p. 315, fn. 3.) Accordingly, it was not properly before the appellate court.
The McIntyre remedy of dismissal of the petition, to the extent it was based on his defective NGI plea, was also wrong. Setting aside the petition for extension is a proper appellate remedy when based on error in that proceeding.
(5a) On the other hand, a meritorious collateral attack on a judgment can logically result only in vacating that judgment. The elements of knowledge and prejudice trigger the review by habeas corpus and necessarily define the relief. Because a petitioner is required to assert he or she would not have entered the plea had the consequences been known, setting aside the plea places a petitioner in the position he or she occupied before the defective advisement.
Robinson's allegation he would not have entered the NGI plea had he known the consequences, leads us to conclude we can grant only withdrawal of the original NGI plea. The Supreme Court said as much in People v. Sumstine, supra, 36 Cal.3d 909, 920, when it distinguished the rules governing habeas corpus and those governing motions to strike: "When the issuance of a writ of habeas corpus vacates the underlying judgment of conviction, the judgment ceases to exist for all purposes."
We have previously concluded Robinson properly alleged and proved the necessary elements for relief, by establishing he had no knowledge of the right of which he claims a lack of advisement, and that, had he known of this right, he would not have entered into the NGI plea. (In re Ronald E., supra, 19 Cal.3d at pp. 325-326.) Had Robinson simply alleged a lack of advisement, without more, his petition would have been dismissed as merely "an alternate path for appellate review." (Id., at p. 325, fn. 8.)
Robinson's prayer for dismissal of the petition is inappropriate because the petition has not been challenged on its merits; only the underlying plea is attacked. Moreover, any defect in the petition can be raised at trial and challenged on appeal.
(6) Having said that, we hasten to distinguish the NGI situation from the simple guilty plea, such as that with which Ronald E. dealt. In the latter case, the attack on the judgment affects only the validity of the plea of guilty to the charge. By contrast, under section 1260, the merits of an NGI plea may be determined after a plea or a finding of guilt on the charges. Where *1518 the NGI plea is not inextricably linked to the decision to plead guilty, or where the finding of guilt came after a trial on the merits, the judgment of guilt will stand and only the NGI finding falls.
The determination of the posture of an underlying guilty plea, once the NGI plea is set aside, must be undertaken in the trial court on a case-by-case basis. An attack on the NGI plea does not necessarily affect an underlying guilty plea, unless such an allegation is pleaded and proved. Moreover, if a plea bargain is involved, the extent to which an order setting aside the NGI plea affects the bargain must also be determined by the trial court, after hearing evidence.
(5b) However, this case presents a variation on these situations. Robinson withdrew his plea of not guilty and entered solely an NGI plea. It was not preceded by either a separate finding of guilt or a plea of guilty or not guilty. Under section 1016, subdivision 6, "[a] defendant who pleads not guilty by reason of insanity, without also pleading not guilty, thereby admits the commission of the offense charged."[8]
Where only an NGI plea is entered, the NGI plea and the admission are one and the same. Without a separate plea of guilty, we can see no alternative to the conclusion the two are indivisible and find the remedy is to set aside the plea of NGI and its concomitant admission of guilt. Having done that, there is no basis for a petition for extension and it, too, must fall.
Let the writ issue directing the superior court to allow Robinson, if he so elects, to withdraw his plea of NGI within 30 days of the finality of this opinion. If he does not withdraw his plea, trial on the petition to extend his commitment shall proceed in due course.
Crosby, Acting P.J., and Wallin, J., concurred.
A petition for a rehearing was denied January 25, 1990, and the petition of respondent District Attorney for review by the Supreme Court was denied April 4, 1990.
NOTES
[1]  All statutory references are to the Penal Code unless otherwise specified.
[2]  Section 1026.5, subdivision (b)(1) provides, in relevant part: "A person may be committed beyond the term prescribed by subdivision (a) only under the procedure set forth in this subdivision and only if such person has been committed under Section 1026 for a felony, and who by reason of mental disease, defect, or disorder represents a substantial danger of physical harm to others."
[3]  Although couched in terms of "waiver," this issue really amounts to a form of "laches." That is, by waiting eight years to raise this argument for the first time, the People argue Robinson "sat on" his rights and failed to exercise the strict diligence required when a defendant collaterally challenges the consequences of a judgment. (People v. Sumstine (1984) 36 Cal.3d 909, 919-920 [206 Cal. Rptr. 707, 687 P.2d 904].) Such an analysis was described in Sumstine as involving issues of timeliness and prejudice "because tardy petitions hinder the state's ability to effectively present its case anew." (Id., at p. 920.)
[4]  Robinson does not allege his failure to challenge the defective plea was due to his mental disability and we do not reach the issue here.
[5]  Although section 1237, subdivision (a), allows an appeal from "the commitment of a defendant for insanity," we entertain his petition for a writ of habeas corpus before the trial on the petition to extend his commitment because, if the petition has merit, Robinson is entitled to a different remedy than he could seek on appeal.
[6]  Robinson has also alleged his attorney's failure in 1987 to advise him of the possible challenge to his original plea, before counseling him to submit to the extension, deprived him of effective assistance of counsel. Because we find there was no waiver, we do not reach the issue of the effectiveness of Robinson's counsel at the time of the entry of his NGI plea or at his first extension hearing.
[7]  McIntyre did file a petition for writ of habeas corpus alleging denial of effective assistance of counsel, which the appellate court did not address, denying it as moot.
[8]  It is significant the statute specifies a defendant entering such a plea "admits" the commission of the offense, rather than implying a plea of guilty from the entry of the NGI plea. We have no reason to believe a defendant who impliedly admits the commission of the offense is also pleading guilty to that offense. It is certainly conceivable a defendant could admit the acts constituting the offense without also admitting he or she harbored the pertinent mental state. In such a case, the admission that he or she committed the offense would bear little resemblance to a guilty plea, which confesses all the elements of the crime.
