
807 So.2d 727 (2002)
Wallace WOODS, Appellant,
v.
STATE of Florida, Appellee.
No. 1D01-2951.
District Court of Appeal of Florida, First District.
February 8, 2002.
*728 Appellant, pro se.
Robert A. Butterworth, Attorney General, Office of the Attorney General, Tallahassee, for Appellee.
PADOVANO, J.
This is an appeal from an order denying a postconviction motion under rule 3.800(a) of the Florida Rules of Criminal Procedure. We conclude that the sentence imposed by the trial court was legal and therefore we affirm.
A jury found the defendant, Wallace Woods, guilty of robbery. He was adjudicated guilty by the court on April 4, 1997, and sentenced as a habitual felony offender to an extended term of twenty-five years in the Department of Corrections.[1] One of the prior crimes used as a predicate felony for the habitual offender sentence was burglary and the other was possession of cocaine. The defendant's conviction was affirmed on direct appeal in Woods v. State, 728 So.2d 213 (Fla. 1st DCA 1998), and he subsequently challenged the legality of his habitual offender sentence in a postconviction motion under rule 3.800(a). When the trial court denied the motion, the defendant appealed to this court.
To determine whether the sentence is legal, we must first consider the text of the applicable statute. Section 775.084(1)(a), Florida Statutes (Supp.1996) provides in material part:
(a) "Habitual felony offender" means a defendant for whom the court may impose an extended term of imprisonment, as provided in paragraph (4)(a), if it finds that:

*729 1. The defendant has previously been convicted of any combination of two or more felonies in this state or other qualified offenses.
2. The felony for which the defendant is to be sentenced was committed:
* * *
b. Within 5 years of the date of the conviction of the defendant's last prior felony or other qualified offense....
3. The felony for which the defendant is to be sentenced, and one of the two prior felony convictions, is not a violation of s. 893.13 relating to the purchase or the possession of a controlled substance ....
(emphasis supplied). By its terms, subsection (1)(a)3 creates two exemptions from the operation of the habitual offender statute.
The first exemption pertains to the nature of the crime for which the enhanced sentence is to be imposed. Section 775.084(1)(a)3 prohibits the imposition of a habitual felony offender sentence for a violation of section 893.13 "relating to the purchase or the possession of a controlled substance." A defendant who is convicted of a drug offense falling within this category is ineligible for a habitual felony offender sentence, regardless of the nature of the prior crimes used to establish the predicate for an enhanced sentence. See McKnight v. State, 759 So.2d 686 (Fla. 1st DCA 1998); decision approved by State v. McKnight, 764 So.2d 574 (Fla.2000); Hayes v. State, 677 So.2d 304 (Fla. 1st DCA 1996). In contrast, a defendant who is convicted of any other crime would not be exempted by this part of the statute based on the nature of the offense alone. For example, a defendant convicted of trafficking or sale of cocaine would be eligible for a habitual felony offender sentence, because the statute forbids habitualization only if the subject offense is a violation of section 893.13 "relating to the purchase or the possession of a controlled substance." § 775.084(1)(a)3, Fla. Stat. (Supp.1996).
The second exemption involves the nature of the prior convictions that may be used to establish the predicate for an enhanced sentence. In this regard, section 775.084(1)(a)3 provides that "one of the two prior felony convictions" must not be an offense relating to the purchase or the possession of a controlled substance. (emphasis added). It follows that if both of the predicate crimes are offenses relating to the purchase or possession of a controlled substance, the defendant would not qualify for an enhanced sentence under the habitual offender statute. However, section 775.084(1)(a)3 does not forbid the imposition of a habitual offender sentence, merely because one of the prior felonies is an offense relating to purchase or possession. See Rollins v. State, 707 So.2d 823 (Fla. 3d DCA 1998).
In the present case, the habitual offender sentence was imposed for the crime of robbery and one of the predicate offenses was burglary. The other predicate felony was a conviction for possession of cocaine, but, as we have explained, that alone would not foreclose the possibility of an enhanced sentence under the statute. The defendant qualifies for an enhanced sentence under the statute because both the subject offense (robbery) and one of the predicate offenses (burglary) were not crimes relating to the purchase or possession of a controlled substance.
For these reasons, we conclude that the defendant's habitual felony offender sentence was not an illegal sentence, and we *730 affirm the denial of the defendant's postconviction motion under rule 3.800(a).
Affirmed.
ALLEN, C.J., and BENTON, J., concur.
NOTES
[1]  The date the offense was committed would have been more useful in the analysis of a habitual offender issue. We cannot ascertain that date from the record in this case, but the defendant does not dispute the fact that the most recent of his prior convictions was within five years of the date the robbery was committed.
