
82 Cal.App.3d 909 (1978)
147 Cal. Rptr. 554
THE PEOPLE, Petitioner,
v.
THE SUPERIOR COURT OF LOS ANGELES COUNTY, Respondent; JAMES FRANK SMITH, Real Party in Interest. THE PEOPLE, Petitioner,
v.
THE SUPERIOR COURT OF LOS ANGELES COUNTY, Respondent; LEAL ATKINS, Real Party in Interest.
Docket Nos. 53512, 53483.
Court of Appeals of California, Second District, Division Two.
July 19, 1978.
*911 COUNSEL
John K. Van de Kamp, District Attorney, Arnold T. Guminski, Donald J. Kaplan and Eugene D. Tavris, Deputy District Attorneys, for Petitioner.
*912 No appearance for Respondent.
Wilbur F. Littlefield, Public Defender, Dennis A. Fischer, Carol Hawes, Robert Reback and G. Keith Wisot, Deputy Public Defenders, for Real Parties in Interest.
OPINION
COMPTON, J.
In two unrelated cases the District Attorney of Los Angeles County petitioned this court for a writ of mandate to compel the superior court of that county to vacate orders accepting pleas of guilty in one case and a plea of nolo contendere in the other. Because the cases present a single common, but important issue, we granted the alternative writs and consolidated them.
In each case the trial judge in advance of accepting the plea or pleas and prior to receipt of any probation report, advised the defendant of what sentence would be imposed if defendant pleaded guilty, with the sole caveat that if the probation investigation disclosed significant, theretofore unknown, facts which would alter the judge's assessment of the case the defendant would be permitted to withdraw his plea.
As of the date of the filing of the petitions for mandate and as of this date sentence has not been pronounced nor has either defendant sought to withdraw his plea.
The district attorney's contention is that the trial court, in each instance, improperly entered into a "plea bargain" with the defendant without the district attorney's concurrence.
In the case of People v. Superior Court (James Frank Smith, Real Party in Interest; Super. Ct. L.A. Co., No. A327932) defendant was charged with assault with a deadly weapon (Pen. Code, § 245, subd. (a)) and it was alleged that he had suffered a prior felony conviction for burglary.
Prior to accepting defendant's plea, the court on the record engaged in a colloquy with counsel for both sides. The prosecutor asserted that defendant was guilty of an unprovoked assault on the victim which resulted in extensive hospitalization and permanent injury. Defense *913 counsel alleged that defendant was engaged in self-defense and that the victim himself was a violent person.
Without any available means of resolving that conflict and apparently without any indication that such resolution was significant, the trial judge declared that, if defendant pleaded nolo contendere, the crime would be reduced to a misdemeanor and defendant would serve no additional time in jail.[1] Defendant then pleaded nolo contendere to the offense as charged and admitted the prior conviction.
The judge then reiterated that in the event "... the probation report ... brings forth information that the court does not know, the court will invoke 1192.5 of the Penal Code[[2]] and give the defendant the opportunity to set aside his plea if I feel that the indicated sentence would not be appropriate. I want both the defendant and counsel to know that the court reserves that statutory discretion under 1192.5." (Italics added.)
In the case of People v. Superior Court (Leal Atkins, Real Party in Interest, Super. Ct. L.A. Co., No. A613110) defendant was charged with 20 counts of robbery (Pen. Code, § 211), one count of assault with a deadly weapon (Pen. Code, § 245, subd. (a)) and one count of an ex-felon in possession of a firearm (Pen. Code, § 12021, subd. (a)). The information also contained enhancement allegations of firearm use (Pen. Code, § 12022.5) and a prior felony conviction. Our computation indicates that defendant faced the possibility of a sentence of approximately 30 years.
*914 The district attorney stated to the court that the charges were serious. He stated that defendant had physically assaulted a number of the victims in an attempt to obtain a combination to a safe and on one occasion had stuck a gun in a victim's mouth and chipped his teeth.
Again the trial judge (not the same judge as in Smith) in advance of accepting the plea of defendant, without the benefit of a probation report, declared that the sentence would be nine years but that defendant "... would have to plead guilty to all counts in order to take advantage of that." (Italics added.)
Defendant then pleaded guilty to all counts and admitted all enhancement allegations. This defendant has not yet been sentenced nor has he sought to withdraw his plea. The judge made no specific reference to Penal Code section 1192.5 but did advise defendant that matters developed in the probation report would permit the court to "... evaluate whether to proceed or honor the bargain. ..." (Italics added.) And that if the bargain was not honored, the plea would be withdrawn.
(1) We agree with the district attorney that in each case the trial judge "bargained" with the defendant to obtain a plea of guilty. In the Smith case the judge's specific reference to Penal Code section 1192.5, a statute generally considered to be authority for "plea bargaining," and in the Atkins case the judge's reference to "taking advantage of the offer" and to "honoring the bargain" make it clear that the offer of such leniency was designed to induce pleas from the defendants. Further, the procedure in each case was obviously designed to obviate any need for obtaining the prosecutor's concurrence. Thus Penal Code section 1192.5 is not authority for the procedure under review.
We are not unmindful of the burden placed on trial court calendars by the almost unmanageable volume of criminal cases. On the other hand, if we are ever to be successful in stemming the tide of crime we must maintain the dignity of our courts and the people's confidence in them.
(2) The traditional role of the judge, as envisioned by Penal Code section 1192.5, is one of approving or disapproving dispositions arrived at by counsel for defendant and the district attorney, who is the duly elected representative of the People. When the judge steps out of that role and bargains directly with the defendant as to the manner in which the judge's discretion will be exercised the dignity of the judiciary is impaired and public confidence in the judiciary is diminished.
*915 A practical consideration which deserves attention in evaluating the practice of circumventing the prosecutor's control over his cases is the problem of witnesses. It is not beyond the realm of possibility that if the trial judge, after accepting the plea and ostensibly disposing of the case, later changes his mind and permits the withdrawal of the plea, key witnesses may, in the interim, be lost to the prosecution. When the prosecutor participates in the bargaining process he is in a position to evaluate that possibility.
(3) Of course if a defendant simply pleads guilty as charged without any promise by the judge or prosecutor he cannot later set aside the plea simply because he believed he would receive a lesser sentence. (People v. Dabner, 153 Cal. 398 [95 P. 880]; People v. Fratianno, 6 Cal. App.3d 211 [85 Cal. Rptr. 755]; People v. Bechtel, 124 Cal. App.2d 659 [268 P.2d 1072].) In the procedure followed in these cases the defendant was assured that if the sentence was not as promised, the plea could be withdrawn.
(4) Having expressed these views, however, we must conclude that under the present state of the law the district attorney's petition for mandate will not lie. The bargains which were struck are ones which do not require the concurrence of the district attorney.
As noted earlier the orders which the district attorney seeks to set aside were merely acceptances by the court of defendants' pleas of guilty or nolo contendere to all charges lodged against them.
It is the function of the prosecution to charge the offenses alleged to have been committed by the defendant. If the defendant pleads not guilty, the action, unless otherwise dismissed, must go to trial. The defendant may bargain with the prosecutor to be permitted to plead to a lesser charge and such a bargain must be approved by the court. (Pen. Code, §§ 1192.1, 1192.2; 1192.4, 1192.5.)
The defendant may plead guilty to all charges and when he does so all that remains is the pronouncement of judgment and sentencing. There is no requirement that the prosecutor consent to a guilty plea. (Pen. Code, § 1016, subd. 1.) The former requirement that a plea of nolo contendere be consented to by the district attorney was deleted in 1975. (Pen. Code, § 1016, subd. 3, as amended.)
(5) Further, it has been held that Penal Code section 1192.5 cannot constitutionally be construed to prevent a trial judge from indicating what *916 sentence he will impose if a given set of facts is confirmed, irrespective of whether guilt is adjudicated at trial or admitted by plea. (People v. Superior Court (Felmann), 59 Cal. App.3d 270, 273, 275 [130 Cal. Rptr. 548].) The matter of ultimate sentencing is a matter of judicial discretion to be exercised within limits prescribed by the Legislature.
(6) The order accepting a plea of guilty or nolo contendere to a crime or crimes as charged in the information or indictment is not appealable (Pen. Code, § 1238) nor may it be attacked by way of an extraordinary writ. (People v. Drake, 19 Cal.3d 749 [139 Cal. Rptr. 720, 566 P.2d 622].)
The judge's statement of his intention is not something that can be reviewed or set aside. The district attorney makes no contention that if the indicated sentences are actually imposed they would be illegal or in excess of the court's jurisdiction.
The alternative writs are discharged and the petitions for a peremptory writ are denied.
Roth, P.J., and Fleming, J., concurred.
A petition for a rehearing was denied August 11, 1978, and petitioner's application for a hearing by the Supreme Court was denied September 14, 1978. Clark, J., was of the opinion that the petition should be granted.
NOTES
[1]  Apparently defendant had previously spent about two weeks in custody prior to being released on his own recognizance.
[2]  Penal Code section 1192.5 provides in part:

"Upon a plea of guilty or nolo contendere to an accusatory pleading charging a felony, the plea may specify the punishment to the same extent as it may be specified by the jury on a plea of not guilty or fixed by the court on a plea of guilty, nolo contendere, or not guilty, and may specify the exercise by the court thereafter of other powers legally available to it.
"Where such plea is accepted by the prosecuting attorney in open court and is approved by the court, the defendant, except as otherwise provided in this section, cannot be sentenced on such plea to a punishment more severe than that specified in the plea and the court may not proceed as to such plea other than as specified in the plea.
"If the court approves of the plea, it shall inform the defendant prior to the making of the plea that (1) its approval is not binding, (2) it may, at the time set for the hearing on the application for probation or pronouncement of judgment, withdraw its approval in the light of further consideration of the matter, and (3) in such case, the defendant shall be permitted to withdraw his plea if he desires to do so. The court shall also cause an inquiry to be made of the defendant to satisfy itself that the plea is freely and voluntarily made, and that there is a factual basis for such plea."
