
627 So.2d 543 (1993)
David L. STEPHENS, Appellant,
v.
STATE of Florida, Appellee.
No. 93-02759.
District Court of Appeal of Florida, Second District.
November 17, 1993.
*544 PER CURIAM.
David L. Stephens appeals the summary denial of his motion for post conviction relief in which he challenged his convictions and sentences for burglary and two counts of sexual battery. We reverse the sexual battery sentences because they exceed the statutory maximum. We otherwise affirm the trial court's order.
The appellant pleaded nolo contendere to burglary with an armed assault and two counts of sexual battery armed with a deadly weapon.[1] He was sentenced within the guidelines and within the terms of the plea agreement to three concurrent terms of seventy years' imprisonment followed by life probation. The recommended guidelines range was life, the permitted range, twenty-seven years to life. Nevertheless, we must reverse because the sexual battery sentences are unlawful.
The appellant has not waived the legality of his sentences even though he agreed to them and even though he failed to question them on appeal. See Stephens v. State, 595 So.2d 566 (Fla. 2d DCA 1992). A trial court cannot impose an illegal sentence pursuant to a plea bargain. Williams v. State, 500 So.2d 501 (Fla. 1986), receded from on other grounds, Quarterman v. State, 527 So.2d 1380 (Fla. 1988). A sentence that exceeds the maximum allowed by statute is fundamental error which can be raised at any time. Greenhalgh v. State, 582 So.2d 107 (Fla. 2d DCA 1991).
The sexual batteries for which the appellant was adjudicated guilty are life felonies, punishable by a term of imprisonment for life or a term of imprisonment not exceeding 40 years. Section 775.082(3)(a), Fla. Stat. (1987). When the trial court opts for a term of years instead of a life sentence, it may not impose a sentence longer than forty years. Sterling v. State, 584 So.2d 626 (Fla. 2d DCA 1991), rev. denied, 592 So.2d 682 (Fla. 1991); Greenhalgh v. State, 582 So.2d at 108. Moreover, the total duration of a split sentence must fall within the statutory maximum. Wilson v. State, 622 So.2d 529 (Fla. 2d DCA 1993). Thus, the concurrent seventy-year terms of imprisonment followed by life probation for the two sexual batteries exceed the maximum provided by law.
The burglary sentence, however, is not excessive because it is a first-degree felony punishable by life. See Wilson v. State, 622 So.2d at 530. This felony is punishable by a "term of years not exceeding life imprisonment." Sections 810.02(2) and 775.082(3)(b), Fla. Stat. (1987). The appellant's *545 sentence of seventy years' imprisonment followed by life probation for burglary is thus lawful, being within statutory limits.
Accordingly, we affirm all convictions, affirm the sentence for burglary, and vacate the sentences for sexual battery and remand for resentencing.
Affirmed in part; reversed in part.
SCHOONOVER, A.C.J., and THREADGILL and BLUE, JJ., concur.
NOTES
[1]  Sections 810.02(2)(a)(b) and 794.011(3), Fla. Stat. (1987).
