
    [No. S166894.
    Nov. 23, 2009.]
    THE PEOPLE, Plaintiff and Respondent, v. TIMOTHY JOHNSON, Defendant and Appellant.
    
      Counsel
    Vicki I. Firstman, under appointment by the Supreme Court, for Defendant and Appellant.
    
      Edmund G. Brown, Jr., Attorney General, Dane R. Gillette, Chief Assistant Attorney General, Gerald A. Engler, Assistant Attorney General, Laurence K. Sullivan and René A. Chacón, Deputy Attorneys General, for Plaintiff and Respondent.
   Opinion

GEORGE, C. J.

We granted review to resolve a conflict among appellate court decisions addressing the issue whether a defendant who desires to appeal from a criminal judgment on the ground that counsel rendered ineffective assistance regarding the defendant’s request to withdraw a guilty or no contest plea first must obtain a certificate of probable cause. The Court of Appeal below, concluding that a certificate of probable cause was required, dismissed defendant’s appeal. We affirm the judgment rendered by that court.

I.

On September 13, 2006, pursuant to a plea agreement, defendant Timothy Johnson, represented by counsel, waived his right to a preliminary hearing and entered a no contest plea to two counts of forcible oral copulation (Pen. Code, § 288a, subd. (c)(2)) and one count of lewd conduct committed upon a child under the age of 14 years (§ 288, subd. (a)). In exchange, the prosecution agreed to a sentence of 19 years and to the dismissal of five additional counts.

Defendant subsequently indicated that he wished to change his plea and, on October 12, 2006, the trial court conducted a hearing pursuant to People v. Smith (1993) 6 Cal.4th 684, 695-696 [25 Cal.Rptr.2d 122, 863 P.2d 192], to determine whether substitute counsel should be appointed to investigate potential grounds for a motion to withdraw defendant’s plea, based upon possible ineffective assistance of counsel. At the hearing, defendant stated that he was not guilty of the charges but that he had entered into the plea agreement because he was frightened by the prospect of a possible life term. Defendant reported that the first attorney who represented him in these proceedings advised him not to enter into the plea agreement. That attorney was replaced by the public defender, but defendant informed the trial court that he had not had the opportunity to discuss the case with the deputy public defender assigned to him until shortly before the time set for the preliminary hearing, when counsel told him that it was “maybe” in his best interest to accept the plea agreement providing for a sentence of 19 years.

The deputy public defender explained to the trial court the circumstances related to defendant’s acceptance of the plea agreement. Counsel stated that prior to the date set for the preliminary hearing, he undertook an assessment of the evidence. When he met with defendant on the date set for the preliminary hearing, it was his opinion that the evidence was quite strong and that defendant’s maximum exposure was to a sentence of approximately 45 years in prison. After determining that the 19-year sentence previously offered by the district attorney still was available but would be withdrawn if the preliminary hearing went forward, counsel advised defendant of counsel’s belief that it was in defendant’s best interest to accept the offer. According to counsel, defendant stated, “If that’s your opinion, then that’s what I will do.” After hearing the deputy public defender’s explanation, the court concluded there was no “colorable claim” of ineffective assistance of counsel that would warrant removal of counsel, and ordered that the public defender remain as attorney of record.

The court then asked defendant why he wished to set aside his plea. Defendant reiterated that he was “scared into it” and stated he was not guilty of the charges. When the trial court inquired of the district attorney concerning evidence supporting the charges, the prosecutor referred to the statements of the two alleged victims and represented that an acquaintance of defendant’s could testify to incriminating statements made by defendant regarding one of the alleged victims, his stepdaughter. Defense counsel made no comment during this discussion and answered “no” when the court inquired whether he “want[ed] to say anything further.” The court denied defendant’s motion to set aside his plea.

On October 27, 2006, defendant was sentenced to the agreed-upon term of 19 years: the upper term of eight years on the count of committing a lewd act upon a child, the upper term of eight years on one count of forcible oral copulation, and the lower term of three years on the second count of forcible oral copulation, with all terms to be served consecutively.

Defendant filed a notice of appeal and a request for a certificate of probable cause. The notice stated that the appeal challenged the validity of the plea. The request for a certificate of probable cause related that the basis for the appeal was that “Mr. Johnson’s waiver of his fundamental constitutional rights was not made knowingly, intelligently, or voluntarily. Furthermore, the court abused its discretion in denying Mr. Johnson’s motion to withdraw his guilty plea.” The trial court denied the request for a certificate of probable cause and notified defendant that his notice of appeal was deemed “not operative.” Subsequently, defendant filed an amended notice of appeal, which stated that the “appeal is based on the sentence and other matters occurring after the plea and does not challenge the validity of the plea.”

Appellate counsel was appointed and the record was prepared. In the Court of Appeal, defendant claimed he was deprived of his right to the effective assistance of counsel at the October 12, 2006, hearing, because counsel made no attempt to support defendant’s motion to withdraw his plea. Defendant contended on appeal that the matter should be remanded for the purpose of affording his attorney an opportunity to investigate, prepare, and present a motion for withdrawal of the plea, relying upon People v. Brown (1986) 179 Cal.App.3d 207, 215-217 [224 Cal.Rptr. 476] (Brown). In Brown, defense counsel refused to present a motion to withdraw the defendant’s guilty plea, and the appellate court reversed the judgment and remanded to permit the defendant, with the assistance of counsel, to make a motion to withdraw. In that case, however, the appellate court required a certificate of probable cause, and one was issued. (Id. at p. 210, fh. 1.)

In the present matter, the appellate court dismissed defendant’s appeal, concluding that a certificate of probable cause was required under section 1237.5. In doing so, it followed the decision in People v. Emery (2006) 140 Cal.App.4th 560, 565 [44 Cal.Rptr.3d 551] (Emery), in which the Court of Appeal held that a certificate of probable cause is a prerequisite to an appeal challenging the trial court’s denial of a continuance sought by defense counsel to investigate potential grounds for withdrawal of the defendant’s guilty plea. The appellate court in the present matter attempted to distinguish the decision rendered by another Court of Appeal in People v. Osorio (1987) 194 Cal.App.3d 183, 188-189 [239 Cal.Rptr. 333] (Osorio), an opinion with which Emery explicitly disagreed. (Emery, supra, 140 Cal.App.4th at p. 565.) Osorio held that a certificate of probable cause was not a prerequisite to an appeal based upon a claim that defense counsel had rendered ineffective assistance in refusing to file a motion to withdraw the defendant’s guilty plea.

We granted review in the present case to resolve the conflict between the decisions in Osorio and Emery.

II.

Section 1237.5 states broadly 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: [f] (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. [][] (b) The trial court has executed and filed a certificate of probable cause for such appeal with the clerk of the court.” (§ 1237.5, italics added.) “The purpose and effect of section 1237.5 ... are ... to create a mechanism for trial court determination of whether an appeal raises any nonfrivolous cognizable issue, i.e., any nonfrivolous issue going to the legality of the proceedings. Before the enactment of section 1237.5, the mere filing of a notice of appeal required preparation of a record and, in many cases, appointment of counsel; only after expenditure of those resources would an appellate court determine whether the appeal raised nonfrivolous issues that fell within the narrow bounds of cognizability. Section 1237.5 was intended to remedy the unnecessary expenditure of judicial resources by preventing the prosecution of frivolous appeals challenging convictions on a plea of guilty.” (People v. Hoffard (1995) 10 Cal.4th 1170, 1179 [43 Cal.Rptr.2d 827, 899 P.2d 896] (Hoffard).)

“Section 1237.5 does not limit the scope of review of the denial of a motion to withdraw a plea of guilty when that error is properly before the court on appeal. It merely sets forth a procedure for precluding frivolous appeals by requiring the defendant to set forth grounds for appeal and, if he does so, by requiring the trial court to rule on the issue of probable cause.” (People v. Ribero (1971) 4 Cal.3d 55, 62 [92 Cal.Rptr. 692, 480 P.2d 308] (Ribero).) The trial court must issue the certificate if the defendant’s statement under section 1237.5 presents “any cognizable issue for appeal which is not clearly frivolous and vexatious . . . .” (People v. Holland (1978) 23 Cal.3d 77, 84 [151 Cal.Rptr. 625, 588 P.2d 765].) The defendant’s statement need not list every potential issue; if the trial court issues the certificate based on even a single nonfrivolous claim, the defendant may raise all of his or her claims on appeal — those that require a certificate as well as those that do not — even if they were not identified in the statement filed with the trial court. (Hoffard, supra, 10 Cal.4th at pp. 1177-1180.) If the trial court wrongfully refuses to issue a certificate, the defendant may seek a writ of mandate from the appellate court. (In re Brown (1973) 9 Cal.3d 679, 683 [108 Cal.Rptr. 801, 511 P.2d 1153].)

Despite the broad language of section 1237.5 — which, as noted, addresses any appeal “from a judgment of conviction upon a plea of guilty or nolo contendere” — we have long recognized two exceptions to its requirement of a certificate of probable cause. First, a defendant may appeal from a ruling involving a search and seizure issue without obtaining a certificate, because an appeal from such a ruling explicitly is authorized by section 1538.5 “notwithstanding the fact that the judgment of conviction is predicated upon a plea of guilty.” (§ 1538.5, subd. (m); see People v. Kaanehe (1977) 19 Cal.3d 1, 8 [136 Cal.Rptr. 409, 559 P.2d 1028].) Second, a defendant is “not required to comply with the provisions of section 1237.5 where ... he is not attempting to challenge the validity of his plea of guilty but is asserting only that errors occurred in the subsequent adversary hearings conducted by the trial court for the purpose of determining the degree of the crime and the penalty to be imposed.” (People v. Ward (1967) 66 Cal.2d 571, 574 [58 Cal.Rptr. 313, 426 P.2d 881] (Ward).)

We explained in Ward that “[i]n spite of the fact that section 1237.5 refers generally to an appeal ‘from a judgment of conviction upon a plea of guilty’ it seems clear that the section was intended to apply only to a situation in which a defendant claims that his plea of guilty was invalid.” (Ward, supra, 66 Cal.2d at p. 574.) We recognized that historically, even before the enactment of section 1237.5’s requirement of a certificate of probable cause, limitations had been placed on the grounds upon which a defendant could attack a guilty plea on appeal. (66 Cal.2d at p. 575.) As we observed in Ward, “When a defendant pleads guilty to a crime ... no trial is held on the question of guilt and there are no controverted issues, since he admits every element of the crime, and the plea necessarily results in a judgment of conviction.” (Ibid.)

When a defendant has entered a plea of guilty or no contest, the bases for an appeal from the resulting conviction are limited and section 1237.5 serves to prevent frivolous appeals. “There is no justification, however, for applying the section to the altogether distinct procedures followed where a defendant asserts that errors occurred in the hearing held, after his plea was entered, on the degree of the crime and the penalty to be imposed. So far as we have been able to determine, the right of an aggrieved defendant to appeal from a court’s determination on these issues has never been questioned [citations] albeit the right to challenge a guilty plea on appeal has always been circumscribed.” (Ward, supra, 66 Cal.2d at p. 575.) “The primary purpose of [section 1237.5], to prevent the taking of frivolous appeals based on the asserted invalidity of pleas of guilty, must not be confused with the entirely separate and settled procedure relating to the determination of asserted errors occurring in subsequent hearings to ascertain the degree of a crime and the penalty to be imposed.” (Ward, supra, at pp. 576-577.)

California’s determinate sentencing law provides for a sentencing hearing in which disputed issues may be litigated. (§ 1170, subd. (b).) Thus, except when sentence is imposed pursuant to a plea agreement, the potential grounds for claims of error in sentencing are the same whether the defendant has pleaded guilty or whether he or she has pleaded not guilty and been found guilty after a trial. In other words, at least in the absence of a plea agreement affecting the sentence, the circumstance that a defendant has pleaded guilty to a crime does not signify that the appellate issues related to sentencing will be any more circumscribed than they are in a case in which the defendant has pleaded not guilty. Consequently, the rationale behind section 1237.5 is inapplicable when an appeal relates only to sentencing issues.

Even when a defendant purports to challenge only the sentence imposed, a certificate of probable cause is required if the challenge goes to an aspect of the sentence to which the defendant agreed as an integral part of a plea agreement. (See, e.g., People v. Cuevas (2008) 44 Cal.4th 374, 377 [79 Cal.Rptr.3d 303, 187 P.3d 30] [certificate required for claim that the sentence imposed, which defendant was advised was the maximum possible sentence for the remaining charges after additional charges were dismissed pursuant to a plea agreement, violates the multiple punishment prohibition of § 654]; People v. Shelton (2006) 37 Cal.4th 759, 763 [37 Cal.Rptr.3d 354, 125 P.3d 290] [certificate required for claim that the sentence imposed, whose length equaled the agreed-upon “lid,” violates the multiple punishment prohibition of § 654]; People v. Panizzon (1996) 13 Cal.4th 68, 73 [51 Cal.Rptr.2d 851, 913 P.2d 1061] [certificate required for claim that imposition of sentence to which defendant agreed pursuant to plea agreement constituted cruel and unusual punishment].) The rationale for the exception to the certificate requirement recognized in Ward does not apply in such cases because, as a' consequence of the plea agreement, the validity of an agreed-upon aspect of the sentence is not in contention at the sentencing hearing. Such an agreed-upon aspect of the sentence cannot be challenged without undermining the plea agreement itself. Consequently, an attack upon an integral part of the plea agreement “is, in substance, a challenge to the validity of the plea ....” (People v. Panizzon, supra, 13 Cal.4th at p. 73.)

A defendant must obtain a certificate of probable cause in order to appeal from the denial of a motion to withdraw a guilty plea, even though such a motion involves a proceeding that occurs after the guilty plea. (Ribero, supra, 4 Cal.3d 55.) “On application of the defendant at any time before judgment . . . [the trial] court may, ... for a good cause shown, permit the plea of guilty to be withdrawn and a plea of not guilty substituted.” (§ 1018.) “Mistake, ignorance or any other factor overcoming the exercise of free judgment is good cause for withdrawal of a guilty plea.” (People v. Cruz (1974) 12 Cal.3d 562, 566 [116 Cal.Rptr. 242, 526 P.2d 250].) In Ribero, the defendant moved to withdraw his plea on the grounds that he was under the influence of drugs when he entered it and was not fully aware of what he was doing. The trial court denied the motion, and the defendant attempted to appeal from the ruling. In Ribero, we rejected the defendant’s argument that a certificate of probable cause was not required because the motion to withdraw the plea took place in a proceeding conducted subsequent to entry of the guilty plea. Although Ward also involved a proceeding subsequent to entry of the plea, the “determinative factor” in that case was “the substance of the error being challenged, not the time at which the hearing was conducted.” (Ribero, supra, 4 Cal.3d at p. 63.) We concluded that a contrary holding would “invite such motions [to withdraw the plea] as a matter of course, and would be wholly contrary to the purpose of section 1237.5.” (Id. at p. 64.)

In the present case, defendant’s claim that he was denied his right to the assistance of counsel at the hearing on his motion to withdraw his plea plainly does not come within the exception to the certificate requirement we previously have recognized for claims arising from 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 at p. 574.) Under Ribero, it is clear that if defendant’s claim were that the trial court abused its discretion in denying his motion to withdraw the plea, a certificate of probable cause would be required.

Defendant contends, however, that a different rule should apply in the present case, because he does not directly challenge the trial court’s ruling on his motion to withdraw the plea; the remedy he seeks in the appellate court is not withdrawal of the plea but a remand for a new hearing on his motion to withdraw the plea. Defendant urges us to adopt the rule of Osorio, supra, 194 Cal.App.3d 183. In Osorio, the defendant pleaded guilty to one count charging the sale or transportation of heroin (Health & Saf. Code, § 11352), in exchange for dismissal of three additional counts. When the court inquired concerning the factual basis for the plea, the prosecutor indicated there had been a sale of heroin to undercover officers, while defense counsel stated the transaction involved transporting and furnishing drugs, but not a sale. At the sentencing hearing, the court noted that the probation report described a sale and indicated that the defendant was the principal seller. The defendant objected to the probation report’s description of the offense and stated that he wanted to withdraw his plea. The trial court deferred sentencing to enable the defendant and his counsel to decide whether to file a motion to withdraw the plea. Counsel subsequently indicated he would not submit a motion, although the defendant still requested that such a motion be filed. The court then sentenced the defendant to the upper term. (Osorio, supra, 194 Cal.App.3d at p. 186.)

On appeal, the defendant in Osorio claimed he was entitled to a remand to enable his attorney to prepare and present a motion to withdraw the plea. The Court of Appeal held that a certificate of probable cause was not required. The appellate court reasoned that in a case in which the motion to withdraw the plea is based upon events alleged to have occurred before the plea itself was entered — for example, an allegation that the plea was not knowingly and intelligently entered — an appeal from a denial of the motion to withdraw “is-tantamount to an attack on the validity of the plea itself. An appellant must therefore comply with the requirements of section 1237.5.” (Osorio, supra, 194 Cal.App.3d at p. 187.) “On the other hand, if the motion to withdraw the plea is based upon activities occurring after the plea, such as an alleged failure to sentence in accordance with a plea bargain, then no probable cause certificate is required for an appeal from denial of the order. [Citation.] In the latter circumstances, the appellate court is not called upon to pass on the validity of the plea itself.” (Ibid.) Because the appeal in Osorio attacked only the failure of counsel to file a motion to withdraw the plea, the appellate court stated, “The relief requested does not require that we pass upon the validity of the guilty plea.” (Ibid.) Accordingly, the appellate court concluded, “the appeal addresses only the events occurring after the plea and the requirements of section 1237.5 are not applicable.” (Ibid.; see also People v. Makabali (1993) 14 Cal.App.4th 847, 851 [18 Cal.Rptr.2d 72] [citing Osorio for the proposition that no certificate is required in order to appeal the issue of trial counsel’s failure to file a motion to withdraw a plea as requested by the defendant].)

The Court of Appeal in Emery, supra, 140 Cal.App.4th 560, 565, disagreed with Osorio. In Emery, the court held that a certificate of probable cause was a prerequisite to an appeal challenging the trial court’s denial of a continuance that had been sought to investigate a potential motion to withdraw the defendant’s guilty plea. The court in Emery concluded that the defendant’s challenge to the trial court’s denial of a continuance was “in substance a challenge to the validity of the defendant’s plea.” (Emery, 140 Cal.App.4th at p. 562.) Emery criticized Osorio on the ground that the claim of error in that case “was dependent upon the validity of the guilty plea” and was, in substance, an attack on the plea itself. (Emery, at p. 565.)

We agree with Emery and disapprove People v. Osorio, supra, 194 Cal.App.3d 183. To the extent that Osorio relied upon the circumstance that the defendant’s claim was “based upon activities occurring after the plea” (Osorio, supra, 194 Cal.App.4th at p. 187), that case is inconsistent with Ribero, in which we concluded that the determinative factor is “the substance of the error being challenged, not the time at which the hearing was conducted.” (Ribero, supra, 4 Cal.3d at p. 63.) More fundamentally, we disagree with Osorio’s conclusion that the applicability of section 1237.5’s certificate requirement depends upon whether “[t]he relief requested . . . require[s] that we pass upon the validity of the guilty plea.” (Osorio, supra, 194 Cal.App.4th at p. 187.) The rule established in Osorio would require courts to draw a distinction between appeals that challenge directly the merits of a trial court’s ruling on a motion to withdraw the plea (as occurred in Ribero) and appeals that allege defects in the proceedings involved in the motion to withdraw the plea (as in the present case, Emery, and Osorio). Under the rationale of Osorio, appeals of the former type would require a certificate because they could result in an appellate decision requiring that the motion to withdraw tire plea be granted, whereas claims of the latter type would not require a certificate because they would result only in a remand to the trial court for further proceedings on the motion to withdraw the plea.

The distinction required by Osorio finds no support in the language of the statute, which, as noted above, provides broadly that ‘\ri\o appeal shall be taken by the defendant from a judgment of conviction upon a plea of guilty or nolo contendere . . .” in the absence of a certificate of probable cause. (§ 1237.5, italics added.) The historical and policy reasons that have caused us to conclude that, despite section 1237.5’s broad language, the Legislature did not intend to require a certificate for appeals arising out of alleged errors in sentencing proceedings, are inapplicable to appeals based upon alleged defects in the proceedings conducted on a motion to withdraw a guilty or no contest plea. “The primary purpose of [section 1237.5 is] to prevent the taking of frivolous appeals based on the asserted invalidity of pleas of guilty . . . ,” thereby avoiding the unnecessary expenditure of resources. (Ward, supra, 66 Cal.2d at pp. 576-577.) Whether the appeal seeks a ruling by the appellate court that the guilty plea was invalid, or merely seeks an order for further proceedings aimed at obtaining a ruling by the trial court that the plea was invalid, the primary purpose of section 1237.5 is met by requiring a certificate of probable cause for an appeal whose purpose is, ultimately, to invalidate a plea of guilty or no contest.

Adoption of the Osorio rule would undermine both section 1237.5’s purpose of avoiding the cost of frivolous appeals and our holding in Ribero that an appeal of a denial of a motion to withdraw a guilty plea requires a certificate of probable cause. Under the rule set forth in Osorio, in any case in which a defendant’s motion to withdraw the plea was denied because there was no nonfrivolous issue, the defendant nevertheless could pursue an appeal without a certificate as long as the issues were framed so as to request a remand for further proceedings, rather than a reversal of the trial court’s ruling. As we stated in Ribero, however, “If a defendant challenges the validity of his plea by way of a motion to withdraw the plea, he cannot avoid the requirements of section 1237.5 by labelling the denial of the motion as an error in a proceeding subsequent to the plea.” (Ribero, supra, 4 Cal.3d at pp. 63-64.) Likewise, a defendant should not be able to avoid the requirements of section 1237.5 and pursue a frivolous appeal by labeling counsel’s conduct at the hearing as an error in a proceeding conducted subsequent to the plea.

Basing the certificate requirement on whether or not the appellate court must directly address the validity of the defendant’s plea would complicate the process for determining whether a certificate is required or warranted, to the detriment of a defendant’s right to appeal. Section 1237.5 does not impede a defendant’s right to appeal any nonfrivolous issue unless either the defendant errs in failing to seek a certificate or the trial court errs in refusing to issue one. The frequency of such errors likely would increase if we were to adopt the rule proposed by defendant. A defendant seeking to appeal after denial of a motion to withdraw would have to closely examine the potential appellate issues to determine whether the appropriate remedy for each would be a remand for further proceedings or a reversal of the trial court’s ruling. If the defendant erred in assessing the appropriate remedy and pursued the appeal without seeking a certificate, the appeal ultimately would be dismissed. (See People v. Kaanehe, supra, 19 Cal.3d at p. 9.) If the trial court failed to issue a certificate based upon its erroneous conclusion that the issues raised by the defendant did not require one, an appeal could proceed only on the noncertificate issues. On the other hand, requiring a certificate for all issues related to a motion to withdraw a plea would reduce the likelihood that the opportunity to appeal might be lost due to erroneous failures (by the court or by counsel) to correctly determine which issues require a certificate. Furthermore, as noted above, the identification of even one nonfnvolous issue in the defendant’s request would warrant the issuance of a certificate — a circumstance that would permit the defendant to proceed with an appeal in which all issues could be raised. (See People v. Hoffard, supra, 10 Cal.4th at pp. 1176-1180.)

Finally, the circumstance that the appeal in the present case is based upon trial counsel’s alleged refusal to assist defendant in moving to withdraw his plea does not warrant creation of a new exception to the certificate requirement. Defendant contends that we should draw a distinction between the type of claim raised in the present case and in Brown, supra, 179 Cal.App.3d 207 — that counsel refused entirely to represent the defendant on the motion to withdraw the plea — and a claim that counsel who did present such a motion provided ineffective assistance. Defendant concedes that a certificate is required in the latter type of case. In that situation, as with most ineffective-assistance-of-counsel claims, a defendant would have to show not only that counsel’s performance fell below an objective standard of reasonableness under prevailing professional norms, but also would have to show prejudice. (Strickland v. Washington (1984) 466 U.S. 668, 694 [80 L.Ed.2d 674, 104 S.Ct. 2052].) In order to determine whether counsel’s alleged inadequacy in presenting the motion was prejudicial, the appellate court would have to address the merits of the motion to withdraw. Consequently, as defendant concedes, a certificate would be required.

In contrast, defendant argues, when counsel violates a duty to present the withdrawal motion on a defendant’s behalf, a remand is required without regard to prejudice and the appellate court need not reach the merits of the motion to withdraw. In Brown, for example, the defendant sought to withdraw his no contest plea, but counsel informed the trial court that she would not make the motion on her client’s behalf, stating that she did not believe there was a legal basis for it. (Brown, supra, 179 Cal.App.3d at p. 211.) The trial court permitted the defendant to state his reasons for wanting to withdraw the plea, and then denied his motion. The appellate court in Brown concluded that the decision to seek to withdraw a plea is a personal one that the defendant is entitled to make and that, even if counsel believes it is not in the client’s best interest, the attorney must make the motion if the client insists upon it unless, in counsel’s opinion, the motion “is frivolous or when to do so would compromise accepted ethical standards.” {Id. at p. 216.) The court reversed and remanded for the limited purpose of permitting the defendant to make a motion to withdraw the plea with the assistance of counsel, and did so without addressing whether counsel’s failure to argue the motion was prejudicial.

Assuming, without deciding, that the holding of Brown is correct and that no showing of prejudice is required to support a claim based upon counsel’s refusal to present a defendant’s withdrawal motion, defendant does not explain why it is inappropriate to require that such a claim be submitted to the trial court in the first instance for a determination of whether it is frivolous. Defendant contends that in situations in which counsel does not participate in the motion to withdraw the plea, the trial court not only is “deprived of a more informed discretion in ruling on the motion for withdrawal,” but is also “similarly disadvantaged when later faced with the decision whether to issue the certificate of probable cause. . . . [Sjuch a procedure obstructs rather than promotes the principles underlying the certificate requirements, for rather than screening out only the wholly frivolous appeals, some cases will be weeded out not because they are devoid of merit but because of the utter lack of advocacy in the proceedings.” When, as in the present case, the claim is not that the motion should have been granted but that there was an “utter lack of advocacy” in the presentation of the motion, the trial court is not disadvantaged in determining whether that lack of advocacy provides the basis for a nonfrivolous claim on appeal. Furthermore, the trial court need decide only whether the case presents “any cognizable issue for appeal which is not clearly frivolous and vexatious.” (People v. Holland, supra, 23 Cal.3d at p. 84.) It is not required to resolve the claim on the merits.

Additionally, even in a case in which the defendant seeks to withdraw the plea and counsel does not assist the defendant in presenting the motion, factual issues may exist as to whether counsel failed to participate in the motion for some allegedly invalid reason or instead refused for a valid reason, such as the lack of nonfrivolous grounds. Generally, if it cannot be determined from the record whether counsel had a reasonable strategic basis for acting or failing to act in the manner challenged, a claim of ineffective assistance “is more appropriately decided in a habeas corpus proceeding.” (People v. Mendoza Tello (1997) 15 Cal.4th 264, 266-267 [62 Cal.Rptr.2d 437, 933 P.2d 1134] [claim that trial counsel rendered ineffective assistance in failing to make a motion to suppress evidence was not suitable for resolution on appeal because the record did not show the reasons for counsel’s failure to do so].) If all appeals alleging that the defendant was deprived of effective representation on a motion to withdraw his or her plea were permitted to go forward without a certificate, many frivolous appeals likely would result. Requiring the trial court, which is familiar with the record, to determine in the first instance whether a nonftivolous claim exists serves the purposes of section 1237.5 without interfering with a defendant’s right to pursue a nonfrivolous appeal.

III.

For the reasons stated above, the decision of the Court of Appeal is affirmed.

Kennard, J., Baxter, J., Werdegar, J., Chin, J., Moreno, J., and Corrigan, J., concurred. 
      
      All further statutory references are to the Penal Code unless otherwise indicated.
     
      
      In People v. Smith, the defendant sought to withdraw his plea and, after that motion was denied, moved to substitute counsel pursuant to People v. Marsden (1970) 2 Cal.3d 118 [84 Cal.Rptr. 156, 465 P.2d 44] (Marsden). We held that in ruling on a postconviction Marsden motion, the trial court must apply the same standard it would apply in ruling on a preconviction Marsden motion: substitute counsel should be appointed when, “in the exercise of its discretion, the court finds that the defendant has shown that a failure to replace the appointed attorney would substantially impair the right to assistance of counsel [citation], or, stated slightly differently, if the record shows that the first appointed attorney is not providing adequate representation or that the defendant and the attorney have become embroiled in such an irreconcilable conflict that ineffective representation is likely to result [citation].” (People v. Smith, supra, 6 Cal.4th at p. 696.)
     
      
      The requirements of section 1237.5 are implemented by California Rules of Court, rule 8.304(b), which provides that an appeal from a judgment after a plea of guilty or nolo contendere may proceed without a certificate if the notice of appeal states that the appeal is based on the denial of a motion to suppress evidence under section 1538.5 or on “[g]rounds that arose after entry of the plea and do not affect the plea’s validity.” (Cal. Rules of Court, rule 8.304(b)(4)(B).)
     
      
      Even if the appeal goes forward without a certificate of probable cause, based upon claims that do not require one, the defendant may not raise additional claims that do require a certificate. (People v. Mendez (1999) 19 Cal.4th 1084, 1104 [81 Cal.Rptr.2d 301, 969 P.2d 146]; People v. Kaanehe, supra, 19 Cal.3d at p. 9.)
     
      
      On the other hand, if a defendant claims on appeal that the sentence imposed violated a plea agreement, no certificate of probable cause is required even though the result of a successful appeal could be the withdrawal of the defendant’s plea. (See People v. Kaanehe, supra, 19 Cal.3d 1, 8 [no certificate required for the defendant’s appeal from a trial court’s denial of his motion to withdraw plea based upon district attorney’s violation of a plea agreement that required the district attorney to refrain from making any sentencing recommendation, but certificate required for challenges to the alleged failure of the trial court to warn the defendant of the effect of a guilty plea on his right of appeal and on the refusal of the trial court to grant a continuance — which “are clearly matters occurring before the entry of the plea and affecting the validity of the plea. . . . The determinative factor is when the claims upon which the motion was based arose and not when the motion to withdraw was denied.”]; In re Harrell (1970) 2 Cal.3d 675, 705-706 [87 Cal.Rptr. 504, 470 P.2d 640] [§ 1237.5 held not to apply where the defendant claimed on appeal that his motion to withdraw his guilty plea was improperly denied, the sentence imposed resulted from violation of the plea agreement, and the defendant had not been provided sufficient time to study the probation report prior to sentencing].) When the appeal is based upon violation of the plea agreement at sentencing, it is based upon alleged improprieties in the sentencing proceedings, and not upon any alleged invalidity of the guilty plea at the time it was entered.
     
      
      To the extent it might be argued that it is unreasonable to expect trial counsel to file a statement under section 1237.5 based upon counsel’s own inadequate representation, such concerns do not warrant creating an exception to the certificate requirement. If the defendant seeks to appeal after a guilty or no contest plea, trial counsel has the duty to assist the defendant in preparing and filing the required statement of grounds. (Ribero, supra, 4 Cal.3d at p. 66.) Trial counsel has options other than alleging his or her own error or incompetence, however; counsel may either “file the 1237.5 statement, instruct defendant how to file it, or secure other counsel for him.” (Id. at p. 65.)
     