Appellant was convicted of aggravated battery with a handgun and sentenced on April 28, 1983, as follows:
“To be imprisoned for a term of 5 years Youthful Offender, first 3 years, State Prison, The (sic) 2 yrs. Community Control”
“It is further ordered that the 3 year minimum provisions of F.S. 775.087(2) are hereby imposed for the sentence specified in this court, as the Defendant possessed a firearm.”
The record also contains an Order, dated May 9, 1983, which states:
“It is hereby ordered and adjudged that you be committed to the Department of Corrections for a term of three (3) years **, with credit for time served jail time; that after you have served _ of said term, you shall be placed on probation for a period of two (2) years under the supervision of the Department of Corrections ...”
“ **mand. min. 3 years”
The order of April 28, 1983, and the transcript of the sentencing proceeding indicate the trial judge contemplated classifying appellant as a youthful offender, pursuant to Chapter 958, Florida Statutes (1983). The record also demonstrates the trial judge felt the mandatory minimum sentence provided for in Section 775.087(2), Florida Statutes (1983), was indicated in view of the factual setting of this case. However, the two sentencing concepts are incompatible. If appellant is to be sentenced as a youthful offender he can be sentenced to the custody of the Department of Corrections for six years maximum but imprisoned for no more than four years, the balance to be served in a community control program. § 958.05(2), Florida Statutes (1981). If aggravating factors exist the trial judge can impose a minimum term of one year before eligibility for parole. § 958.05(3).
Thus, if the court intended to classify appellant as a youthful offender the sen- • tence to five years in prison is unlawful as is the three years mandatory minimum. On the other hand, a sentence of five years in prison with a three year mandatory minimum would be lawful if the court did not make use of the youthful offender statute.
We do not mean to indicate any preference in sentences. That is solely the trial judge’s function. We are compelled to vacate the sentence as it presently exists and remand the case to the trial court with directions to resentence appellant as the trial judge sees fit within the limitations set forth herein.
REVERSED AND REMANDED, with directions.
LETTS and HURLEY, JJ., concur.