
26 Cal.3d 498 (1980)
611 P.2d 874
165 Cal. Rptr. 280
THE PEOPLE, Plaintiff and Respondent,
v.
DAVID SAGE, Defendant and Appellant.
Docket No. Crim. 20997.
Supreme Court of California.
February 19, 1980.
*500 COUNSEL
Quin Denvir, State Public Defender, under appointment by the Court of Appeal, Charles M. Sevilla, Chief Assistant State Public Defender, *501 Paul D. Fogel, Michael S. McCormick and Richard Lennon, Deputy State Public Defenders, for Defendant and Appellant.
George Deukmejian, Attorney General, Robert H. Philibosian, Jack R. Winkler, Chief Assistant Attorneys General, Daniel J. Kremer, Assistant Attorney General, Gary W. Schons, Harley D. Mayfield and Alan S. Meth, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
THE COURT.
Defendant pleaded guilty to false imprisonment with violence or menace. (Pen. Code, §§ 236, 237.)[1] Criminal proceedings were suspended and he was committed to a state hospital for treatment as a mentally disordered sex offender (MDSO) pursuant to Welfare and Institutions Code section 6316. Nine months later, defendant was found to be not amenable to further treatment (Welf. & Inst. Code, § 6325) and was returned to the committing court. Criminal proceedings were resumed and defendant was sentenced to state prison. He received credit against the sentence for 327 days spent in actual confinement in either the state hospital or the county jail.[2] (§ 2900.5.) He appeals from the judgment, i.e., the sentence, contending that the deductions from his term for presentence confinement should have included credits for both work performance and good behavior, which we shall refer to collectively as "conduct" credit.
In asserting a right to presentence conduct credit, defendant relies primarily upon section 4019. His reliance is misplaced. Defendant is not entitled to conduct credit under section 4019 for the period of his treatment *502 as an MDSO because the section does not authorize credit for time in such nonpenal institutions as state hospitals. Nor does the section entitle defendant to credit for his presentence jail time. Such credit is authorized under the section only for misdemeanants.
In the alternative, defendant bases his claim for presentence conduct credit upon section 2931. Again his reliance is misplaced. Section 2931 applies only to conduct credit earned while in prison. Finally, assuming arguendo that his claim is not supported by any statutory authority, defendant contends he is thereby denied equal protection of the laws.
While we uphold the Legislature's refusal to allow presentence conduct credit for time served under an MDSO commitment, we conclude defendant's equal protection claim is meritorious as it relates to presentence jail time.

Sections 2900.5 and 4019
Under section 2900.5 a defendant receives credit toward his term of imprisonment for time in custody prior to commencement of sentence. Subdivision (a) of that section provides in pertinent part: "In all felony and misdemeanor convictions ... when the defendant has been in custody ... all days of custody ... including days served as a condition of probation in compliance with a court order, and including days credited to the period of confinement pursuant to section 4019, shall be credited upon his term of imprisonment...." (Italics added.)
(1a) Section 4019 authorizes good behavior and work performance credit for certain prisoners confined in city or county jails, industrial farms or road camps.[3] It does not authorize conduct credit for time in *503 nonpenal institutions such as state hospitals or the California Rehabilitation Center. Therefore, defendant is clearly not entitled to such credit under section 4019 for the period of his confinement as an MDSO.[4] The question remains whether the section authorizes conduct credit for precommitment jail time in the circumstances of this case.
The credit provisions of section 4019 apply to three types of commitments. Subsection (1) of subdivision (a) deals with a term under a judgment of imprisonment, while subsection (2) concerns a term served as a condition of probation, and subsection (3) applies to a "definite" term of confinement for contempt.
Defendant does not contend that either subsection (2) or subsection (3) of subdivision (a) is applicable here.
*504 Our focus, therefore, is on subsection (1) of subdivision (a) which states: "The provisions of this section shall apply in all of the following cases: [¶] (1) When a prisoner is confined in or committed to a county jail, industrial farm, or road camp, or any city jail, industrial farm, or road camp, including all days of custody from the date of arrest to the date on which the serving of the sentence commences, under a judgment of imprisonment, or a fine and imprisonment until the fine is paid in a criminal action or proceeding."
The last clause of subsection (1) "under a judgment of imprisonment ..." modifies the introductory clause "When a prisoner is confined or committed ..." This parallels the structure of subsections (2) and (3), both of which begin with the same introductory clause as subsection (1) but close with the qualifiers "as a condition of probation ..." and "for a definite period of time for contempt ..." respectively.
With exceptions not applicable here, a prisoner is confined in jail "under a judgment of imprisonment" only when sentenced in a misdemeanor proceeding. (See In re Haines (1925) 195 Cal. 605, 617 [234 P. 883].) (2a) A felon confined in jail awaiting trial, as was defendant, does not, therefore, come within the language of the statute.

Section 2931
In the alternative, defendant relies on section 2931.[5] In contending section 2931 authorizes the Department of Corrections to reduce a prisoner's term by applying presentence conduct credits, defendant focuses on the following language in subdivision (a) of that section: "... the Department of Corrections shall have the authority to reduce the term prescribed under such section by one-third for good behavior and participation consistent with subdivision (d) of Section 1170.2...." Defendant argues there is no indication in section 2931 that "term" as used therein excludes the period of presentence detention.
*505 While "term" is not expressly so limited in section 2931, section 2900 provides: "The term of imprisonment fixed by the judgment in a criminal action commences to run only upon actual delivery of the defendant *506 into the custody of the Director of Corrections at the place designated by the Director of Corrections as a place for the reception of persons convicted of felonies...." In light of section 2900, it is readily apparent that "term" as used in section 2931 refers to time in prison subsequent to conviction.
Moreover, defendant overlooks language in sections 2930, 2931 and 2932 clearly indicating that the Legislature contemplated the credits governed by these sections would be earned in prison. Section 2930 requires that an inmate be advised within 14 days of his reception in prison of the possibility of receiving credits, and be advised within 14 days of his arrival at the prison to which he is ultimately assigned of the programs offered there. Section 2931 provides in subdivision (a) that the inmate be given a document signed by a prison official at the time of compliance with section 2930 "outlining the conditions which the inmate shall meet to receive the credit," and provides in subdivision (c) that one-fourth of the possible credit "shall be based solely upon participation in work, educational, vocational, therapeutic or other prison activities." Subdivision (b) of section 2931 limits credit to four months for each eight months served "in prison." Section 2932, subdivision (a), sets forth the procedure to be followed whenever the Department of Corrections seeks to deny credit because of misbehavior or failure to participate. That the department could not follow this procedure with regard to incidents occurring during presentence confinement in county jail is another indication that section 2931 does not grant credit for such periods.

Equal Protection
(1b) Regarding the period of his treatment as an MDSO, defendant's equal protection claim is foreclosed by our recent decision in People v. Saffell (1979) 25 Cal.3d 223, 233-235 [157 Cal. Rptr. 897, 599 P.2d 92], in which, applying the compelling state interest test, we held that an MDSO is not denied equal protection of the laws because he cannot earn the conduct credit available to inmates of correctional *507 facilities. The question remains whether defendant is denied equal protection of the laws insofar as he is denied conduct credit for presentence jail time.
(2b) Under section 4019, a pretrial detainee eventually convicted of a misdemeanor and sentenced to county jail, hereinafter referred to as a "detainee/misdemeanant," receives conduct credit against that sentence for his presentence jail time. Under section 2931, a defendant who makes bail or is released on his own recognizance, then is tried, convicted of a felony and sentenced to state prison receives conduct credit against his full sentence. Only the presentence detainee eventually sentenced to prison, the "detainee/felon," does not receive conduct credit against his full sentence, because he is denied conduct credit for his presentence confinement. It is the distinction between the detainee/felon and the felon who serves no presentence time that raises equal protection problems.
In their petition for hearing the People seek to justify this distinction on three grounds: "First, pretrial detainees are presumed innocent, and as this Court observed, `[T]he state [cannot] presume to rehabilitate persons clothed in the presumption of innocence.' [Citing People v. Olivas (1976) 17 Cal.3d 236, 247, fn. 15 (131 Cal. Rptr. 55, 551 P.2d 375).] [¶] Second, pretrial detainees have matters to occupy head and hand which convicted offenders do not. Detainees are necessarily occupied with personally preparing for trial [citation] or assisting counsel and in actually attending proceedings in court. Convicted prisoners, who have passed through the system and have a fixed period to serve, literally have little better to do than chalk the passing days off the wall. [¶] Finally, and most importantly, detainees, facing trial, conviction and sentence, are obviously motivated to conduct themselves properly while in custody since this conduct will most likely be considered by the court in fashioning and imposing sentence...."
Each of the grounds advanced by the People for denying presentence conduct credit to detainee/felons might also be given for denying such *508 credit to detainee/misdemeanants as well. Yet detainee/misdemeanants are clearly entitled to such credit under section 4019. The inescapable conclusion is that the challenged distinction  between detainee/felons and felons who serve no presentence time  was not based on the grounds proposed. Accordingly, we will not further analyze these grounds.
In conclusion, the People have not suggested, nor has our independent research revealed, a rational basis for, much less a compelling state interest in, denying presentence conduct credit to detainee/felons.[6] Defendant is therefore entitled to conduct credit, if earned, in addition to the custody credit he has already received for the 52 or 57 days during which he was detained in the county jail prior to his commitment to prison.
Penal Code section 2900.5 imposes on the sentencing court the obligation to determine the number of days of custody and, in those cases *509 to which it expressly applies, conduct credit to which the defendant is entitled, and to enter the credits on the abstract of judgment. It is therefore appropriate to have the trial court make that determination pursuant to section 2900.5 for all defendants in the future. Inasmuch as such computations are made routinely by the jail administrator for misdemeanants, probationers, and other prisoners to whom the section applies, that officer can readily provide the court with the necessary computation and/or records. Any dispute over the right to credit, the number of days of credit, or the judgment or judgments to which the credits are applicable can then be resolved at the probation and sentence hearing. It is unnecessary, however, to remand this defendant and others who have already been sentenced for new sentencing proceedings to determine the additional credit to which they may be entitled. The Department of Corrections should make available to such prisoners an administrative procedure by which to ascertain their entitlement to conduct credit. (Cf. In re Kapperman (1974) 11 Cal.3d 542, 550, fn. 10 [114 Cal. Rptr. 97, 522 P.2d 657].) (3) (See fn. 7.) As the department already has in its possession a copy of the abstract of judgment awarding custody credit, computation of the additional conduct credit should be a routine ministerial function.[7]
The judgment is affirmed.
*510 CLARK, J., Concurring and Dissenting.
I concur in the judgment and opinion of the court except insofar as the rule announced today is given retroactive effect. The purpose of conduct credit is to foster good behavior and satisfactory work performance. (People v. Saffell (1979) 25 Cal.3d 223, 233 [157 Cal. Rptr. 897, 599 P.2d 92].) That purpose will not be served by granting such credit retroactively.
Richardson, J., and Manuel, J., concurred.
BIRD, C.J., Concurring and Dissenting.
I must respectfully dissent from that portion of the majority opinion which endorses the government's unequal handling of similarly situated individuals. The majority find there is no violation of the equal protection clause of the Constitution even though some mentally disordered prisoners are given credit for time served in state hospital custody and others are not.
Under the California Administrative and Penal Codes a "mentally ill, mentally deficient, or insane" prison inmate, who is transferred from prison to a state mental hospital for treatment, is eligible for behavior and participation credits for that portion of his term that is spent in a hospital.[1] Any prison inmate transferred under this procedure may be *511 sent to the same hospital to which appellant was committed[2] and may be required to participate in the same treatment program. Despite these similarities, appellant is denied participation and behavior credits while a similarly situated prison inmate is not.
Further, a "mentally disordered" person, who is in a county or city jail, is entitled to behavior and participation credits for time spent in an inpatient facility under the Lanterman-Petris-Short Act. (Pen. Code, § 4011.6.)[3] The majority ignore these facts and hold that an individual, adjudged a mentally disordered sex offender (MDSO), cannot receive participation and behavior credits for any time spent in a state hospital prior to being sentenced and transferred to a state prison.
Citing People v. Saffell (1979) 25 Cal.3d 223 at pages 233 through 235 [157 Cal. Rptr. 897, 599 P.2d 92], the majority claim they are "foreclosed" from dealing with these similarly situated individuals in the same fashion. However, Saffell is inapposite for it involved a state hospital patient found amenable to treatment while this case involves a state prison inmate found not amenable to treatment. Further, Mr. Saffell sought to apply behavior and participation credits to reduce his term of confinement in the hospital. Mr. Sage does not seek a reduction *512 in the time he had to spend in the hospital. He served his full term of hospital confinement and merely seeks to have the time he spent in the hospital fully credited to the remainder of his term in state prison. The discrimination here is not between MDSOs committed to state hospitals and inmates committed to state prison, but between inmates incarcerated in state prisons who have spent presentence time in state hospitals as MDSOs, and other mentally disordered inmates who have spent time in state hospitals or similar facilities during their terms of incarceration.
In Saffell, this court held that the length of an MDSO's initial commitment period was justified by "a dual compelling state interest in providing effective treatment for those disposed to the commission of [sex offenses] while, at the same time, assuring the safety of the public." (People v. Saffell, supra, 25 Cal.3d at pp. 232-233.) In particular, "the compelling state interest ... [in] the effective treatment of MDSOs" justified the legislative determination not to apply behavior and participation credits to MDSO commitments. (Id., at p. 235.) However, that rationale does not apply to an MDSO, who is not amenable to treatment, is incarcerated in a state prison, and seeks reduction of his prison sentence.
The state can have no interest in the "treatment" of such a person since he is not amenable. The court in Saffell recognized this fact since it stated that "commitment as an MDSO is primarily for treatment," for the law "contemplates that the only MDSOs who may be confined for the `maximum term of confinement' [i.e., the longest term of imprisonment with no behavior and participation credits] are those whom the court finds `could benefit by treatment in a state hospital or other mental health facility....' (§ 6316, italics added.) The individual who is determined to be an MDSO but who is not amenable to treatment is to be returned to the criminal court for disposition of the charges against him." (Id., at p. 229.)
This court in Saffell recognized that "`[n]ot only is medical treatment the raison d'etre of the mentally disordered sex offender law, it is *513 its sole constitutional justification.'" (Id., at p. 229, quoting from People v. Feagley (1975) 14 Cal.3d 338, 359 [121 Cal. Rptr. 509, 535 P.2d 373], italics added.) When the state cannot treat the individual, its asserted interest is "stripped away," and "nothing remains but bare incarceration `for the protection of society.'" (People v. Feagley, supra, 14 Cal.3d at p. 373.) Feagley teaches us that this interest, by itself, does not justify unequal handling of the MDSO who is not amenable to treatment. "[I]nasmuch as a well-known purpose of punishment is `to confine the offender so that he may not harm society' [citation omitted], we must presume that the term of imprisonment prescribed by the Legislature for the underlying crime committed by ... a mentally disordered sex offender [found not amenable to treatment and sentenced by the court] is adequate to protect society against a potential recurrence of his conduct." (Id., at p. 376.)
Other mentally disordered inmates are not denied behavior and participation credits against their prison terms for postsentence time served in mental institutions. (Pen. Code, §§ 2684, 2685.) What compelling interest justifies such a distinction between presentence and postsentence time spent in state hospitals? Even prisoners in the county jail are statutorily entitled to behavior and participation credits for presentence time spent in mental health facilities under the Lanterman-Petris-Short Act. (Pen. Code, §§ 2900.5, 4019, 4011.6.) What possible justification is there for this disparity of treatment between inmates of the county jail and those in state prison?
What possible compelling state interest is there in giving special inducement to MDSOs transferred from state prison to a state hospital to behave, while withholding the same inducement from MDSOs transferred from a state hospital to a state prison? What possible compelling reason is there to grant participation credits to state prison inmates who are mentally unable to participate in specially designed "participation" programs, and to deny the same credits to MDSOs confined in state hospitals? Saffell does not provide the answers to these questions.
It is clear that there are no compelling state interests which would justify the disparate treatment of mentally disordered individuals who *514 are in custody. Therefore, the denial to a state prison inmate of behavior and participation credits for time served in a state hospital as an MDSO prior to his sentence to state prison violates the equal protection clause of the Constitution.
NEWMAN, J., Concurring and Dissenting.
I concur in the Chief Justice's opinion, except that, as I indicated in People v. Saffel (1979) 25 Cal.3d 223, 235 [157 Cal. Rptr. 897, 599 P.2d 92] (dis. opn.), I believe that the same credit is appropriate for those who are and are not amenable to treatment.
Respondent's petition for a rehearing was denied April 30, 1980, and the opinion was modified to read as printed above. Appellant's petition for a rehearing was denied June 4, 1980. Bird, C.J., was of the opinion that the petitions should be granted.
NOTES
[1]  Statutory references are to sections of the Penal Code unless otherwise specified.
[2]  According to defendant, 270 of the 327 days were spent in the state hospital and the remaining 57 days in the county jail. According to the People, defendant spent 275 days in the hospital and 52 days in jail.
[3]  Section 4019 provides: "(a) The provisions of this section shall apply in all of the following cases: [¶] (1) When a prisoner is confined in or committed to a county jail, industrial farm, or road camp, or any city jail, industrial farm, or road camp, including all days of custody from the date of arrest to the date on which the serving of the sentence commences, under a judgment of imprisonment, or a fine and imprisonment until the fine is paid in a criminal action or proceeding. [¶] (2) When a prisoner is confined in or committed to the county jail, industrial farm, or road camp or any city jail, industrial farm, or road camp as a condition of probation after suspension of imposition of a sentence or suspension of execution of sentence, in a criminal action or proceeding. [¶] (3) When a prisoner is confined in or committed to the county jail, industrial farm, or road camp or any city jail, industrial farm, or road camp for a definite period of time for contempt pursuant to a proceeding, other than a criminal action or proceeding. [¶] (b) Subject to the provisions of subdivision (d), for each six-day period in which a prisoner is committed to a facility as specified in this section, one day shall be deducted from his period of confinement unless it appears by the record that the prisoner has refused to satisfactorily perform labor as assigned by the sheriff, chief of police, or superintendent of an industrial farm or road camp. [¶] (c) For each six-day period in which a prisoner is committed to a facility as specified in this section, one day shall be deducted from his period of confinement unless it appears by the record that the prisoner has not satisfactorily complied with the reasonable rules and regulations established by the sheriff, chief of police, or superintendent of an industrial farm or road camp. [¶] (d) Nothing in this section shall be construed to require the sheriff, chief of police, or superintendent of an industrial farm or road camp to assign labor to a prisoner if it appears from the record that the prisoner has refused to satisfactorily perform labor as assigned or that the prisoner has not satisfactorily complied with the reasonable rules and regulations of the sheriff, chief of police, or superintendent of any industrial farm or road camp. [¶] (e) No deduction may be made under this section unless the person is committed for a period of six days or longer."
[4]  See also Welfare and Institutions Code section 6316.1, subdivision (a), providing that an MDSO's maximum term of confinement is not to be reduced by conduct credit.
[5]  Section 2931 provides: "(a) In any case in which an inmate was sentenced to the state prison pursuant to Section 1170, or if he committed a felony before July 1, 1977, and he would have been sentenced under section 1170 if the felony had been committed after July 1, 1977, the Department of Corrections shall have the authority to reduce the term prescribed under such section by one-third for good behavior and participation consistent with subdivision (d) of Section 1170.2. A document shall be signed by a prison official and given to the inmate, at the time of compliance with Section 2930, outlining the conditions which the inmate shall meet to receive the credit. The conditions specified in such document may be modified upon any of the following: [¶] (1) Mutual consent of the prisoner and the Department of Corrections. [¶] (2) The transfer of the inmate from one institution to another. [¶] (3) The department's determination of the prisoner's lack of adaptability or success in a specific program or assignment. In such case the inmate shall be entitled to a hearing regarding the department's decision. [¶] (4) A change in custodial status. [¶] (b) Total possible good behavior and participation credit shall result in a four-month reduction for each eight months served in prison or in a reduction based on this ratio for any lesser period of time. Three months of this four-month reduction, or a reduction based on this ratio for any lesser period, shall be based upon forbearance from any or all of the following activities: [¶] (1) Assault with a weapon; or escape. [¶] (2) Physically assaultive behavior; possession of a weapon without permission; possession of controlled substances without prescription; attempt to escape; or urging others, with the intent to cause a riot, to commit acts of force or violence, at a time and place under circumstances which produce a clear and present and immediate danger of a riot which results in acts of force or violence. [¶] (3) Intentional destruction of state property valued in excess of fifty dollars ($50); falsification of a significant record or document; possession of escape tools without permission; or manufacture, sale or unauthorized possession or use of alcoholic beverages or any substance defined as a poison in Schedule D of Section 4160 of the Business and Professions Code; or urging of others by words or acts, with the intent to cause a riot, to commit acts of force or violence at a time and place under circumstances which present a clear and present and immediate danger of a riot or committing any act, with the intent to precipitate a riot, at a time and place under circumstances which present a clear and present and immediate danger of a riot. Activities specified in paragraph (1) may result in a maximum denial of good behavior credit of 45 days for each such prohibited activity. Activities specified in paragraph (2) may result in a maximum denial of good behavior credit of 30 days for each such prohibited activity. Activities specified in paragragh (3) may result in a maximum denial of good behavior credit of 15 days for each such prohibited activity. Nothing in this section shall prevent the Department of Corrections from seeking criminal prosecution for violations of law. [¶] (c) One of the four months reduction, or a formula based on this ratio for a lesser period, shall be based solely upon participation in work, educational, vocational, therapeutic or other prison activities. Failure to succeed after demonstrating a reasonable effort in the specified activity shall not result in loss of participation credit. Failure to participate in the specified activities can result in a maximum loss of credit of 30 days for each failure to participate. However, those confined either by choice or due to behavior problems shall be given specified activities commensurate with the custodial status."
[6]  McGinnis v. Royster (1973) 410 U.S. 263 [35 L.Ed.2d 282, 93 S.Ct. 1055] is not inconsistent with our conclusion. McGinnis concerned the constitutionality of a New York statute denying detainee/felons conduct credit toward their minimum eligible parole dates. The appellees in McGinnis made much the same argument as does defendant. Upholding the statute, the high court reasoned that since there was no systematic rehabilitative program in county jails in New York, and rehabilitation as well as discipline was a goal of the conduct credit allowance, it was reasonable to deny credit for time during which the prisoner had not been under the rehabilitative guidance and observation of the prison officials charged with the parole determination. The court upheld the statute even assuming that discipline, not rehabilitation, was the primary purpose of the credit system, stating: "the challenged classification here rationally promotes the legitimate desire of the state legislature to afford state prison officials an adequate opportunity to evaluate both an inmate's conduct and his rehabilitative progress before he is eligible for parole...." (410 U.S. at p. 277 [35 L.Ed.2d at pp. 292-293].)

McGinnis is distinguishable on the ground that in California, unlike New York, conduct credit is not related to a discretionary grant of parole. Moreover, our Legislature has determined that conduct credit is to be awarded for some jail time served prior to commitment to prison, namely, time served as a condition of probation, regardless of whether jail rehabilitation programs are less adequate than those in state prison. However, the most significant ground upon which McGinnis should be distinguished is that the high court reviewed the equal protection claim in that case under the rational basis standard, whereas this court in Saffell applied the compelling state interest test. There is no reason to believe the high court would have upheld the New York statute had it applied the stricter standard.
[7]  Inasmuch as the same equal protection concerns as those underlying this court's decision in In re Kapperman, supra, 11 Cal.3d 542, i.e., the avoidance of arbitrary classification of prisoners, are present in the award of jail conduct credits, our holding that such credits must be awarded, if earned, for all precommitment jail time is retroactive. However, felons sentenced to prison terms under the Indeterminate Sentence Law after January 1, 1948, were not entitled to credits (form. § 2926; Stats. 1947, ch. 1381, § 2, p. 2945), the Legislature having determined that such credits were inconsistent with the theory of that law. The right of prison inmates to earn conduct credits was restored as part of the determinate sentence law, operative July 1, 1977, and persons then in prison could earn conduct credits only from and after that date. (§§ 1170.2, subd. (d); 2930-2931.) Therefore Kapperman does not require that these credits be awarded for jail time prior to July 1, 1977.

The apparent purpose of the 1978 amendment to section 2900.5 extending the right to conduct credit to felons confined in jail was elimination of the disparity in total time served by those prisoners who, because part of their custody was in presentence jail detention, could not earn conduct credit to reduce their full term. That purpose would not be served by granting such credits for periods of jail custody prior to the operative date of the determinate sentence law upon which prison inmates became entitled to similar credits. Accordingly, we hold that under this opinion credits shall be provided only with respect to time in custody on or after July 1, 1977.
[1]  In practice, a state prison inmate is given credit for good behavior shortly after his arrival at prison. He forfeits these credits only if he commits specifically enumerated acts of misbehavior. (Cal. Admin. Code, tit. 15, §§ 3005, subd. (c), 3323.) There is no provision for forfeiture of behavior credits for transfer to a state hospital. Further, every inmate is given credit for participating in a work, vocational, therapeutic, or educational program. (Cal. Admin. Code, tit. 15, §§ 3040, subd. (c), 3042.) These credits are forfeited if an inmate refuses or fails to participate. (Cal. Admin. Code, tit. 15, § 3043, subd. (a).) Participation credits, however, are not forfeited if failure to participate is due to "reasons which are beyond the inmate's control." This would include "mental inability to participate." (Cal. Admin. Code, tit. 15, § 3043, subd. (c)(3).)

These credits for participation and good behavior are authorized by Penal Code section 2685, which provides that "[t]he time passed at the state hospital" by a prison inmate "shall count as part of the prisoner's sentence." Under this statute, the prisoner is entitled to receive as much credit for time spent in the hospital as he would have earned if he had remained within the prison itself. (24 Ops.Cal.Atty.Gen. 3 (1954).) Section 2685 has been interpreted to permit credit for behavior and participation credits for time spent by the prisoner while in a hospital. (Ibid.)
[2]  Appellant was committed to Patton State Hospital. This is one of the hospitals to which a mentally disordered state prison inmate may be transferred. (See Pen. Code, § 2684; see also Cal. Dept. of Corrections, Classification Manual, § 3205.)
[3]  Penal Code section 4011.6 permits the transfer of an inmate of a county or city jail to a mental health facility when it appears he may be mentally disordered. The statute specifically provides that "the time passed therein shall count as part of the prisoner's sentence."

Since the quoted language of section 4011.6 is virtually identical to that in section 2685 (see ante, fn. 1), it follows that this section authorizes a county jail prisoner to receive as much credit for time spent in a mental health facility as he would have earned if he remained in the county jail where he does receive participation and behavior credits. (Pen. Code, §§ 2900.5, 4019; see also maj. opn., ante, at pp. 505-507.)
