
6 Cal.3d 305 (1971)
491 P.2d 406
98 Cal. Rptr. 822
THE PEOPLE, Plaintiff and Respondent,
v.
JOHN STANLEY FLORES, Defendant and Appellant.
Docket No. Crim. 15577.
Supreme Court of California. In Bank.
December 14, 1971.
*307 COUNSEL
Richard A. Townsend, under appointment by the Supreme Court, for Defendant and Appellant.
Thomas C. Lynch and Evelle J. Younger, Attorneys General, William E. James, Assistant Attorney General, and Mark L. Christiansen, Deputy Attorney General, for Plaintiff and Respondent.
OPINION
McCOMB, J.
Defendant appeals from a judgment entered following a plea of guilty to armed robbery (Pen. Code, §§ 211, 213).
Facts: By a fifteen-count indictment, defendant was accused of four counts of unlawful entry with intent to commit theft (Pen. Code, § 459), three counts of grand theft (Pen. Code, § 487, subd. 1), three counts of receiving stolen property (Pen. Code, § 496, subd. 1), one count of cultivating marijuana (Health & Saf. Code, § 11530.1), one count of forcefully violating another's personal liberty (Pen. Code, §§ 236, 237), one count of assault with a deadly weapon upon the person of a peace officer (Pen. Code, § 245, subd. (b)), one count of deterring police performance (Pen. Code, § 69), and one count of robbery (Pen. Code, § 211).
Defendant entered a plea of guilty to the robbery count, which reads: "On or about December 20, 1969 [defendant] did feloniously rob a person of personal property, by means of force and fear, in violation of Penal Code section 211. And, it is further alleged that the defendant committed the above robbery while armed with a deadly weapon."
Before accepting the plea, the trial court conducted a thorough examination, which went beyond the requirements of In re Tahl, 1 Cal.3d 122 [81 Cal. Rptr. 577, 460 P.2d 449]. The district attorney had agreed to dismiss all remaining counts if defendant pleaded guilty to first degree robbery, and such counts were dismissed following acceptance of defendant's plea.
*308 After acceptance of the plea, the court asked defendant how the crime had been committed. He testified, "I walked into the store and pulled a [loaded .22 automatic] on this dude, and told him to give me all of his money."
The trial court later entered judgment of conviction, with the following notation in the sentencing provisions thereof: "At the time of the commission of the offense, sections 3024 and 12022 of the Penal Code were inapplicable[1] but defendant was armed within the meaning of sections 1203 and 12022.5 of the Penal Code, and the weapon was of the type commonly known as a .22 calibre revolver."
Section 12022.5 of the Penal Code reads: "Any person who uses a firearm in the commission ... of a robbery ... upon conviction of such crime, shall, in addition to the punishment prescribed for the crime of which he has been convicted, be punished by imprisonment in the State prison for a period of not less than five years. Such additional period of imprisonment shall commence upon expiration or other termination of the sentence imposed for the crime of which he is convicted and shall not run concurrently with such sentence...."
Defendant filed a petition for writ of error coram nobis, complaining that he had been entitled to an examination to determine if he were a narcotic addict, and at the same time separately gave notice that if the petition was denied, he exercised his right of appeal to the Court of Appeal. The petition was considered to be a statement of grounds for an appeal from a judgment entered upon a plea of guilty, and the trial court ordered that it be filed as a notice of appeal under rule 31(d) of the California Rules of Court.[2]
(1a) Questions: First. Under the facts of this case, may defendant properly be subjected to the additional five-year term required by section 12022.5 of the Penal Code where a firearm has been used in the commission of a robbery?
No. In entering his plea of guilty, defendant in effect bargained for a sentence of no greater than imprisonment for five years to life. (2) Plea bargaining has become an accepted practice in American criminal procedure (People v. West, 3 Cal.3d 595, 604 [91 Cal. Rptr. 385, 477 P.2d 409]); and where a defendant's guilty plea has been entered as part of *309 such a bargain with recognized authorities, and judgment entered contrary to the terms of the bargain, he may move to have his plea set aside, or the judgment may be modified to conform with the terms of his bargain.
(1b) The conclusion that a plea bargaining occurred in the present case is inescapable. The record shows that the indictment charged defendant with armed robbery and that prior to defendant's entering his plea of guilty the following proceedings occurred: "THE COURT: Do you wish to waive those rights [defendant's constitutional rights]? THE DEFENDANT: Yes, sir. THE COURT: To what crime? THE DEFENDANT: Armed robbery. THE COURT: Do you know what the maximum sentence you can get for that is? THE DEFENDANT: Five to life. THE COURT: Knowing that, you still wish to enter a plea of guilty? THE DEFENDANT: Yes, sir." Thus, defendant indicated in no uncertain terms, in the presence of the trial judge, the deputy district attorney, and defense counsel, his understanding that the maximum penalty which could be imposed upon him was imprisonment for five years to life.
As hereinabove appears, under section 12022.5 of the Penal Code, an additional five-year prison term is mandatory where a robbery is committed by one armed with a firearm. No one, however, advised defendant, at the time he entered his plea of guilty, that the law requires the imposition of this additional five-year term; and he was allowed to continue in the belief that the maximum penalty which could be meted out to him was imprisonment for five years to life. Under the circumstances, we hold that in entering his plea defendant bargained with recognized authorities for a sentence of no more than imprisonment for five years to life and that he must be given the benefit of his plea bargain.
(3) Second. Did the trial court abuse its discretion in denying defendant's request that proceedings be suspended under section 3051 of the Welfare and Institutions Code?
No. At the time of sentencing, defendant requested that proceedings be suspended under section 3051 of the Welfare and Institutions Code and that he be examined by medical doctors to determine if he was addicted, or in imminent danger of becoming addicted, to heroin. The trial court denied defendant's application for probation and sentenced him to state prison for the term prescribed by law, refusing defendant's request that civil commitment proceedings be instituted.
Section 3051 of the Welfare and Institutions Code provides, in part: "Upon conviction of a defendant for any crime in any superior court ... if it appears to the judge that the defendant may be addicted or by reason of repeated use of narcotics may be in imminent danger of becoming addicted *310 to narcotics he shall adjourn the proceedings or suspend the imposition or execution of the sentence and order the district attorney to file a petition for commitment of the defendant to the Director of Corrections for confinement in the narcotic detention, treatment and rehabilitation facility unless, in the opinion of the judge, the defendant's record and probation report indicate such a pattern of criminality that he does not constitute a fit subject for commitment under this section." (Italics added.)
Defendant has a number of burglary and other criminal charges in Hawaii on his record, including a second degree burglary conviction in 1956, for which he was sentenced to 10 years in prison (later released on parole), and a first degree burglary conviction in 1958, for which he was sentenced to 20 years in prison (later released on parole). His record also shows that he is presently in violation of his parole. In addition, the probation report shows that the probation officer disbelieved defendant's claim of being addicted, or in imminent danger of becoming addicted, to heroin.
In denying defendant's request, the judge noted his criminal record, the fact that the probation officer did not recommend suspension of the criminal proceedings, and the judge's own lack of belief that defendant was an addict or in imminent danger of becoming one. Accordingly, the trial court did not abuse its discretion when it refused to institute proceedings under section 3051 of the Welfare and Institutions Code. (People v. Sateriale, 247 Cal. App.2d 314, 315-317 [55 Cal. Rptr. 500].)
The judgment is modified by striking therefrom that portion which finds that defendant was armed within the meaning of section 12022.5 of the Penal Code. As so modified, the judgment is affirmed.
Wright, C.J., Peters, J., Tobriner, J., Mosk, J., Burke, J., and Sullivan, J., concurred.
NOTES
[1]  See People v. Floyd, 71 Cal.2d 879 [80 Cal. Rptr. 22, 457 P.2d 862], and People v. King, 71 Cal.2d 885 [80 Cal. Rptr. 26, 457 P.2d 866].
[2]  The trial court's order may be regarded as the certificate of probable cause required by section 1237.5 of the Penal Code to effect an appeal from a judgment of conviction upon a plea of guilty.
