
407 So.2d 223 (1981)
Stanley B. WILLIAMS, Appellant,
v.
STATE of Florida, Appellee.
No. 80-1934.
District Court of Appeal of Florida, Second District.
October 7, 1981.
On Rehearing November 20, 1981.
*224 Jerry Hill, Public Defender and Geoffrey A. Foster, Asst. Public Defender, Bartow, for appellant.
Jim Smith, Atty. Gen., Tallahassee, and Michael A. Palecki, Asst. Atty. Gen., Tampa, for appellee.
PER CURIAM.
Appellant, a juvenile, was charged with three counts of attempted first degree murder, two counts of robbery, one count each of kidnapping, aggravated battery, sexual battery and trespass with a firearm. After accepting appellant's plea of nolo contendere, the trial judge adjudged him guilty of the offenses charged and sentenced appellant to seven concurrent life sentences for each of the attempted murders, the robberies, the kidnapping and the sexual battery. He also sentenced appellant to fifteen years for the aggravated battery and five years for the trespass with a firearm, both concurrent with the life sentences and each other.
Appellant contends that the trial court committed error in not sentencing him pursuant to section 39.111(6)(c), Florida Statutes (1979). He also contends that his sentence is excessive. We agree.
Failure to comply with the safeguards of section 39.111(6) is harmful error. Eady v. State, 388 So.2d 9 (Fla.2d DCA 1980). Appellant was not sentenced in conformance with that statute and, therefore, his sentences are invalid.
Also, appellant's sentences for attempted first degree murder are excessive. The maximum sentence for attempted first degree murder is thirty years. § 777.04(4)(a), Fla. Stat. (1979). His three life sentences for attempted first degree murder were improper.
Accordingly, the judgment is affirmed, but the sentences are reversed and remanded with instructions to resentence appellant pursuant to section 39.111(6) and within the proper maximum sentences.
SCHEB, C.J., and HOBSON and CAMPBELL, JJ., concur.

ON MOTION FOR REHEARING
PER CURIAM.
For the first time on motion for rehearing, the state cites to us the applicability of section 775.087, Florida Statutes (1979), to support the three life sentences imposed upon conviction of three counts of attempted first degree murder. We agree that this statute is applicable. We regret the state did not see fit to cite it earlier or that we on our own did not determine its applicability.
By reason of that oversight, we were nearly led into the same apparent mistake that the supreme court was in King v. State, 390 So.2d 315 (Fla. 1980), which was *225 relied upon by the appellant in this cause to support his position that the life sentences were excessive. In King, the state conceded error in the imposition of a life sentence for attempted first degree murder committed while in possession of a weapon. By reason of the state conceding error and apparently failing to cite section 775.087, the supreme court there found there was no statutory provision authorizing life imprisonment for attempted first degree murder. Section 775.087 clearly provides that any first degree felony when committed with a weapon or firearm is enhanced to a life felony. We also note that that statute also provides that any person who is convicted of murder or sexual battery or an attempt to commit those crimes while in possession of a firearm shall be sentenced to a minimum mandatory term of imprisonment of three years.
The information here clearly charges appellant with the commission of the offenses while in possession of a firearm, and appellant's plea of nolo contendere was to "all crimes charged." The judgment and sentences of the court do not reflect specifically that the appellant was adjudicated guilty of the offenses while in possession of a firearm, though that is the obvious intent of the court as evidenced by its imposition of the life sentences. This court has previously recognized that the judgment and sentence must so reflect. Griffen v. State, 384 So.2d 324 (Fla.2d DCA 1980).
Accordingly, the judgment is affirmed but the case is remanded for correction of the judgment and sentences to reflect that the crimes of which appellant was convicted were committed while in possession of a firearm, and for compliance with section 39.111(6), Florida Statutes (1979). In so doing, the trial court should consider whether the three year minimum mandatory sentence provided in section 775.087 is applicable.
SCHEB, C.J., and HOBSON and CAMPBELL, JJ., concur.
