
486 So.2d 453 (1986)
Ex parte Ronnie CASSADY
(Re Ronnie Cassady v. State of Alabama).
84-615.
Supreme Court of Alabama.
January 10, 1986.
Linda S. Perry, Mobile, for petitioner.
Charles A. Graddick, Atty. Gen. and Gerrilyn V. Grant, Asst. Atty. Gen., for respondent.
MADDOX, Justice.
Petitioner Ronnie Cassady was indicted in Mobile County on three separate charges of selling illicit drugs, in violation of Code 1975, § 20-2-70, the Alabama Uniform Controlled Substances Act. The charges were consolidated for trial and the jury convicted Cassady on all three counts. The trial court, based on the jury's recommendation, assessed a fine of $25,000 per conviction and sentenced petitioner to life imprisonment because of his status as a habitual offender under Code 1975, § 13A-5-9.
Cassady claims that his trial on these charges breached a negotiated plea agreement with the Mobile County District Attorney's Office reached in an earlier proceeding, and that the indictments on these charges should have been dismissed pursuant to the terms of that agreement.
Prior to deciding this issue, the Court of Criminal Appeals remanded the cause to the trial court for an evidentiary hearing to determine the extent of the plea bargaining agreement. The trial court found that Cassady and his attorney believed that a plea of guilty to six cases which were pending against Cassady would constitute a full and *454 final settlement of all cases which could be brought against him for all crimes he committed before April 4, 1983, the date of the sentencing hearing. In other words, Cassady understood that he would not be tried for the present charges; however, the trial court also determined that the district attorney's office was not aware that these three charges were pending against Cassady until April 14, 1983. The Court of Criminal Appeals held that, based on these facts, these charges could not have been the subject of negotiations between Cassady's counsel and the district attorney, and that the agreement was void because there was no "meeting of the minds." 486 So.2d 449. We find the judgment of the Court of Criminal Appeals to be erroneous, and we reverse.
We make this determination based upon what transpired at Cassady's initial sentencing hearing. We set out a substantial portion of the record of that proceeding in order to show why we are of the opinion that the state and Cassady entered into a plea bargain agreement which was accepted by the trial judge at that time:
"THE COURT: You understood that your lawyers have been engaged with plea bargaining with the District Attorney?
"THE DEFENDANT: Yes, sir.
"THE COURT: And you approved of that?
"THE DEFENDANT: Yes, sir.
"THE COURT: And do you now plead guilty to Possession of Burglary Tools, as charged in the indictment in CC82-3460?
"THE DEFENDANT: Yes, sir.
"THE COURT: And do you now plead guilty to Receiving Stolen Property, 2nd Degree, as charged in the indictment in case number CC82-3461?
"THE DEFENDANT: Yes, sir.
"THE COURT: Do you now plead guilty to Theft of Property, 2nd Degree, as charged in the Solicitor's Information in case number CC83-1013?
"THE DEFENDANT: Yes, sir.
"THE COURT: Do you now plead guilty to Theft of Property, 2nd Degree, as charged in the Solicitor's Information in case number CC83-1014?
"THE DEFENDANT: Yes, sir.
"THE COURT: Do you now plead guilty to Criminal Possession of a Forged Instrument, as charged by the Solicitor's Information in case number CC83-1015?
"THE DEFENDANT: Yes, sir.
"THE COURT: And do you now plead guilty to Possession of a Forged Instrument, as charged in the Solicitor's Information in case number CC83-1016?
"THE DEFENDANT: Yes, sir.
"* * *
"THE COURT: All right.
What did y'all work out?
"MR. THETFORD: Judge, the State's going to recommend a 15-year sentence to serve in case number CC82-3460, and the State would recommend a 15-year sentence to serve in the other cases, to run concurrent with 3460.
"THE COURT: I've already asked you if you have anything to say before I pass sentence on you. Do you have anything to say now?
"THE DEFENDANT: No, sir.
"THE COURT: It is the judgment and sentence of this Court that you be imprisoned in the state penitentiary for a period of 15 years in each one of these cases. I'm going to order that all of these sentences run concurrently.
"MR. THETFORD: Your Honor, I have some certified copies of the defendant's prior convictions. I'd like to introduce them for the record, if I may.
"THE COURT: Mark those into evidence and put them with the record.
"MR. MURPHY: Judge, could you enter in your order, also, that he be immediately transferred to a state penitentiary, so that they won't hold him over here in the county jail? He needs to be removed from this facility here to a state penitentiary as soon as possible. If you can do that.
"THE COURT: I do have the right to do that?

*455 "MS. BEDWELL: Yes, sir. You can order it, for what it's worth.
"THE COURT: All right. Let it be ordered that he forthwith be carried to the state penitentiary to begin serving his sentence.
"MR. ORSO: Judge, also, there's an understanding with the D.A.'s Office that any other cases that are coming up through the pipe now would be disposed of. The understanding was that this would take care of all of his pending cases at this time.

"THE COURT: Let me warn you of this now: You'd better shape up while you're serving out this term, and make up your mind you're going to go straight from now on and work for a living, because you might hit some judge who won't listen to these folks when they offer you clemency. I'm one that might very likely send you off for life without parole.
"THE DEFENDANT: Yes, sir.
"THE COURT: Okay." (Emphasis added.)
A succinct statement of the law of this state regarding plea bargains is contained in Ex parte Yarber, 437 So.2d 1330, 1335 (Ala.1983). In that case, this Court stated:
"Negotiated pleas, thus, serve a valuable role in the criminal justice system. If the integrity of that role is to be maintained, certainty must prevail. The state need not enter into a plea agreement. It may choose not to do so, and proceed to trial on any case. The United States Supreme Court states there is no constitutional right to a negotiated plea. Weatherford v. Bursey, 429 U.S. 545, 97 S.Ct. 837, 51 L.Ed.2d 30 (1977). However, once the state chooses to make an agreement, it should not be allowed to repudiate that agreement with impunity. State v. Brockman, 277 Md. 687, 357 A.2d 376 (1976) (cited with approval in Kisamore v. State, [286 Md. 654, 409 A.2d 719 (1980)]). A contrary result would not encourage a defendant to come to grips with the moral and strategic considerations necessary to accepting a negotiated plea, and pleading guilty, if he knows the very agreement he must consider is subject to unilateral speculation by the state. If we allow the state to dishonor at will the agreements it enters into, the result could only serve to weaken the plea negotiating system. Such a result also is inconsistent with the `honesty and integrity' encouraged by Canon 1, Alabama Code of Professional Responsibility."
While we recognize that, in an ordinary case, we would accord much weight to the findings of fact made by a trial court on questions such as were here involved, we believe the record of the initial sentencing hearing here shows, as a matter of fact and law, that a plea bargain agreement had been reached between the state and the defendant, and expressly accepted and approved by the trial judge. At that hearing, as is shown by the portion of the transcript quoted above, Cassady's counsel stated, as follows:
"MR. ORSO: Judge, also, there's an understanding with the D.A.'s office that any other cases that are coming up through the pipe now would be disposed of. The understanding was that this would take care of all of his pending cases at this time."
The State did not object to this interpretation of the plea bargain made by defendant's counsel. Consequently, we hold that the trial court, by accepting Cassady's plea of guilty, necessarily accepted the plea bargain as it was explained by Cassady's attorney. At that time, the attorney's statement was the only evidence of the contents of that agreement presented to the court, and, thus, it represented the agreement that the court was accepting. By remaining silent, the State, at least implicitly, agreed not to prosecute Cassady for the drug charges involved here, if he pleaded guilty to the charges then before the trial court.
The court's admonition to the defendant to "shape up" while serving the sentence imposed upon him also indicates that the sentencing judge contemplated that all prior *456 offenses were included in the plea bargain, because his admonition obviously referred to conduct of the defendant in the future.
This Court has on other occasions been confronted with the problem presented by this case, that is, whether the state and the defendant actually had entered into a plea bargain agreement, and we take this opportunity to point out a suggested solution of the matter.
The problem involved here could have been easily avoided had the plea agreement been written and all the terms and conditions made a part of the writing. If parties would reduce their plea agreements to writing, and present them to the trial court prior to sentencing, rather than afterward, as was done here, resolution of cases questioning the existence or contents of plea agreements would be greatly facilitated. The record would also show whether or not the trial court had accepted the plea agreement.
REVERSED AND RENDERED.
TORBERT, C.J., and FAULKNER, JONES, ALMON, SHORES, BEATTY, ADAMS and HOUSTON, JJ., concur.
