Opinion
BAXTER, J.
We address a conflict in the Courts of Appeal about the proper application of Penal Code section 1237.5 and rule 31(d) of the California Rules of Court.1 These provisions allow an appeal from a judgment entered on a guilty plea only if (1) the defendant obtains a certificate of probable cause from the trial court or (2) the appeal falls within the two categories of grounds that do not require a certificate. One “noncertificate” category involves postplea claims, including sentencing issues, that do not attack the validity of the plea.
In People v. Panizzon (1996) 13 Cal.4th 68 [51 Cal.Rptr.2d 851, 913 P.2d 1061] (Panizzon), we held that one who agreed to a specific sentence in return for his plea must obtain a certificate of probable cause in order to claim on appeal that the agreed sentence constitutes cruel and unusual punishment. We explained that while such an appeal may appear to involve a sentencing issue arising after the plea, in substance it challenges the very bargain on which the plea was rendered, and thus the validity of the plea itself. Addressing an analogous principle, we confirmed in People v. Hester (2000) 22 Cal.4th 290 [92 Cal.Rptr.2d 641, 992 P.2d 569] (Hester) that “defendants are estopped from complaining of sentences to which they agreed.” (Id., at p. 295.)
Here, defendant pled guilty to felony drug charges, and admitted two prior serious or violent felonies, in return for an agreed maximum sentence, or “lid.” The agreement included no waiver of defendant’s right to appeal sentencing issues. At a contested sentencing hearing, the trial court denied defendant’s request for diversion to a drug treatment program, and it imposed the negotiated maximum. Without a certificate of probable cause, defendant appealed, urging that the trial court abused its sentencing discretion. In a published decision, the Court of Appeal majority dismissed the appeal for lack of a certificate. The majority concluded, under Hester and Panizzon, that by appealing the very sentence he agreed could be imposed, defendant effectively was attacking the plea’s validity.
[777]*777The instant Court of Appeal majority declined to follow People v. Cole (2001) 88 Cal.App.4th 850 [106 Cal.Rptr.2d 174] (Cole), which reached a contrary result in similar circumstances. Another recent Court of Appeal decision, People v. Stewart (2001) 89 Cal.App.4th 1209 [107 Cal.Rptr.2d 830] (Stewart) purported to distinguish Cole, but essentially concluded, as did the Court of Appeal majority here, that a probable cause certificate is required to argue on appeal that the trial court abused its discretion by imposing a sentence within a negotiated maximum.
The issue is close, but on these particular facts, we find Cole’s reasoning and result more persuasive on the narrow issue presented here. Unless it specifies otherwise, a plea agreement providing for a maximum sentence inherently reserves the parties’ right to a sentencing proceeding in which (1) as occurred here, they may litigate the appropriate individualized sentence choice within the constraints of the bargain and the court’s lawful discretion, and (2) appellate challenges otherwise available against the court’s exercise of that discretion are retained. An appellate challenge to the exercise of the discretion reserved under the bargain is therefore a postplea sentencing matter extraneous to the plea agreement. Such a claim may rarely have merit, but it does not attack the validity of the plea. For that reason, a probable cause certificate is not required.
Accordingly, we will reverse the judgment of the Court of Appeal. We will also disapprove Stewart, supra, 89 Cal.App.4th 1209, to the extent that decision is inconsistent with the views expressed in this opinion.
Facts
An information charged defendant with two felonies, possession for sale of heroin (Health & Saf. Code, § 11351) and possession for sale of methamphetamine (id., § 11378). Under the “Three Strikes” law (§§ 667, subds. (d), (e)(2), 1170.12, subds. (b), (c)(2)), it was further alleged that defendant had suffered two prior violent or serious felony convictions. On June 1, 2000, defendant entered a plea of guilty to both counts and admitted the priors, with an indicated maximum term of six years.2 Neither the written change-of-plea form initialed and signed by defendant, nor any plea terms discussed [778]*778in open court, specified that defendant was affirmatively waiving his right to appeal any sentencing issue that might otherwise properly arise within the negotiated maximum.* 3
On September 15, 2000, the court held a sentencing hearing. At the outset, the court stated it had before it the preplea sentencing report. The court indicated it had also received letters from Teen Challenge International (Teen Challenge), a drug treatment program in which defendant had begun participating while free on bail, and from Dorman Buttram, defendant’s father. Defense counsel then launched an extensive argument that the court had “options,” and that while it “could just maintain the six years as indicated,” it alternatively could and should consider exercising its discretion to dismiss both prior “strikes” and refer defendant, a 51-year-old lifelong drug abuser with a. 30-year record of offenses, to a drug treatment program such as Teen Challenge or the California Rehabilitation Center (CRC). Stressing his intent to protect the record, counsel suggested there was authority to the effect that “this could not be raised on appeal if counsel at sentencing did not raise the issue.”
At one point, counsel admitted there have always been limits on a CRC referral “because of length of period of custody,” and that CRC was “not as in vogue as in the past.” The court itself then interjected that questions had been raised about CRC’s effectiveness, and that there was doubt whether CRC would consider defendant suitable, because “[m]y understanding is [that] it’s more for the novice [offender]” than for one with a long criminal history facing a “multiple drug sales charge.” The court indicated it had not used CRC “for quite awhile.”
The prosecutor did not object that arguments for a drug treatment disposition violated the maximum-term provision of the plea agreement. Instead, [779]*779before submitting the matter, she made a brief response on the merits. She noted indications in the preplea report that defendant’s drug addiction was well established and of long duration, that his prognosis was guarded, and that he required deeper and more structured treatment than Teen Challenge could provide. Moreover, the prosecutor argued, defendant’s extensive criminal history required a more punitive disposition.
In weighing its options, the court noted, in defendant’s favor, the remorse indicated by his guilty plea, the relatively small quantity of drugs involved in the current charges, defendant’s recent efforts at rehabilitation, and the age of his prior “strike” convictions. On the other hand, the court observed, the case “as filed” was a “third strike” matter with exposure to a maximum life sentence. In addition, the court emphasized, defendant had a more recent record of numerous theft and drug offenses, with their attendant affects on society, that were committed for the purpose of feeding his “voracious” multi-drug addiction. Defendant’s need for long-term treatment, the court opined, would exceed the limited duration of a residential program. The competing factors, said the court, thus weighed in favor of a state prison term, “though not a lengthy one.”
Accordingly, the court exercised its discretion to dismiss one of the prior “strikes,” and to impose concurrent three-year sentences on the two possession-for-sale convictions. These terms, doubled to reflect defendant’s sentencing status as a “two strike” offender, produced the indicated maximum sentence of six years. Judgment was entered accordingly.4
The same day, defendant noticed an appeal. On the standard form notice, a box was checked indicating that the appeal followed a plea of guilty or nolo contendere. However, the notice neither included a probable cause certificate nor indicated a noncertificate ground for the appeal.
The superior court clerk prepared the record on appeal, and it was filed in the Court of Appeal. After the jurisdictional time for appeal had passed, defendant’s appellate counsel moved to amend the notice of appeal to comply with rule 31(d). The Court of Appeal granted the motion, and the notice was amended to include “sentencing” as a noncertificate ground of appeal. Defendant subsequently filed his brief on the merits, arguing that the sentencing court had abused its discretion, and had provided an inadequate statement of reasons, when it refused to initiate civil narcotic addict proceedings. The People’s responsive brief urged that no abuse of discretion had occurred.
[780]*780At oral argument, the Court of Appeal, acting on its own motion, requested supplemental briefing on whether defendant required a certificate of probable cause to raise these sentencing issues. After receiving supplemental briefs, the Court of Appeal, in a two-to-one decision, dismissed the appeal for lack of a certificate. In essence, the majority ruled that when a defendant negotiates a maximum sentence in return for his plea, any sentence imposed within the maximum satisfies the bargain. Hence, the majority reasoned, an appellate challenge to the sentence imposed in such circumstances is an attack on the validity of the plea itself, and thus requires a certificate of probable cause. The majority rejected the contrary reasoning of Cole, supra, 88 Cal.App.4th 850.
The dissenting opinion embraced Cole. The dissent reasoned that when a plea agreement sets a maximum sentence, but reserves trial court discretion to determine whether the maximum should be imposed, a challenge to the exercise of the discretion reserved by the agreement does not seek to vitiate the plea, and thus requires no certificate.
We granted review. We now reverse the Court of Appeal’s judgment.
Discussion
Section 1237.5 provides in relevant part that “[n]o appeal shall be taken by the defendant from a judgment of conviction upon a plea of guilty or nolo contendere . . . except where both of the following are met: ft[] (a) The defendant has filed with the trial court a written statement, executed under oath or penalty of perjury showing reasonable constitutional, jurisdictional, or other grounds going to the legality of the proceedings, [f] (b) The trial court has executed and filed a certificate of probable cause for such appeal with the clerk of the court.”
Despite this broad language, we have held that two types of issues may be raised on appeal following a guilty or nolo plea without the need for a certificate: issues relating to the validity of a search and seizure, for which an appeal is provided under section 1538.5, subdivision (m), and issues regarding proceedings held subsequent to the plea for the purpose of determining the degree of the crime and the penalty to be imposed. (Panizzon, supra, 13 Cal.4th 68, 74-75; People v. Jones (1995) 10 Cal.4th 1102, 1106 [43 Cal.Rptr.2d 464, 898 P.2d 910], and cases cited.)
Rule 31(d) implements both the requirement of section 1237.5 and its exceptions. The first paragraph of rule 31(d) provides that within 60 days after the judgment entered on a guilty or nolo plea, the defendant shall file, [781]*781as an intended notice of appeal, the statement of grounds required by subdivision (a) of section 1237.5, but that the appeal “shall not be operative” unless, within 20 days after the statement is filed, the trial court executes a certificate of probable cause.5 But the second paragraph of rule 31(d) provides that the statement and certificate required by section 1237.5 shall not be necessary if the appeal is “based solely upon grounds (1) occurring after entry of the plea which do not challenge its validity or (2) involving a search or seizure, the validity of which was contested pursuant to section 1538.5 . . . .” (Italics added.)6
“The purpose for requiring a certificate of probable cause is to discourage and weed out frivolous or vexatious appeals challenging convictions following guilty and nolo contendere pleas. [Citations.] The objective is to promote judicial economy ‘by screening out wholly frivolous guilty [and nolo contendere] plea appeals before time and money is spent preparing the record and the briefs for consideration by the reviewing court.’ [Citations.]
“It has long been established that issues going to the validity of a plea require compliance with section 1237.5. [Citation.] Thus, for example, a certificate must be obtained when a defendant claims that a plea was induced by misrepresentations of a fundamental nature [citation] or that the plea was entered at a time when the defendant was mentally incompetent [citation]. Similarly, a certificate is required when a defendant claims that warnings regarding the effect of a guilty plea on the right to appeal were inadequate. [Citation.]” (Panizzon, supra, 13 Cal.4th 68, 75-76.)
“In determining whether section 1237.5 applies to a challenge of a sentence imposed after a plea of guilty or no contest, courts must look to the substance of the appeal: ‘the crucial issue is what the defendant is challenging, not the time or manner in which the challenge is made.’ {People v. [782]*782Ribero (1971) 4 Cal.3d 55, 63 [92 Cal.Rptr. 692, 480 P.2d 308].) Hence, the critical inquiry is whether a challenge to the sentence is in substance a challenge to the validity of the plea, thus rendering the appeal subject to the requirements of section 1237.5. (People v. McNight (1985) 171 Cal.App.3d 620, 624 [217 Cal.Rptr. 393] [(McNight)].)” (Panizzon, supra, 13 Cal.4th 68, 76.)
In Panizzon, a defendant pled no contest to multiple serious felonies in return for a specified sentence of life with the possibility of parole, plus 12 years. He received that exact sentence, but then sought to appeal without obtaining a certifícate of probable cause, on grounds that the negotiated sentence constituted cruel and unusual punishment. We concluded a certificate was necessary. As we explained, “[although defendant purports not to contest the validity of the negotiated plea,” but rather a sentence imposed after the plea, “he is in fact challenging the very sentence to which he agreed as part of the plea. Since the challenge attacks an integral part of the plea, it is, in substance, a challenge to the validity of the plea, which requires compliance with . . . section 1237.5 and rule 31(d).” (Panizzon, supra, 13 Cal.4th 68, 73.)7
Panizzon relied heavily on the reasoning of McNight, supra, 171 Cal.App.3d 620. There, in return for the defendant’s plea, the prosecutor agreed to recommend a specified sentence of 21 years. After the trial court imposed the recommended sentence, defendant appealed. He urged that his counsel should have raised, and the trial court should have considered, mitigating circumstances favoring a more lenient sentence. The Court of Appeal ruled that this claim required a certificate of probable cause. As the court indicated, “appellant received exactly the sentence promised in the agreement. His contention that consideration of mitigating circumstances should have resulted in imposition of a sentence less than the agreed-upon 21 years goes to the heart of the plea agreement itself.” (Id., at p. 624.) Hence, in substance, it was an attack on the validity of the plea, for which a certificate was required.8
In Hester, supra, 22 Cal.4th 290, a case decided after Panizzon, we addressed the analogous question of sentencing issues waived on appeal by a [783]*783plea bargain. There the defendant pled no contest to charges of burglary, felony assault with a deadly weapon enhancement, misdemeanor battery, and misdemeanor vandalism, all arising from a single attack by the defendant upon his former girlfriend. He entered a similar plea to a charge that he later attempted to dissuade the victim and her new boyfriend from testifying. In return, the defendant agreed to a four-year prison term. In accordance with the agreement, the court imposed a four-year sentence for the burglary count, concurrent three-year terms for the assault and dissuading counts, and concurrent jail terms for the misdemeanors.
The defendant appealed, urging the trial court erred by failing to stay the assault sentence pursuant to section 654’s prohibition of double punishment for a single criminal act or omission. As the defendant conceded, rule 412(b)9 specifically provided that by agreeing, personally and by counsel, to a specified sentence, a defendant who received that sentence or a shorter one abandoned any claim that any component of the sentence violated section 654. The defendant argued, however, that rule 412(b) was invalid because it conflicted with section 654.
A majority of this court concluded that rule 412(b) applied to the defendant’s case, and was not invalid. As we explained, rule 412(b) simply codified one application of a principle long recognized by California cases, i.e., that while unauthorized sentences may generally be challenged on appeal even if there were no objections below, “[wjhere the defendants have pleaded guilty in return for a specified sentence, appellate courts will not find error even though the trial court acted in excess of jurisdiction in reaching that figure, so long as the trial court did not lack fundamental jurisdiction. The rationale behind this policy is that defendants who have received the benefit of their bargain should not be allowed to trifle with the courts by attempting to better the bargain through the appellate process. [Citations.]” (Hester, supra, 22 Cal.4th 290, 295.) In other words, Hester indicated, rule 412(b) merely applied the long-standing rule that “defendants are estopped from complaining of sentences to which they agreed.” (Hester, supra, at p. 295.)
On the other hand, we have made clear that where the terms of the plea agreement leave issues open for resolution by litigation, appellate claims arising within the scope of that litigation do not attack the validity of the plea, and thus do not require a certificate of probable cause. In People v. [784]*784Ward (1967) 66 Cal.2d 571 [58 Cal.Rptr. 313, 426 P.2d 881] (Ward), the defendant pled guilty to murder. Neither the degree of the offense nor the punishment was specified, and the plea agreement included provisions for how court proceedings on those reserved issues would be conducted. Ultimately, the court found the murder to be of the first degree and imposed a life sentence.
The defendant noticed an appeal, apparently seeking to raise errors in these trial court proceedings, but he filed no timely probable cause certificate. On that basis, the Court of Appeal dismissed the appeal, but we reversed. We held that the certificate requirement does not apply when the defendant “is not seeking to vacate the plea,” but “assertfs] only that errors occurred in the . . . adversary hearings conducted by the trial court for the purpose of determining the degree of the crime and the penalty to be imposed.” (Ward, supra, 66 Cal.2d 571, 574.)
In People v. Lloyd (1998) 17 Cal.4th 658 [72 Cal.Rptr.2d 224, 951 P.2d 1191] (Lloyd), the defendant pled no contest, without a bargain, to charges and enhancements that rendered him eligible for treatment as a “third strike” offender. The court postponed sentencing to await appellate guidance— presumably from our pending decision in Romero, supra, 13 Cal.4th 497—as to whether it had discretion to dismiss one or more “strikes.” When no such decision was forthcoming after six months, sentencing proceeded. After concluding it lacked authority to vacate prior “strikes,” the court imposed a “third strike” sentence. At the defendant’s behest, however, the court stated on the record that it would have considered dismissing one or more “strikes” if it had that discretion.
The defendant noticed an appeal. The notice stated the appeal was from the “sentence,” and it also included a handwritten notation to “Rule 31(d).” No probable cause certificate was filed. While the appeal was pending, we decided Romero, supra, 13 Cal.4th 497, concluding that sentencing courts do have discretion to dismiss “strikes” in the interest of justice. After the defendant filed his opening brief, the People moved successfully to dismiss the appeal for lack of a certificate.
We reversed. We found that the notice of appeal sufficiently indicated noncertificate grounds for the appeal, and thus made the appeal initially “operative” under rule 31(d). We further concluded that dismissal of the appeal for lack of a certificate was error. We explained that the appeal did not attack the validity of the plea, but simply sought to assert Romero error in sentencing proceedings that occurred after the plea. Citing Panizzon, supra, 13 Cal.4th 68, we affirmed that an appeal following conviction on a [785]*785guilty or no-contest plea must be dismissed absent a certificate “if, in substance, it challenges the validity of the plea. (People v. Panizzon, supra, 13 Cal.4th at p. 76.) It does so if the sentence was part of a plea bargain. (Id. at p. 79.) It does not if it was not (id. at p. 78)—especially so if the claim or claims in question were ‘reserved as part of the plea agreement’ (id. at p. 78, fn. 8).” (Lloyd, supra, 17 Cal.4th 658, 665.)
In this case, defendant argues that a negotiated plea term which provides for a maximum sentence, rather than a specified sentence, necessarily contemplates further adversary proceedings, as occurred here, in which the court must exercise its discretion to determine the appropriate sentence within the constraints of the bargain. Hence, he reasons, claims based on abuses of this sentencing discretion were “ ‘reserved as part of the plea agreement’ ” (Lloyd, supra, 17 Cal.4th 658, 665; Panizzon, supra, 13 Cal.4th 68, 78, fn. 8) and constitute, in substance, no attack upon the plea itself that would require a probable cause certificate.
The instant Court of Appeal accepted the People’s contrary argument that absent an express reservation of issues, the defendant’s agreement to a maximum sentence includes his agreement to any sentence within the maximum. Hence, the Court of Appeal reasoned, a challenge to any sentence below the negotiated maximum requires a certificate of probable cause, because it is an attack on “the very sentence to which [the defendant] agreed as part of the plea” (Panizzon, supra, 13 Cal.4th 68, 73), and thus, in substance, upon the validity of the plea.
We find defendant’s argument more persuasive. The parties to a plea agreement are free to make any lawful bargain they choose, and the exact bargain they make affects whether a subsequent appeal, in substance, is an attack on the validity of the plea. When the parties negotiate a maximum sentence, they obviously mean something different than if they had bargained for a specific or recommended sentence. By agreeing only to a maximum sentence, the parties leave unresolved between themselves the appropriate sentence within the maximum. That issue is left to the normal sentencing discretion of the trial court, to be exercised in a separate proceeding.
In general, a trial court’s exercise of its sentencing discretion is reviewable on appeal where the issue was properly preserved on the record. (E.g., People v. Scott (1994) 9 Cal.4th 331, 353 [36 Cal.Rptr.2d 627, 885 P.2d 1040] (Scott).) This exercise of discretion is not made standardless and unreviewable simply because its exercise is confined to a specified range by the terms of a plea bargain that included no express waiver of appeal. In [786]*786such a circumstance, when the claim on appeal is merely that the trial court abused the discretion the parties intended it to exercise, there is, in substance, no attack on a sentence that was “part of [the] plea bargain.” (Lloyd, supra, 17 Cal.4th 658, 665.) Instead, the appellate challenge is one contemplated, and reserved, by the agreement itself.
Cole, supra, 88 Cal.App.4th 850, is directly on point, and its reasoning is convincing. Defendant Cole, driving a stolen car, led police on a high-speed chase and caused an injury accident. He pled guilty to three felonies arising from the incident, and he admitted two prior “strikes.” In return, the court indicated, with the prosecutor’s concurrence, that it would impose a maximum sentence of 25 years to life and would decide whether to dismiss one or more “strikes” so as to permit a lesser term. At a later sentencing hearing, the court considered Cole’s written motion to dismiss “strikes,” as well as the probation report and counsel’s arguments. The court declined to dismiss “strikes” and sentenced Cole to a term of 25 years to life on each count, the terms to be served concurrently.
Cole’s notice of appeal claimed reliance only on postplea issues under rule 31(d). He obtained no certificate of probable cause. His appellate briefs argued that (1) his plea was induced by the court’s misleading promise to consider dismissing “strikes,” (2) his sentence constituted cruel and unusual punishment, (3) the court’s refusal to dismiss one of his prior “strikes” was an abuse of discretion, and (4) the court’s failure to stay two of the three sentences violated section 654.
The Court of Appeal ruled that issue (1), seeking withdrawal of the plea, was an obvious attack on the validity of the plea, and thus required a certificate. Applying Panizzon, supra, 13 Cal.4th 68, it found a similar certificate requirement for issue (2), the cruel and unusual punishment claim. Applying Hester, supra, 22 Cal.4th 290, it further found that issue (4), asserting error under section 654, was barred by rule 4.412(b). (Cole, supra, 88 Cal.App.4th 850, 854, 867-869, 872-873.)10 We have no occasion here to consider the validity of Cole's rulings on these issues, and we do not do so.
Our concern is with issue (3). On this point, Cole, supra, 88 Cal.App.4th 850, concluded that, without obtaining a certificate of probable cause, defendant could attack on appeal the sentencing court’s failure to dismiss the prior “strike.”
After reviewing such cases as Ward, supra, 66 Cal.2d 571, McNight, supra, 171 Cal.App.3d 620, Panizzon, supra, 13 Cal.4th 68, and Lloyd, [787]*787supra, 17 Cal.4th 658, the court reasoned that “when the question of whether to impose the negotiated maximum is left to the court’s discretion at an adversary hearing, an appeal challenging the court’s exercise of that discretion is not, in substance, an attack on the validity of the plea. As Panizzon observed in construing Ward, the rationale of section 1237.5 applies when ‘a separate adversary hearing is unnecessary and the prosecution need not meet the traditional burden of proof in order to determine the proper penalty to be imposed.’ (People v. Panizzon, supra, 13 Cal.4th [68,] 79.) By implication from Panizzon, and by express holding in Ward, where adversary proceedings are held on the question of punishment, the rationale for limiting the right to appeal under section 1237.5 does not apply.” (Cole, supra, 88 Cal.App.4th 850, 871.)
We agree. Here, as in Cole, the parties could have negotiated a specified sentence, but they did not do so. Instead, their bargain provided that defendant would not be vulnerable to a sentence above the agreed limit. It thus left open a variety of sentencing choices within that limit.
The record makes clear that the bargain contemplated separate sentencing proceedings in which the appropriate sentencing choice, within the agreed maximum term, would stem from adversarial debate between the parties and the exercise of sentencing discretion by the trial court. At the time of the plea, the court indicated it would consider a disposition below the maximum. While the court ultimately imposed the agreed maximum, it did so only after a noticed sentencing hearing in which both sides argued their views of the appropriate disposition. The court considered the preplea sentencing report and carefully stated on the record its reasons for its chosen disposition.
Indeed, until the Court of Appeal raised the issue on its own motion, the People—who were a party to the bargain—never suggested that the agreement foreclosed defendant’s right, either in the trial court or on appeal, to debate the proper exercise of sentencing discretion within the agreed maximum term.
Defendant thus seeks only to raise issues reserved by the plea agreement, and as to which he did not expressly waive the right to appeal. Accordingly, his appeal does not, in substance, attack the validity of the plea. It follows that no certificate of probable cause is required.
To the extent Stewart, supra, 89 Cal.App.4th 1209, reached a contrary result on the narrow issue before us, we are not convinced by its reasoning. In Stewart, the defendant pled guilty to two counts of molestation involving his wife’s children; in return, six other counts were dismissed, and it was [788]*788agreed that he would “ ‘serve a 6 year lid with the possibility of probation.’ ” (Id. at p. 1213.) As part of the bargain, the court indicated it would consider probation, but only ‘“[i]f the section 288.1 report [was] positive ....’” (Ibid., italics omitted.) 11 The defendant indicated he understood this condition.
Both the probation report and the section 288.1 report were unfavorable. The latter indicated that the defendant was dangerous and not amenable to treatment. At the sentencing hearing, the defendant argued for probation, while the prosecutor urged the court to follow the probation officer’s recommendation of a prison term. Noting the dangerousness found by the section 288.1 report, and expressly adhering to the limit set by the plea bargain, the court imposed a six-year sentence.
Without obtaining a probable cause certificate, the defendant appealed, urging that the court had erred by (1) relying on the probation and section 288.1 reports, and (2) failing to state adequate reasons for denying probation and imposing the six-year term. The defendant also claimed the court’s refusal to grant probation was an abuse of discretion.
The Court of Appeal dismissed the appeal. It reasoned as follows: The defendant’s challenge to consideration of the probation report was waived by his failure to make a specific and timely objection. (Citing Scott, supra, 9 Cal.4th 331, 352-353.) His claim that the sentencing court should not have relied on the section 288.1 report was similarly precluded by his express acceptance, at the time he entered his plea, of the sentencing significance of this report. The court was not required to state reasons for denying probation and imposing a six-year term, because his plea included his agreement that the trial court had power to sentence him to a term of at least that length. (Citing rule 4.412(a) and People v. Villanueva (1991) 230 Cal.App.3d 1157, 1162 [281 Cal.Rptr. 688].) Finally, the defendant could not argue that his sentence was an abuse of discretion—i.e., that it “ ‘exceeded] the bounds of reason’ ” under the circumstances (Stewart, supra, 89 Cal.App.4th 1209, 1215, quoting People v. Giminez (1975) 14 Cal.3d 68, 72 [120 Cal.Rptr. 577, 534 P.2d 65])—because his agreement to be vulnerable to a term of up to six years was “tantamount to a stipulation that [a sentence of that length] was [789]*789within the range of reasonableness for the crimes [he] had committed.” (Stewart, supra, at p. 1215.)12
Stewart purported to distinguish Cole, supra, 88 Cal.App.4th 850, on the basis of perceived factual differences, including, in particular, the section 288.1 report that was central to the bargain in Stewart. But the fundamental reasoning of the two cases is incompatible, and, as indicated, we conclude that Cole's analysis is the sounder one.
As a practical matter, a defendant may rarely succeed with an argument that it was arbitrary or unreasonable to impose a sentence within an agreed maximum. However, we are not persuaded that a bargain for a maximum sentence necessarily constitutes acceptance, without complaint of any kind, of any sentencing decision within the maximum. As we have indicated, when the parties agree to a specified sentence, any challenge to that sentence attacks a term, and thus the validity, of the plea itself. However, by negotiating only a maximum term, the parties leave to judicial discretion the proper sentencing choice within the agreed limit. Unless the agreement itself specifies otherwise, appellate issues relating to this reserved discretion are therefore outside the plea bargain and cannot constitute an attack upon its validity.13
Stewart, supra, 89 Cal.App.4th 1209, found support for its holding in People v. Young (2000) 77 Cal.App.4th 827 [91 Cal.Rptr.2d 916], but Young [790]*790is distinguishable in a crucial respect. Defendant Young, a “third strike” offender charged with multiple offenses, pled no contest to all charges and “strike” allegations in return for a maximum sentence of 25 years to life and the right to ask the trial court to dismiss one or more “strikes.” After the trial court declined this request and imposed the negotiated maximum term, Young tried to appeal, without a probable cause certificate, on grounds that the sentence was cruel and unusual, and thus unconstitutional. The Court of Appeal noted it need not address whether Young would need a certificate in order to attack the trial court’s discretionary refusal to dismiss “strikes.” However, relying directly on Panizzon, supra, 13 Cal.4th 68, the Court of Appeal concluded that Young could not raise the constitutional issue without a certificate. The Young court reasoned that “[b]y arguing that the maximum sentence is unconstitutional, [the defendant] is arguing that part of his plea bargain is illegal and is thus attacking the validity of the plea.” (Young, supra, at p. 832, italics added.)
We need not decide in this case whether a certificate of probable cause is necessary under the particular circumstances presented in People v. Young, supra, 77 Cal.App.4th 827. Defendant here does not argue that the maximum sentence provided in his plea bargain was invalid because it exceeded the legally authorized sentence for his convictions. He simply seeks to implement the full terms of the bargain by raising appellate challenges to the exercise of individualized sentencing discretion within the agreed maximum that were reserved by the agreement itself. In doing so, we conclude, he need not obtain a certificate of probable cause.
Section 1237.5 and rule 31(d) are intended to weed out frivolous and vexatious appeals from pleas of guilty or no contest, before clerical and judicial resources are wasted. (Panizzon, supra, 13 Cal.4th 68, 75-76; People v. Hoffard (1995) 10 Cal.4th 1170, 1179 [43 Cal.Rptr.2d 827, 899 P.2d 896].) And it is true that application of the certificate requirement has involved difficult, and sometimes confusing, line-drawing. (Lloyd, supra, 17 Cal.4th 658, 667-669 (dis. opn. of Brown, J.).) But the statute and rule do not base the certificate requirement directly upon the dubious merit of a postplea appeal. Instead, under our case law, they require an individual analysis whether the appellate claim at issue constitutes, in substance, an attack on the validity of the plea.
Applying this test, we conclude that, absent contrary provisions in the plea agreement itself, a certificate of probable cause is not required to challenge the exercise of individualized sentencing discretion within an agreed maximum sentence. Such an agreement, by its nature, contemplates that the court will choose from among a range of permissible sentences [791]*791within the maximum, and that abuses of this discretionary sentencing authority will be reviewable on appeal, as they would otherwise be. Accordingly, such appellate claims do not constitute an attack on the validity of the plea, for which a certificate is necessary. People v. Stewart, supra, 89 Cal.App.4th 1209, and People v. Tucker, supra, 187 Cal.App.3d 295, are disapproved to the extent they conflict with these conclusions.
Here, the Court of Appeal majority was mistaken to conclude that a certificate was necessary to assert an abuse of sentencing discretion within the maximum term established by the parties’ plea agreement. It thus erred by dismissing defendant’s appeal for lack of a certificate.
Conclusion
The Court of Appeal’s judgment, dismissing the appeal, is reversed, and the cause is remanded for further proceedings consistent with the views expressed in this opinion.
George, C. J., Kennard, J., Werdegar, J., Chin, J., and Moreno, J., concurred.