
42 Cal.3d 565 (1986)
724 P.2d 482
229 Cal. Rptr. 796
THE PEOPLE, Plaintiff and Respondent,
v.
MARIO ALFONSO WATERMAN, Defendant and Appellant.
Docket No. Crim. 24808.
Supreme Court of California.
September 22, 1986.
*566 COUNSEL
A.P. Zmurkiewicz, under appointment by the Supreme Court, and Martha Schwartzmann, under appointment by the Court of Appeal, for Defendant and Appellant.
John K. Van de Kamp, Attorney General, Jay M. Bloom and Robert M. Foster, Deputy Attorneys General, for Plaintiff and Respondent.
*567 OPINION
GRODIN, J.
At the People's request, we granted review of this case as a companion to In re Huffman, ante, at page 552 [229 Cal. Rptr. 796, 724 P.2d 482]. In Huffman, we found no equal protection violation in the fact that persons committed for treatment as mentally disordered sex offenders (MDSOs), unlike addicted offenders committed to the California Rehabilitation Center (CRC), are denied "conduct" and "participation" credits while in the treatment facility which would reduce their maximum periods of confinement or incarceration. Appellant in this case makes a similar equal protection claim on behalf of persons confined for pretrial treatment as incompetent to stand trial. The Court of Appeal accepted appellant's contention and ordered his sentence reduced accordingly.
As in Huffman, however, we conclude that the equal protection argument lacks merit. We will therefore reverse the Court of Appeal's judgment insofar as it reduces appellant's prison sentence.

FACTS AND PROCEDURAL HISTORY
On July 26, 1983, appellant created a disturbance at his Oceanside apartment building. Two police officers arrived and identified themselves. Appellant responded with obscenities and gunfire, then retreated into his apartment. In telephone negotiations, he demanded a helicopter to Peru. He was arrested when coaxed outside by an officer posing as a helicopter pilot.
In September 1983, the superior court found appellant incompetent to stand trial and committed him to Patton State Hospital. He returned from the hospital in May 1984. In September 1984, he pled guilty to two counts of assault with a deadly weapon (ADW) on a police officer (Pen. Code, § 245, subd. (b)); by agreement two counts of attempted murder were dropped. On October 26, 1984, appellant received the middle term of four years on each ADW count, the sentences to run concurrently. The sentence also included two-year concurrent enhancements for firearm use (id., § 12022.5), for a total term of six years, less his actual time in presentence confinement.
At a separate hearing on November 2, 1984, appellant urged he was further entitled to hospital conduct and participation credits, but the trial court denied his claim. The Court of Appeal affirmed the judgment of conviction, but directed the trial court to modify the judgment to grant the credits sought.


*568 DISCUSSION
If, prior to judgment in a criminal case, the court finds the defendant unable, because of mental disorder, to understand the proceedings or assist rationally in his defense, it must suspend the criminal process and commit him for treatment designed to restore his competence. (Pen. Code, §§ 1367-1370.) The statute requires periodic progress reports and hearings. (Id., § 1370, subd. (b).) Whenever competence is restored, the criminal proceedings resume. (Id., subd. (a)(1).) If the accused is then convicted, he is entitled to credit against his sentence for all time spent under the pretrial commitment. (Id., § 1375.5.)
If still committed, the defendant must be returned to court after (1) three years or (2) the maximum period of imprisonment for the most serious charged offense (id., § 1370, subd. (c)(1)), or when the director of the treatment facility sooner determines that restoration to competence is unlikely. (Id., subd. (b)(1).) If it then appears the accused is "gravely disabled" under the Lanterman-Petris-Short Act (LPS Act) (Welf. & Inst. Code, § 5000 et seq.) because he remains incompetent for trial, is charged by an undismissed indictment or information with a violent felony, and is still dangerous (id., § 5008, subd. (h)(2); Conservatorship of Hofferber (1980) 28 Cal.3d 161, 176-177 [167 Cal. Rptr. 854, 616 P.2d 836]), the court must order the commencement of LPS Act conservatorship proceedings (Welf. & Inst. Code, § 5350 et seq.). (1) On the other hand, if the defendant remains incompetent but is not a dangerous accused violent felon, the court must release him from confinement. (Hofferber, supra, 28 Cal.3d at pp. 168-169; see Jackson v. Indiana (1972) 406 U.S. 715, 730-738 [32 L.Ed.2d 435, 446-451, 92 S.Ct. 1845]; In re Davis (1973) 8 Cal.3d 798, 807 [106 Cal. Rptr. 178, 505 P.2d 1018].)[1]
(2a) As noted, appellant was judged incompetent and committed to a state hospital, but he later recovered competence and was tried, convicted, and sentenced. At both the trial and appellate levels, he argued that his prison sentence, already shortened by the actual period of his pretrial hospital *569 commitment, should be further reduced by credit for his good behavior (see Pen. Code, § 2930 et seq.) in the hospital. The criminal-incompetence statute does not expressly allow such conduct credit. However, as in Huffman, ante, at page 558, the entitlement is said to arise on equal protection grounds, since offenders committed for narcotics addiction to the California Rehabilitation Center (CRC) (Welf. & Inst. Code, §§ 3050, 3051) receive such credits against both their hospital confinement time and any subsequent prison term. (Id., § 3201, subd. (c); People v. Talton (1983) 145 Cal. App.3d 729, 730-731 [193 Cal. Rptr. 660]; In re Martin (1981) 125 Cal. App.3d 896, 902 [178 Cal. Rptr. 445]; In re Morales (1981) 115 Cal. App.3d 456, 460-461 [171 Cal. Rptr. 425].)
We find no equal protection violation. In Huffman, we held that the distinction between the MDSO and CRC programs with respect to conduct credits survives strict scrutiny. We noted the compelling state interest in separate, more cautious treatment of MDSOs who, unlike CRC patients, have been found to harbor dangerous mental disorders. We found the Legislature could properly decide that the therapeutic needs of dangerous, mentally disordered persons would not be served by reducing confinement time on the basis of mere good behavior and participation inside the institution. (Ante, at p. 557; see People v. Saffell (1979) 25 Cal.3d 223, 231-234 [157 Cal. Rptr. 897, 599 P.2d 92].)
Of course, persons committed for incompetence to stand trial have not been found dangerous. Nonetheless, we conclude that the substantial disparities between the treatment goals for incompetents and CRC patients amply justify the credit distinctions drawn by the Legislature.
Appellant's equal protection claim, like Huffman's, rests on superficial procedural similarities between the program under which he suffered preprison confinement and the CRC program. As he notes, both the CRC and incompetence programs divert persons from the criminal-justice "mainstream" for confined treatment outside the penal system. Both gear the maximum confinement for treatment to the actual or potential prison sentence for the underlying criminal offenses. Both allow credit against any subsequent prison sentence for actual time spent in the treatment facility.
Yet the purposes of the two programs, and the status of their participants, are entirely different. CRC affords postconviction rehabilitative treatment related to a finding of criminal conduct. The incompetence program, on the other hand, is a special form of pretrial detention not at all concerned with criminal rehabilitation; its purpose is restoration of a specific mental state without which the criminal process cannot proceed.
*570 The Courts of Appeal have suggested that the state's compelling interest in postconviction criminal rehabilitation, and the difficulties in establishing prison-style work-credit programs in pretrial detention, are compelling interests which justify disparate conduct-credit treatment of pre- and post-trial detention time. (People v. Poole (1985) 168 Cal. App.3d 516, 525-526 [214 Cal. Rptr. 502]; People v. Ross (1985) 165 Cal. App.3d 368, 377-378 [211 Cal. Rptr. 595]; People v. Valladares (1984) 162 Cal. App.3d 312, 320-321 [208 Cal. Rptr. 604]; People v. Caruso (1984) 161 Cal. App.3d 13, 19-21 [207 Cal. Rptr. 221].)
Moreover, even though a commitment for criminal incompetence does not involve a finding of dangerousness, the state, we conclude, has a special, compelling interest in the confinement for treatment of criminal incompetents. Like MDSOs but unlike CRC committees, they have been found to harbor a "mental disorder" or defect. This condition precludes them from comprehending or assisting in the criminal proceedings. (Pen. Code, § 1367.) Unless restored to competence, they cannot be tried (ibid.), and the criminal justice system will be frustrated. As with other mentally disordered committees, the Legislature may decide that important therapeutic goals are not served by a conduct-credit system, even if nondisordered addict-offenders may earn such credits during their CRC confinement.[2]
The goal of treatment for incompetence seems particularly inconsistent with an incentive-credit system during therapy. The purpose of confinement is to restore the mental ability to stand trial. As with MDSOs, that goal would be hindered if mere institutional good behavior and participation automatically reduced the therapy period. (See Saffell, supra, 25 Cal.3d at pp. 232-234.)[3]
Here, as in Huffman, appellant does not seek credit against his maximum hospital confinement, but against the prison term he received once he was *571 restored to competence, tried, and convicted. But, as in Huffman, we see no reason why hospital credits must be recognized in the latter context when they are not in the former. The hospital confinement and the prison term involve different settings and purposes; the subsequent prison term does not alter the fact that the incompetence confinement was a pretrial detention for treatment. Indeed, if hospital participation credits were applied only against a subsequent prison term, persons never restored to competency before their maximum periods of hospital commitment, and thus never tried on criminal charges, would be confined longer than those initially committed but later convicted and sentenced.
(3) (See fn. 4.), (2b) We therefore hold that persons confined for hospital treatment as incompetent to stand trial are not denied equal protection of the laws to the extent that they, unlike offenders committed to CRC for treatment of drug addiction, cannot earn conduct and participation credits against subsequent prison sentences.[4]
The judgment of the Court of Appeal is reversed insofar as it orders modification of appellant's prison sentence; in all other respects, the judgment is affirmed.
Mosk, J., Broussard, J., Reynoso, J., Lucas, J., and Panelli, J., concurred.
Bird, C.J., concurred in the judgment.
Appellant's petition for a rehearing was denied October 22, 1986, and the opinion was modified to read as printed above.
NOTES
[1]  When a defendant is returned to court as unlikely to recover competence, or as still incompetent after maximum confinement, the court may dismiss the charges in the interest of justice. (Pen. Code, §§ 1370, subd. (d), 1385.) If it does so, defendant must be released from confinement without prejudice to institution of any short-term LPS Act civil commitment proceedings for dangerousness. (Id., § 1370, subd. (e).) But the dismissal would preclude a long-term, renewable LPS Act conservatorship based on dangerous criminal incompetence, since nondismissal of the criminal charges is a prerequisite to that form of commitment. (Welf. & Inst. Code, § 5008, subd. (h)(2).) The only other long-term civil commitment possibility would be the standard LPS Act conservatorship for persons who, because of chronic alcoholism or mental disorder, are unable to provide for their food, clothing, and shelter. (Id., subd. (h); see Hofferber, supra, 28 Cal.3d at p. 172.)
[2]  As one whose crime was committed after January 1, 1983, Waterman is subject to the revised "worktime credit" program adopted by the 1982 Legislature. The new program is narrowly focused, and, as noted in Huffman (ante, at p. 562, fn. 7), its goals are far removed from the realm of psychiatric healing.
[3]  An incentive-credit system may be even less compatible with treatment of criminal incompetents than with MDSO therapy. As the People point out, persons so ill that they cannot understand or assist trial proceedings may often be so disoriented that they are incapable of responding to credit incentives. Moreover, the law subjects certain dangerous persons to extended commitments under the LPS Act at the conclusion of their maximum initial commitments for incompetence, if they remain incompetent and are found dangerous. (Pen. Code, § 1370, subd. (c)(2); Welf. & Inst. Code, § 5008, subd. (h).) Allowance of hospital conduct credits to these dangerous incompetents might force premature resort to the extended-commitment procedures. (Saffell, supra, 25 Cal.3d at pp. 231-232.)
[4]  Because pretrial confinement for treatment of incompetence is so different from other forms of pretrial detention, we are also convinced that equal protection principles do not require that Waterman receive, while confined for treatment, the benefit of the limited work-and-conduct-credit system available to persons confined in jail prior to trial. (Pen. Code, §§ 2900.5, subd. (a), 4019; cf., People v. Sage (1980) 26 Cal.3d 498, 506-508 [165 Cal. Rptr. 280, 611 P.2d 874].)
