
364 So.2d 575 (1978)
STATE of Louisiana
v.
Byron WADE.
Nos. 62046, 62784.
Supreme Court of Louisiana.
November 13, 1978.
James D. Sparks, Jr., Monroe, for defendant-relator.
William J. Guste, Jr., Atty. Gen., Barbara Rutledge, Asst. Atty. Gen., John T. Seale, Dist. Atty., George F. Fox, Jr., Asst. Dist. Atty., for plaintiff-respondent.
DIXON, Justice.
Defendant Byron Wade was charged by bill of information with distribution of marijuana in violation of R.S. 40:966(A). On March 8, 1978 defendant appeared in court with his retained counsel, withdrew his previous plea of not guilty after a colloquy and entered a plea of guilty as charged. Defense requested and received a delay in sentencing; on March 13, 1978 defendant *576 again appeared in court, represented by another attorney who had agreed to act in place of defendant's retained counsel, and asked to withdraw his guilty plea. When the trial judge denied defendant's motion, defense counsel then requested that imposition or execution of sentence be delayed. After denying both of these motions, the trial court sentenced defendant to serve two years imprisonment with the Louisiana Department of Corrections assigned to East Carroll Parish Farm with no passes for one year. Defendant appealed, relying on two assignments of error.

Assignments of Error Nos. 1 and 2
In Assignment No. 1 defendant argues that the trial court erred in denying defendant's motion to withdraw his plea of guilty pursuant to C.Cr.P. 559 which provides in part that the court may permit a plea of guilty to be withdrawn at any time before sentence. Defendant also contends that he was not, in effect, represented by counsel when sentenced. In Assignment No. 2 defendant contends that the plea bargain was not kept, and that his plea of guilty entered pursuant to the plea bargain should be withdrawn. Defendant contends that his attorney indicated that defendant would receive two years in parish jail and he was not advised of denial of passes.
The record indicates that on March 8, 1978, the day set for trial, defendant was in court with his retained counsel, Mr. Bassett, and the prosecuting attorney announced, "I believe, perhaps, a negotiated plea has been worked out in this case." Mr. Bassett indirectly agreed, stating, "At this time we wish to withdraw our formal plea of not guilty and enter a plea of guilty." The trial judge then proceeded to explain to the defendant his rights in a complete "Boykin" examination. Boykin v. Alabama, 395 U.S. 238, 89 S.Ct. 1709, 23 L.Ed.2d 274 (1969). The trial judge also informed the defendant that the maximum penalty for distribution of marijuana is "ten years and a fine up to fifteen-thousand dollars," and asked whether defendant had been advised by his lawyer of the negotiations between his attorney and the prosecutor about the sentence. The defendant said he understood it.
After the trial judge accepted defendant's guilty plea, the court was asked to delay sentencing until March 13, 1978, and was notified that Mr. Bassett, defendant's retained counsel, could not be present. All parties agreed to the substitution of Mr. Miller to represent defendant at the sentencing; the defendant again stated he understood the arrangement and had no objections. The court deferred sentencing and allowed defendant to remain free on bond, and dismissed the jury and witnesses.
On March 13, 1978 defendant appeared in court with Mr. Miller. The prosecutor announced that the defendant had informed him that he wished to retain new counsel and withdraw his plea of guilty. Upon questioning by the trial court, the prosecutor confirmed that there was a plea bargain that defendant would receive a two year sentence to the Department of Corrections with an initial assignment to the East Carroll Prison Farm. The judge added "and no passes for the period of one year." At this point Mr. Miller formally moved to withdraw the guilty plea and the trial court denied the motion.
Mr. Miller then moved to delay imposition or execution of sentence to enable defendant's newly retained counsel to take appropriate action on the motion to withdraw the plea of guilty. The trial court refused to grant the delay, again noting that the delay in sentencing was occasioned for the convenience of defendant, and formally sentenced defendant. Defendant then stated, "I want to say that I plead not guilty. I want to change to plead not guilty."
Subsequent to sentencing, Mr. Sparks, the newly retained attorney, filed an appeal in this court and a petition for writ of habeas corpus in the district court. Defense's petition for habeas asserted that the plea bargain entered into by defendant and the state was not kept and requested an evidentiary hearing "to present all facts with reference to the plea bargain, entrance of his plea of guilty, and otherwise . . ." When this writ application was denied by *577 the district judge, the defendant filed an application with this court requesting an evidentiary hearing on the issue. This court granted this application (No. 62784) and ordered an evidentiary hearing to determine the nature of the plea bargain and whether it had been violated.
At the conclusion of the evidentiary hearing the district court modified the sentence by eliminating reference to weekend passes, but otherwise held that the plea bargain had been kept.
The court may permit a plea of guilty to be withdrawn at any time before sentence, C.Cr.P. 559, but the discretion is vested in the trial judge. State v. Andrasi, 343 So.2d 175 (La.1977); State v. Baudoin, 334 So.2d 186 (La.1976); State v. Glantz, 254 La. 306, 223 So.2d 813 (1969). The validity of plea agreements and of guilty pleas entered pursuant to those agreements has been consistently upheld. See Wharton's Criminal Procedure, § 341 (pocket part) (Torcia, 13th ed. 1972), Blackledge v. Allison, 431 U.S. 63, 97 S.Ct. 1621, 52 L.Ed.2d 136 (1977); Santobello v. New York, 404 U.S. 257, 92 S.Ct. 495, 30 L.Ed.2d 427 (1971). However, where the state has not performed its part of the agreement, due process requires either specific performance of the promise by the prosecuting attorney or an opportunity for the accused to withdraw his guilty plea. Santobello v. New York, supra; State v. Crosby, 338 So.2d 584 (La.1976).
Defendant relies on State v. Baudoin, supra, a case before the court on application for habeas corpus after an evidentiary hearing, where this court found that the trial judge abused his discretion in denying the motion to withdraw the guilty pleas. In Baudoin, however, the evidence adduced from the evidentiary hearing showed that defendants entered their guilty pleas based on the representation by their defense counsel, who reasonably believed that a plea bargain existed as to the length of sentence and that the sentence actually imposed (six years) had no relation to the sentence that had been assured (six months).
In State v. Andrasi, supra, unlike Baudoin, the court concluded that the trial judge did not abuse his discretion in denying the motion to withdraw the guilty plea.
In the present case, defendant's answers to the trial judge's Boykin questions are convincing that defendant voluntarily waived his rights with full understanding of the consequences of his plea and the nature of his sentence. This court cannot find that the trial judge abused his discretion in denying defendant's motion to withdraw his guilty plea.
Defendant was effectively represented in the trial court, and there is ample evidence to conclude that the state substantially complied with the plea bargain.
The ruling of the district judge on the hearing concerning the plea bargain is affirmed, and the conviction and sentence are affirmed.
