*1052 Opinion
Penal Code section 2900.5 provides that the total number of days a defendant spends in custody, either before sentencing or as a condition of probation, “shall be credited” against the defendant’s “term of imprisonment.” In this case, we resolve two issues regarding that statute: First, we conclude that a defendant can expressly waive entitlement to credits for time served. Second, we hold that such an express waiver is proper and enforceable when a trial court in sentencing a defendant to a maximum term of imprisonment conditions a grant of probation upon the defendant’s waiver of custody credits.
I. Facts
Defendant was charged with two counts of burglary and one count of receiving stolen property. Under a plea bargain, defendant entered a plea of no contest to one count of residential burglary (Pen. Code, §§ 459/460) 1 in return for dismissal of the other charges.
Because the burglary involved “significant planning” by defendant, who had copied a house key entrusted to the cleaning business where he worked, and because the value of the items taken exceeded $12,000, the trial court found that aggravating factors predominated and sentenced defendant to the upper term of six years in state prison. (See § 461, subd. 1.) The trial court further found that defendant, who was then 24 years old and had a drug problem but no prior felony convictions, would benefit from probation. The court suspended execution of sentence and placed defendant on probation for 36 months. The court conditioned its grant of probation upon defendant’s agreement to (1) incarceration in county jail until space became available at Turning Point, a residential drug treatment facility, and (2) giving up entitlement to section 2900.5 custody credits, that is, the credits defendant would otherwise receive for the time served in county jail (before and after sentencing) and at Turning Point, in the event defendant were to violate probation and be sent to state prison.
The trial court told defendant: “You make the choices. If you choose to work hard in the program and get something out of it and stay off drugs, you will never have to come back in here, and you’re not going to have a problem. If you don’t do that, you will come back in here, and you are going to go to prison. So use a six-year [state prison] sentence as a motivating tool *1053 to help you make the right choice when you are faced with choices. I am going to give you the opportunity.”
Although defendant expressly agreed to a waiver of custody credits, his attorney, presumably to preserve the issue for appeal, “technically object[ed]” for the record. On appeal, defendant argued that the waiver of custody credits was not enforceable because the trial court had imposed the maximum term of imprisonment and thus if defendant violated probation and was sent to state prison, his total time in custody would exceed that allowed by law. The Court of Appeal affirmed the trial court, and we granted defendant’s petition for review.
II. Discussion
Under section 2900.5, a defendant sentenced either to county jail or to state prison is entitled to credit against the term of imprisonment for days spent in custody before sentencing as well as those served after sentencing as a condition of probation.
(In re Rojas
(1979)
Nearly 25 years ago, Justice Bernard Jefferson’s concurrence in
In re Chamberlain
(1978)
In Chamberlain, the trial court suspended a state prison sentence and placed the defendant on probation conditioned upon service of one year in county jail with no credit for the days the defendant had already spent in jail before sentencing. In a petition for habeas corpus filed in the Court of Appeal, the defendant unsuccessfully challenged that order. In a concurring opinion, Justice Jefferson agreed with the majority’s denial of relief, but he did so for the following reason: By accepting probation, the defendant had *1054 waived his right to custody credits under section 2900.5, and he had done so knowingly and intelligently. But absent such a waiver, Justice Jefferson explained, any period of incarceration without credits would be an illegal sentence under former section 19a (now § 19.2), which “places a one-year limit upon a county jail commitment given as a condition of probation.” (Chamberlain, supra, 78 Cal.App.3d at pp. 720-721 (cone. opn. of Jefferson, J.).)
Agreeing with that view, the Court of Appeal in
People v. Johnson
(1978)
Since then, Courts of Appeal, in upholding custody credits waivers in a wide variety of circumstances, have not questioned that a defendant may waive entitlement to such credits under section 2900.5. (See
People v. Torres
(1997)
Like the Courts of Appeal that have addressed the issue, we too conclude that a defendant may expressly waive entitlement to section 2900.5 credits
*1055
against an ultimate jail or prison sentence for past and future days in custody. As the United States Supreme Court has observed, “‘[tjhe most basic rights of criminal defendants are . . . subject to waiver.’ ”
(United States v. Mezzanatto
(1995)
Defendant acknowledges that trial courts generally have authority to condition probation upon a waiver of credits for time in custody. But he contends that in this case the trial court exceeded that authority because, after imposing the maximum prison term for burglary (six years), it required, as a condition of granting probation, that defendant give up entitlement to custody credits both for time in county jail and at Turning Point, the drug treatment facility. As a consequence, defendant points out, were he to violate probation, he would face the full six-year prison term with no reduction for time spent in county jail or at Tinning Point, resulting in a total time in custody in excess of the maximum state prison term for the offense.
In support, defendant relies on
People
v.
Ambrose, supra,
In
Ambrose,
the Court of Appeal upheld the trial court’s requirement, imposed as a condition of probation, that the defendant waive future custody credits for time spent at Diablo Valley Ranch, an alcohol treatment facility. As in this case, the defendant in
Ambrose
was sentenced to the upper term, execution of which was suspended. In upholding the defendant’s waiver of custody credits, the Court of Appeal in
Ambrose
observed: “This does not mean, of course, that we would endorse a situation in which the denial of
*1056
future credits enabled the court to impose a term which is longer than the maximum allowable for the offense. Even if a defendant agrees to such a negotiated disposition, a trial court should not impose a sentence in excess of the maximum allowable for the plea entered. Appellant would be entitled to discharge from custody
at the ranch
if and when his total custodial time, including time at the ranch, equaled the maximum incarceration period.”
(Ambrose, supra,
That comment by the Ambrose court envisioned a situation in which a trial court, as a condition of probation, has imposed an indefinite custodial term in a residential treatment program. Ambrose suggests that when the total time the defendant spends in county jail and in the residential program equals the crime’s maximum sentence, the defendant must be discharged from the program. But Ambrose did not address the issue here: whether imposition of a suspended maximum prison term precludes the trial court from requiring, as a condition of probation, that the defendant waive entitlement to section 2900.5 custody credits. Thus, it is not authority for defendant’s contention here.
Invoking the rule that probation conditions must serve some legitimate purpose relating to the offender or the offense (see
People v. Carbajal
(1995)
Here, after accepting defendant’s waiver of custody credits, the trial court placed him on probation for 36 months conditioned upon successful completion of the Turning Point residential drug treatment program. As noted in
Ambrose, supra,
We now address the Court of Appeal’s decision in
Tran, supra,
In
Tran,
the defendant deposited bad checks in three bank accounts and then withdrew $40,000 to cover gambling debts. He later pleaded guilty to three counts of grand theft. The trial court imposed the maximum prison sentence, suspended its execution, and placed the defendant on five years’ probation conditioned upon an 18-month county jail term, a waiver of future custody credits, and restitution to the banks of the full $40,000. Under protest, the defendant agreed to waive entitlement to credit for days in custody. On appeal, he challenged that aspect of the trial court’s sentencing order as unauthorized, arguing that if he violated probation and was sent to state prison with no credit for the 18-month jail term, his total custodial time would exceed the maximum prison term. The Court of Appeal agreed.
(Tran, supra,
We disagree with
Tran, supra,
Exercising its discretion, the trial court determined that imposing the maximum term for defendant’s crime of residential burglary and conditioning probation on a waiver of section 2900.5 custody credits was necessary to provide defendant with sufficient incentive to comply with the other terms of probation and to successfully complete the rehabilitation program. Defendant makes no claim that, as a result of the waiver condition, the total time he *1058 will be required to spend in custody before sentencing and as a condition of probation will exceed the maximum term statutorily authorized for the crime he committed. Under these circumstances, we conclude that defendant has failed to show that the custody credit waiver condition was invalid, and we further conclude that the state prison sentence the trial court imposed, for the maximum term authorized by law, was a valid sentence and was not rendered unlawful by defendant’s waiver of custody credits.
Disposition
We affirm the judgment of the Court of Appeal.
George, C. J., Baxter, J., Werdegar, J., Chin, J., Brown, J., and Moreno, J., concurred.
Notes
Further undesignated statutory references are to the Penal Code.
Subdivision (a) of section 2900.5 provides: “In all felony and misdemeanor convictions, either by plea or by verdict, when the defendant has been in custody, including, but not limited to, any time spent in a jail, camp, work furlough facility, halfway house, rehabilitation facility, hospital, prison, juvenile detention facility, or similar residential institution, all days of custody of the defendant, including days served as a condition of probation . . . shall be credited upon his or her term of imprisonment. . . . If the total number of days in custody exceeds the number of days of the term of imprisonment to be imposed, the entire term of imprisonment shall be deemed to have been served.”
We do not here consider whether a trial court could within the proper exercise of its discretion routinely condition grants of probation upon waivers of credit for time served. (Compare
People
v.
Penoli
(1996)
We disapprove
People
v.
Tran, supra,
