
555 So.2d 254 (1989)
William STOKES
v.
STATE.
1 Div. 761.
Court of Criminal Appeals of Alabama.
March 17, 1989.
*255 James H. Lackey, Mobile, for appellant.
Don Siegelman, Atty. Gen., and Mary Ellen Forehand, Asst. Atty. Gen., for appellee.

ON APPLICATION FOR REHEARING
BOWEN, Judge.
This Court's opinion of January 27, 1989, is withdrawn and the following is substituted therefor.
This is an appeal from the denial of a petition for post-conviction relief.
In 1984, Stokes was convicted of the unlawful possession of pentazocine in violation of the Alabama Controlled Substances Act, Alabama Code 1975, § 20-2-1 et seq., and sentenced to twenty years' imprisonment under Alabama's Habitual Felony Offender Act. Alabama Code 1975, § 13A-5-9. That conviction was affirmed on appeal without opinion. Stokes v. State, 479 So.2d 88 (Ala.Cr.App.1985).
In April of 1988, Stokes filed a petition for post-conviction relief alleging that he was sentenced under the wrong enhancement statute and that his sentence *256 was improper under Ex parte Chambers, 522 So.2d 313 (Ala.1987). In that case, the Alabama Supreme Court held:
"[T]he legislature did not intend the Habitual Felony Offender Act to apply to felony drug offenses. That legislative intent is made unequivocal by the inclusion of a recidivist statute in the Controlled Substances Act itself....
"* * * *
"... Because the sentences applicable to drug offenses and repeat drug offenses are provided within the Controlled Substances Act, we hold that defendants convicted thereunder must be sentenced according to its provisions, not the sentencing provisions of Title 13A." Chambers, 522 So.2d at 316 (emphasis in original).
Stokes should have been sentenced under the provisions of the Controlled Substances Act. The issue of an illegal or improper sentence may be raised in a petition for post-conviction relief even where no objection was raised at sentencing. Ex parte Brannon, 547 So.2d 68 (Ala.1989).
A review of the original trial transcript shows that Stokes had 14 prior non-drug felony offenses and one prior felony conviction for possession of morphine. Those 14 prior non-drug felony offenses cannot be used for mandatory enhancement of his sentence as a drug offender.
"The State contends that the present case is not controlled by Chambers because Chamber's prior offense was drug-related and Brannon's prior offenses were not drug-related. This distinction makes no difference; Chambers makes it clear that `defendants convicted [under the Controlled Substances Act] must be sentenced according to its provisions, not the sentencing provisions of Title 13A.' 522 So.2d at 316 (emphasis in original). It is anomalous that a defendant convicted of a drug-related crime will have his sentence enhanced if he has prior drug-related convictions but will not have his conviction enhanced if he has prior non-drug-related convictions, but the clear wording of the relevant statutes will not permit any other result. We note that the Controlled Substances Act has been amended by Acts of Alabama 1987, No. 87-603, the `Drug Crimes Amendments Act of 1987.' This act repealed § 20-2-70, the recidivist provision within the Controlled Substances Act, for conduct occurring after the effective date of the act, and it made drug-related crimes subject to the Habitual Felony Offender Act. The effective date of this act was October 21, 1987. Since Brannon's conduct that led to this conviction occurred prior to October 21, 1987, Act No. 87-603 is not applicable to him, and his sentencing is controlled by Chambers." Brannon, supra.
Contrary to Stokes' main argument, he is not due to be resentenced as a first-time drug offender. In compliance with Chambers, Stokes should have been sentenced under the provisions of § 20-2-76(a) to a term of imprisonment for not less than 4 nor more than 30 years as a drug offender with one prior conviction.
Even though, under Chambers, Stokes' prior non-drug felony offenses could not be used to increase or enhance his punishment as a matter of law required by statute, the trial judge could properly consider those prior non-drug felony offenses in exercising his discretion in sentencing Stokes within the range of allowable punishment as a repeat drug offender under § 20-2-76. See Jackson v. State, 501 So.2d 542, 548 (Ala.Cr.App.1986), cert. denied, Jackson v. Alabama, 483 U.S. 1010, 107 S.Ct. 3242, 97 L.Ed.2d 746 (1987) (criminal activity that did not result in conviction may be considered in sentencing).
We note that the holding of Chambers is limited by the Drug Crimes Amendments Act of 1987 which became effective October 21, 1987. Alabama Code 1975, § 13A-12-210 et seq. (1988 Cumulative Supplement). Section 11 of that act provides: "The provisions of this Act are to be included in the Code of Alabama 1975, as a part of Title 13A, `Alabama Criminal Code,' and all provisions of Title 13A, including the Habitual Felony Offender Act, are applicable thereto, provided that any of the provisions of this Act may also be included *257 in Title 20." 1987 Ala. Acts 1047, at 1050, No. 87-603 (July 23, 1987). See also Alabama Code 1975, § 13A-12-216. This means that any repeat offender whose last offense was committed on or after October 21, 1987, must be sentenced under the provisions of the Habitual Felony Offender Act. Any drug offender whose offense was committed before October 21, 1987, must be sentenced according to the provisions of the Alabama Controlled Substances Act.
The judgment of the circuit court denying the petition for post-conviction relief is reversed, and this cause is remanded with directions that Stokes be resentenced in accordance with the sentencing provisions of the Alabama Controlled Substances Act.
ORIGINAL OPINION WITHDRAWN; OPINION SUBSTITUTED; APPLICATION FOR REHEARING OVERRULED; REVERSED AND REMANDED WITH DIRECTIONS.
All Judges concur.
