
360 So.2d 79 (1978)
Miguel SEGARRA, Appellant,
v.
The STATE of Florida, Appellee.
No. 77-531.
District Court of Appeal of Florida, Third District.
May 30, 1978.
Rehearing Denied July 20, 1978.
Bennett H. Brummer, Public Defender and Beth C. Weitzner, Asst. Public Defender, for appellant.
Robert L. Shevin, Atty. Gen., for appellee.
Before HENDRY and BARKDULL, JJ., and PARKER, J. GWYNN (Ret.), Associate Judge.
PER CURIAM.
This is an appeal by the defendant, Miguel Segarra, from an order of revocation of probation, and a sentence to fifteen years in the state penitentiary.
The record reflects that defendant was charged by information with burglary. As a result of plea negotiations, it was agreed that defendant would plead guilty and that the maximum sentence he could receive would be five years in prison. This five year cap was stated on the record by the *80 trial judge, and is reflected in writing on the court file jacket.
Following a pre-sentence investigation, the trial judge placed defendant on five years probation with two conditions: (1) that he serve one year in the county jail, and (2) that he complete TASC, a drug rehabilitation program. Subsequently, an affidavit of violation of probation was filed and an evidentiary hearing was held. At the conclusion of the hearing, the trial judge found that defendant was "unsatisfactorily terminated" from the TASC program. An order of revocation of probation was entered and defendant was sentenced to fifteen years imprisonment.
The thrust of this appeal is that the trial court erred in imposing a sentence of fifteen years on violation of probation, where there had been an agreed maximum sentence of five years as a part of plea negotiations accepted and approved by and between defendant, prosecutor and judge. We agree.
The state urges us to base our decision in this case on the body of law emanating from Section 948.06, Florida Statutes (1975), which provides in pertinent part that if probation is revoked, the trial court shall
"... impose any sentence which it might have originally imposed before placing the probationer on probation."
In the leading Florida case, the Supreme Court held that a defendant placed on probation may be sentenced to imprisonment by the trial judge for the same period of years as the court could have imposed originally. State v. Jones, 327 So.2d 18 (Fla. 1976), as modified by State v. Holmes, 360 So.2d 380 (Fla. 1978).
While we recognize this to be the law of Florida, we do not find it to be directly applicable in the context of the instant case because the primary issue before us is not what the trial court might do in the absence of plea negotiations, but rather, the effect of plea negotiations and the agreed limitation of sentence. In this case, defendant's plea resulted from plea negotiations and rested on the trial court's and the prosecutor's promise that five years was the maximum penalty which he could receive.
As a general rule, in sentencing a defendant whose plea of guilty was the result of negotiations, the trial court must either impose a sentence in accordance with the plea bargain or vacate the judgment and allow withdrawal of the plea. Adams v. State, 328 So.2d 48 (Fla. 1st DCA 1978). As stated in Wood v. State, 357 So.2d 1060 (Fla. 1st DCA 1978), case no. HH-49, opinion filed April 21, 1978, the court may consider a bargained plea to have been tendered in reliance on a particular disposition and on the protective benefits of Florida Rules of Criminal Procedure 3.171 and 3.172.
In the case before us, the record shows that the negotiations were not based on the defendant being placed on probation. Rather, the agreement was that in exchange for entering a plea of guilty to the charge of burglary, the sentence imposed would be no greater than five years imprisonment. Under the circumstances presented, we hold that the maximum sentence which the trial court "might have originally imposed before placing the probationer on probation," was five years, pursuant to the plea negotiations which were approved by the court. Therefore, extending this reasoning to its logical conclusion, the maximum sentence which the court could impose upon violation of defendant's probation, was five years.
Accordingly, we reverse the sentence and remand the cause to the trial court with instructions to reduce the fifteen year sentence to no more than five years with credit for time served. The other point raised by defendant is deemed without merit and will not be discussed.
Reversed and remanded.
