
600 So.2d 11 (1992)
Mel T. WRIGHT, Appellant,
v.
STATE of Florida, Appellee.
No. 91-0547.
District Court of Appeal of Florida, Fourth District.
May 13, 1992.
Richard L. Jorandby, Public Defender, and Margaret Good, Asst. Public Defender, West Palm Beach, for appellant.
Robert A. Butterworth, Atty. Gen., Tallahassee, and Melynda L. Melear, Asst. Atty. Gen., West Palm Beach, for appellee.

ON MOTION FOR CLARIFICATION OR FOR REHEARING
PER CURIAM.
Appellant appeals from his sentence. We reverse and remand.
On April 27, 1990, appellant was charged by indictment with first degree murder (Count I), attempted first degree murder with a firearm (Count II), two counts of attempted robbery with a firearm (Counts *12 III and IV), armed burglary of a dwelling (Count V), and grand theft (Count VI).
On December 27, 1990, appellant signed a written plea agreement and pled nolo contendere to second degree murder with a firearm under Count I and the remaining offenses as charged. According to the terms of the plea agreement, the state would not seek a sentence in excess of sixty years, appellant could seek any guidelines or below guidelines sentence, and the mandatory sentences for use of a firearm would be concurrent. The trial court accepted appellant's plea.
According to his scoresheet, the recommended range for appellant's sentence was twenty-two to twenty-seven years and the permitted range was seventeen to forty years. Appellant urged the trial court to sentence him within the lower end of the recommended range. The prosecutor, on the other hand, asserted that appellant should be sentenced to the maximum term possible under the plea agreement, i.e., sixty years.
The trial court sentenced appellant to a sixty year term of imprisonment followed by ten years probation for second degree murder with a firearm (Count I), a concurrent sixty year term of imprisonment for attempted first degree murder with a firearm (Count II), two concurrent fifteen year terms of imprisonment for the attempted robbery convictions (Counts III and IV), a concurrent thirty year term of imprisonment for armed burglary of a dwelling (Count V), and a concurrent five year term of imprisonment for grand theft (Count VI). The mandatory minimum three year sentences for use of a firearm also were imposed concurrently.
Appellant correctly asserts that the sentences for Counts I and II must be reversed. Both second degree murder and attempted first degree murder are first degree felonies. §§ 777.04, 782.04(1)(a), 782.04(2), Fla. Stat. (1989). When these offenses are committed while the defendant is in possession of a firearm, they become life felonies. § 775.087, Fla. Stat. (1989). A person convicted of a life felony after October 1, 1983, may be punished "by a term of imprisonment for life or by a term of imprisonment not exceeding 40 years." § 775.082(3)(a), Fla. Stat. (1989). "In other words, whenever a court sentencing a life felony opts for a term of years in lieu of a life sentence, that court is limited to a sentence no harsher than forty years." Greenhalgh v. State, 582 So.2d 107, 107-08 (Fla. 2d DCA 1991). While life sentences would be permissible under the statutes, appellant's plea agreement provided for a maximum sentence of sixty years.
Although appellant did not object to his sentence below, "a sentence that exceeds the maximum allowed by statute is fundamental error which can be raised at any time." Id. at 108. Accordingly, we reverse appellant's sentences for Counts I and II and remand for resentencing. Our opinion should not be construed as precluding the use of consecutive sentences to accomplish the purposes embodied in the plea agreement provided only that the new sentences do not exceed sixty years and are not violative of the strictures of Blackshear v. State, 531 So.2d 956 (Fla. 1988).
GLICKSTEIN, C.J., and FARMER, J., concur.
STONE, J., concurs specially with opinion.
STONE, Judge, concurring specially.
I concur specially only to note that in my judgment the trial court also retains the option of rejecting the initial plea. In all other respects, I concur.
