
35 Cal.3d 663 (1984)
677 P.2d 219
200 Cal. Rptr. 293
DONALD EUGENE BAKER, Petitioner,
v.
THE SUPERIOR COURT OF SAN DIEGO COUNTY, Respondent; THE PEOPLE, Real Party in Interest. In re PETER A. LAMPORT on Habeas Corpus. In re DOUGLAS E. COUCH on Habeas Corpus.
Docket No. Crim. 22993.
Supreme Court of California.
March 22, 1984.
*664 COUNSEL
J. Thomas Bowden and John T. Philipsborn, under appointments by the Supreme Court, and Frank X. Nageotte for Petitioners.
Quin Denvir, State Public Defender, and Adrian K. Panton, Deputy State Public Defender, as Amici Curiae on behalf of Petitioners.
No appearance for Respondent Court.
*665 George Deukmejian and John K. Van de Kamp, Attorneys General, Robert H. Philibosian, Chief Assistant Attorney General, Daniel J. Kremer, Assistant Attorney General, Steven V. Adler, Harley D. Mayfield and Jay M. Bloom, Deputy Attorneys General, Edwin Miller, District Attorney, Peter C. Lehman, Thomas F. McArdle and Henry R. Mann, Deputy District Attorneys, for Real Party in Interest and Respondent.
OPINION
KAUS, J.
In 1979 petitioners Baker and Lamport were convicted on charges arising out of separate incidents of oral copulation of a minor (Pen. Code, § 288a) and committed for three years to the Department of Mental Health as mentally disordered sex offenders (MDSO's), the commitments to expire in April 1982. In 1977 petitioner Couch was convicted of lewd and lascivious conduct with a child under 14 years (Pen. Code, § 288) and committed as an MDSO for five years, the commitment to expire in May 1982. In each case, the district attorney filed a timely petition to extend the commitment (former Welf. & Inst. Code, § 6316.2).[1] During the hearing on the petition, Baker demurred and moved to dismiss, contending that the repeal of the MDSO laws effective January 1, 1982, precluded extension of commitments after that date. The trial court overruled the demurrer and denied the motion; Baker seeks a writ of prohibition to prevent further proceedings on the petition for extension. After hearings, the commitments of Lamport and Couch were extended for two years. They seek habeas corpus, also asserting a lack of jurisdiction to extend their commitments.

I
Effective January 1, 1982, the MDSO provisions of the Welfare and Institutions Code (former §§ 6300-6330) were repealed. (Stats. 1981, ch. 928, § 2.) At the same time, sections 1364 and 1365 were added to the Penal Code. Section 1364 provided in pertinent part: "Notwithstanding any other provision of law, when any person is convicted of a sex offense against a person under the age of 14 years or of a sex offense accomplished against the victim's will by means of force, violence, duress, menace, or fear of immediate and unlawful bodily injury on the victim or another person there shall be no hearing to determine whether the person is a mentally disordered sex offender. [¶] The court after imposing sentence for such a conviction shall order the delivery of the convicted person to the Department of Corrections. *666 The Department of Corrections shall inform such convicted persons of the state hospital program established pursuant to this section...." (Italics added; Stats. 1981, ch. 928, § 1.)[2]
(1) In support of their contention that the trial court has no jurisdiction to extend MDSO commitments, petitioners argue that if the Legislature intended to permit extended commitments, it would have provided a savings clause, with specific reference to section 6316.2, for MDSOs committed before January 1, 1982.[3]
By and large, the indications of legislative intent are contrary to petitioners' position. For one thing, as the People note, the legislative purpose in repealing MDSO commitment procedures was to treat sexual offenders more harshly. In view of that purpose, it would be unreasonable to allow dangerous MDSOs to be released earlier than they would otherwise have been because of the fortuitous circumstance that the Legislature has decided to eliminate the MDSO program prospectively.
The Legislature's intent to retain the program as to persons already committed as MDSOs is clearly stated in sections 3 and 4 of chapter 928, the repealing statute: "SEC. 3. Nothing in this act shall be construed to affect any person under commitment [as an MDSO] ... prior to the effective date of this act. It is the Legislature's intent that persons committed as mentally disordered sex offenders and persons whose terms of commitment are extended under the provisions of Section 6316 of the Welfare and Institutions Code shall remain under these provisions until the commitments are terminated and the persons are returned to the court for resumption of the criminal proceedings. [¶] The Legislature finds and declares that the purposes of the mentally disordered sex offender commitment have been to provide adequate treatment of these offenders, adequate controls over these persons by isolating them from a free society, and to protect the public from repeated commission of sex crimes. In making the repeal of the mentally *667 disordered sex offender commitment procedures prospective only, the Legislature finds and declares that it is necessary to retain persons under this commitment who committed their crimes before the effective date of this enactment in order to have proper control over these persons and to protect society against repeated commission of sex crimes and that other enactments in the 1979-80 Regular Session of the Legislature and the 1981-82 Regular Session of the Legislature would yield prison terms which would provide this protection to society without the need to retain the mentally disordered sex offender commitment. [¶] SEC. 4. In repealing the mentally disordered sex offender commitment, the Legislature recognizes and declares that the commission of sex offenses is not in itself the product of mental diseases. It is the intent of the Legislature that persons convicted of a sex offense after the effective date of this section, who are believed to have a serious, substantial, and treatable mental illness, shall be transferred to a state hospital for treatment under the provisions of Section 2684 of the Penal Code."[4] (Italics added.)
Nothing could be clearer than the first sentence of section 3 as to the Legislature's intention to exclude from the repeal of the MDSO laws those persons who had been committed prior to the effective date of the new law.[5]People v. Superior Court (Martin), supra, 132 Cal. App.3d 658, reaches the same conclusion, holding that "in order to insure against the immediate release of persons previously committed as MDSOs and who still pose a substantial danger to society, the Legislature specifically declared that these persons should continue to be subject to the provisions of Welfare and Institutions Code sections 6316 and 6316.2." (Id., at p. 663, fn. omitted.)
Further, the Martin court saw no ambiguity in the use of the phrase, in section 3, that the repeal shall have no affect on "`persons whose terms of *668 commitment are extended.'" Had the Legislature contemplated no future extensions, it would have excluded from the repealing statute only "`persons whose terms of commitment have been extended.'" (Id.)
An additional indicator of legislative intent is provided by Assembly Bill No. 3388, placed into effect in August of 1982 as urgency legislation. The bill amended section 1026.5 of the Penal Code to provide that before the termination of the commitment of any insane criminal offender, the medical director of the state hospital is required to submit his opinion as to whether or not the person is subject to the provisions for extended commitment. (Stats. 1982, ch. 650, § 1.) Section 2 of the same bill made similar provisions applicable to mentally disordered sex offenders. The legislative counsel noted that the bill applied to MDSOs "who are still subject to extended commitment, having been committed prior to the recent repeal of provisions of law relating to such offenders."
While the later legislation could not validate an earlier unauthorized extension of a commitment (see, California Emp. etc. Com. v. Payne (1947) 31 Cal.2d 210, 213-214 [187 P.2d 702]), the enactment does provide some indication of what the Legislature intended in 1981, when it repealed the MDSO laws.[6]
In sum, the language of the repealing statute as well as the legislative history described above convinces us that the Legislature did not intend to preclude extension of commitments after January 1, 1982, for those persons who were in the program on that date.

II
(2a) Petitioners contend that extension of their MDSO commitments denies them equal protection of the laws. They claim impermissible discrimination in that persons who commit a sex offense and are convicted after January 1, 1982, are not subject to an indefinite  potentially lifelong  civil commitment and are instead imprisoned for a fixed period of time under the determinate sentence law.
No significant constitutional problem is presented by the prospective repeal of the MDSO laws. (3) "A refusal to apply a statute retroactively does not violate the Fourteenth Amendment." (People v. Aranda (1965) 63 *669 Cal.2d 518, 532 [47 Cal. Rptr. 353, 407 P.2d 265].) "[T]he Fourteenth Amendment does not forbid statutes and statutory changes to have a beginning and thus to discriminate between the rights of an earlier and later time." (Sperry & Hutchinson Co. v. Rhodes (1911) 220 U.S. 502, 505 [55 L.Ed. 561, 563, 31 S.Ct. 490]; see also, Califano v. Webster (1977) 430 U.S. 314, 321 [51 L.Ed.2d 360, 367, 97 S.Ct. 1192].)
(2b) Legislation almost inevitably creates some disparities and the differential results which follow the termination of the MDSO program appear no different than those which inevitably accompany either the establishment or elimination of any statutory treatment program. (See Stickel v. Superior Court, supra, 136 Cal. App.3d 850, where the defendant sought the benefits of the repealed MDSO laws. The appellate court dealt with the ex post facto issue presented by the appeal; significantly, no equal protection claim was raised.)
To support their equal protection claim petitioners cite In re Kapperman (1974) 11 Cal.3d 542 [114 Cal. Rptr. 97, 522 P.2d 657], In re Thomson (1980) 104 Cal. App.3d 950 [164 Cal. Rptr. 99] and In re Morales (1981) 115 Cal. App.3d 456 [171 Cal. Rptr. 425]. Nothing in these cases suggests, however, that the equal protection clause prohibits the Legislature from creating or abolishing a treatment program prospectively. In our case, unlike in the cited decisions, there is no disparity in treatment among those individuals who were properly committed to the MDSO treatment program; all persons so committed are subject to the extension of their commitment under the procedures in effect on January 1, 1982. Contrary to defendant's contention  and a suggestion in dictum in Morales (115 Cal. App.3d at p. 461)  our decision in Kapperman does not stand for the broad proposition that equal protection principles require that all persons who commit the same offense receive the same punishment or treatment without regard to the date of their misconduct. Rather, in Kapperman, we were careful to point out that "[t]he Legislature properly may specify that ... statutes [lowering the punishment for a particular offense] are prospective only, to assure that penal laws will maintain their desired deterrent effect by carrying out the original prescribed punishment as written." (11 Cal.3d at p. 546.) Although the statute at issue here did not alter a penal statute, but instead drastically modified a treatment program, the Legislature clearly has no less power to provide for a continuation of the treatment of those committed to such a program under the conditions in effect before the phasing out of the program.
As we have seen, the Legislature decided in 1981 that the MDSO program was not sufficiently successful to warrant continuation; it therefore provided that no one convicted after the enactment became effective should be committed *670 to the MDSO program. As to those persons "other enactments ... would yield prison terms which would provide ... protection to society...." (Stats. 1981, ch. 928, § 3.)[7] At the same time, the Legislature decided that the program should not be ended for those persons already committed as MDSO's, apparently concluding that it would be inimical to the public safety simply to end the program altogether, resulting in the release of many still dangerous persons.
When the Legislature eliminated the MDSO program, petitioners had already been committed and were serving their initial term imposed pursuant to section 6316.1; they all faced the possibility of an extension if, at the end of the maximum term prescribed for the sex offense, they met the criteria of section 6316.2. The repeal of the MDSO law did not affect the commitment which had been imposed in lieu of criminal sanctions; the commitment did not become more onerous than it had been. Petitioners were and still are entitled to release when no longer dangerous regardless of the period of confinement for the analogous prison term now specified for the offenses. Stripped to its essentials, petitioners' claim challenges the basic validity of all prospective lawmaking.
For the foregoing reasons, the petitions for habeas corpus by Lamport and Couch are denied. The petition for writ of prohibition by Baker is denied and the alternative writ, previously issued, is discharged.
Bird, C.J., Mosk, J., Broussard, J., Reynoso, J., Grodin, J., and Richardson, J.,[*] concurred.
NOTES
[1]  Unless otherwise indicated, all statutory references are to the Welfare and Institutions Code.
[2]  As rewritten during 1982 (Stats. 1982, ch. 1549, § 4), section 1364 reveals the presently limited nature of the proposed experimental treatment program  it is voluntary, limited to "no more than 50 beds," and provides for treatment only during the last two years of incarceration. Section 1365 provides for termination of the program established pursuant to section 1364 on January 1, 1991.
[3]  Section 6316 originally provided for indeterminate commitment. With the advent of determinate sentencing and the imposition of fixed terms for most criminal offenses, section 6316.1 was enacted to provide that a person could not be committed as an MDSO for a period longer than the maximum time that could be imposed for the offense of which he was convicted. At the same time, section 6316.2 was enacted to permit commitment beyond the time prescribed by section 6316.1 where specified conditions were met, namely, that the underlying offense be a felony and that the MDSO suffer from a mental illness predisposing him to commission of sexual offenses to such a degree that he presents a substantial danger of bodily harm to others. The section also set out the procedures to be followed.
[4]  It is evident that the pronouncements contained in chapter 928 of the 1981 law concerning the exact impact of the legislation that was to take effect on January 1, 1982, are subject to different interpretations. The Attorney General was of the opinion that the new law did not affect persons whose criminal conduct preceded that date. (People v. Stickel (1982) 136 Cal. App.3d 850, 858, fn. 5 [186 Cal. Rptr. 560].) On the other hand, People v. Superior Court (Martin) (1982) 132 Cal. App.3d 658, 663-664 [183 Cal. Rptr. 563], and People v. Stickel, supra, 136 Cal. App.3d at pages 859-860, seemed to say that, to be unaffected by the new law, the violator had to be convicted before January 1, 1982. Finally, the statute and Stickel can be interpreted to apply only if the offender was convicted and actually committed as an MDSO before January 1, 1982: "The People contend that the Legislature intended to preserve the MDSO laws only to those persons actually committed before the effective date of the repeal of the MDSO laws, regardless of the date of the commission of their offenses. We agree." (Stickel, supra, 136 Cal. App.3d 850, 858.)

These nuances in interpretation in no way affect petitioners, who violated the law, were convicted, and were committed long before the critical date.
[5]  Legislative counsel analyzed the statute thus: "This bill would repeal the provisions relating to mentally disordered sex offender commitment procedures. The bill would also provide that the provisions of the bill shall not be construed to affect any person under commitment prior to the effective date of the bill." (Stats. 1981, ch. 928, italics added.)
[6]  Inasmuch as the People rely on Assembly Bill No. 3388 only for the limited purpose of aiding in determining the legislative intent in 1981, we do not address petitioners' contention that the assembly bill is constitutionally defective (Cal. Const., art. IV, § 9) insofar as it attempts to reenact section 6316.2. It must be remembered that No. 3388 did not control the extended commitments of these petitioners.
[7]  In the regular sessions of 1979-1980 and 1981-1982, the Legislature enacted sweeping changes in the law governing sex crimes. Chapter 944 (Stats. 1979, p. 3252) increased the determinate sentences for certain sex-related crimes; more significantly, it provided for mandatory prison sentences (Pen. Code, § 1203.065) and consecutive sentencing (Pen. Code, § 667.6). Additional enhancements for repeat offenders were permitted, and as to specified sex crimes, an unlimited number of certain enhancements may be imposed (Pen. Code, § 1170.1, subd. (h)). In addition, each enhancement must be fully and separately served and cannot be merged with any other term. (Pen. Code, § 1170.1, subd. (h).)

Concerned with the serious problem of sexual abuse of children, in the 1981-1982 session the Legislature focused on the crime of lewd and lascivious acts upon a child. It increased the prison sentence (Pen. Code, § 288) and the circumstances in which five-year sentence enhancements may be imposed (Pen. Code, § 667.51), it provided for indeterminate sentence under certain circumstances (Pen. Code, § 667.51) and it placed limitations on probation and suspended sentence (Pen. Code, §§ 1203.065, 1203.066). (Stats. 1981, ch. 1064, p. 4093.)
It is a matter of common knowledge that these chapters have triggered some of the longest prison sentences ever imposed.
[*]   Retired Associate Justice of the Supreme Court sitting under assignment by the Chairperson of the Judicial Council.
