
640 So.2d 103 (1994)
Alan CHENEY, Appellant,
v.
STATE of Florida, Appellee.
No. 93-2320.
District Court of Appeal of Florida, Fourth District.
July 20, 1994.
Rehearing Denied September 14, 1994.
*104 Richard L. Jorandby, Public Defender, and Paul E. Petillo, Asst. Public Defender, West Palm Beach, for appellant.
Robert A. Butterworth, Atty. Gen., Tallahassee, and James J. Carney, Asst. Atty. Gen., West Palm Beach, for appellee.
PER CURIAM.
Alan B. Cheney appeals from an order revoking his probation. Cheney had previously entered into a plea agreement which imposed probation for two separate offenses. He was sentenced as an habitual felony offender to five years probation with a special condition that he serve one year in the Sheriff's Drug Farm Program in one case, and to five years probation with a special condition that he serve six months in the Drug Farm program in the other case. The two five-year probation terms were to be served concurrently, while the terms in the Drug Farm Program were to be served consecutively, with the six-month term to be served following the one-year term.
Because of his "unsuccessful discharge" from the program on March 25, 1993, for noncompliance with the program rules, Cheney failed to complete his second term in the program. As a result, on April 1, 1993, he was charged with violating his probation in both cases. The trial court found him guilty and revoked his probation, spawning this appeal.
The appellant argues that the trial court erred in revoking his probation. He contends that the special condition of his probation requiring that he successfully serve six months in the county drug farm consecutive to the one-year term was illegal since a defendant cannot be sentenced to a county jail facility for more than one year for felony offenses.
The appellant appears to be correct in this contention. If sentences for various pending felony offenses are imposed at the same sentencing hearing, they may not cumulatively exceed one year in a county facility. Singleton v. State, 554 So.2d 1162, 1163 (Fla. 1990) (consecutive county jail sentences which cumulatively exceed one year can only be imposed where imposition occurs in separate sentencings and involves unrelated offenses); Kline v. State, 509 So.2d 1178, 1180 (Fla. 1st DCA 1987) (sentence imposing two consecutive 364-day county jail terms for commission of felony and misdemeanor, with second jail term being a condition of probation on felony conviction, violated section 922.051 which prohibits imposition of county jail term for felony conviction such that total of prisoner's cumulative county jail terms exceeds one year); Cigelski v. State, 470 So.2d 46, 47 (Fla. 1st DCA 1985) (incarceration for felonies may not cumulatively exceed one year if county facilities are used); Fla. Stat. § 922.051 (1991).
The state does not dispute appellant's contention that the special condition of probation was illegal. Instead it contends that the appellant bargained for his probation and that a defendant cannot accept and enjoy probation and then challenge it as illegal after violating its terms. The state cites Madrigal v. State, 545 So.2d 392 (Fla. 3d DCA 1989), and the cases cited therein, to support its argument. In Madrigal, the state agreed to waive the mandatory minimum sentence for the defendant's drug offense in exchange for the defendant's assistance in two murder investigations. Id. at 393. After the defendant failed to perform his part of the bargain, the prosecution declined to waive the mandatory minimum sentence and the trial judge sentenced the defendant accordingly. Id. The defendant, while seeking to enjoy the benefits of the bargain with respect to the waiver of the mandatory minimum term, claimed in his appeal of the denial of his motion to set aside *105 his sentence, that the plea agreement was unenforceable because the prosecution was not statutorily authorized to waive the mandatory minimum in exchange for cooperation in non-drug related offenses. Id. at 393-394. The Third District found that, although the prosecution was not statutorily authorized to waive the mandatory minimum sentence, it was not precluded from doing so either. Id. at 395. Since the trial court would therefore have had the judicial power and jurisdiction to impose the agreed-to sentence pursuant to the plea agreement, the plea agreement was enforceable. Id. at 394-395. The Third District in Madrigal cited a number of cases holding that a defendant could not challenge the legality of his probation after having enjoyed its benefits and violated its terms. 545 So.2d at 394. See, e.g., Clem v. State, 462 So.2d 1134 (Fla. 4th DCA 1984); King v. State, 373 So.2d 78 (Fla. 3d DCA 1979), cert. denied, 383 So.2d 1197 (Fla. 1980). However, as the Third District emphasized in its opinion, the underlying rationale of these cases was that the trial court had the judicial power and jurisdiction to impose the sentence agreed to pursuant to the plea bargain. Madrigal, 545 So.2d at 394. See, e.g., Clem, 462 So.2d at 1134 (trial court could revoke appellants' probation despite error in placing appellants on probation rather than in community control program because appellants accepted benefits of such placement and error was not jurisdictional); King, 373 So.2d at 78 (in revocation of probation case, appellant after having enjoyed and violated his probation could not attack legality of such probation on basis that statute under which he was charged required mandatory minimum term of imprisonment rather than probation, since an inadequate sentence is not void).
The issue therefore is whether the trial court had the judicial power to impose the special condition of probation in the instant case or whether the special condition was void. If the special condition was void, then the situation would be governed by Purvis v. Lindsey ex rel. State, 587 So.2d 638 (Fla. 4th DCA 1991), which holds that a defendant does not waive his right to contest an illegal sentence because the sentence was the result of a negotiated plea agreement, since a defendant cannot acquiesce in an illegal sentence. Id. at 639.
Sentences which exceed the maximum permitted by law are considered void to the extent by which they exceed the statutory maximum. Pahud v. State, 370 So.2d 66, 67 (Fla. 4th DCA 1979). Since the special condition of probation provides for a term of imprisonment in a county facility which exceeds that permitted by law, that condition is void. Its invalidity could not therefore be waived by the appellant as a result of his plea agreement and his probation could not be revoked for violating this condition. See White v. State, 606 So.2d 1265 (Fla. 1st DCA 1992) (probation cannot be revoked or its terms modified for violating an invalid condition). The trial court therefore erred in revoking the appellant's probation on this basis.
When a sentence has been reduced in contravention of a plea bargain, the state should be given the option of either agreeing that both the judgment and the sentence should be vacated and taking the defendant to trial on all original charges, or agreeing that only the excessive sentence should be vacated. See Jolly v. State, 392 So.2d 54, 56 (Fla. 5th DCA 1981).
We therefore reverse and remand to permit the state to exercise its option under Jolly. Resolution of this issue renders moot the additional points on appeal.
REVERSED AND REMANDED.
DELL, C.J., HERSEY, J., and DAUKSCH, JAMES C., Jr., Associate Judge, concur.
