Darin K. Swearingen was convicted of burglary in the second degree, a violation of § 13A-7-6, Ala.Code 1975. The trial court sentenced him to life imprisonment upon application of the Habitual Felony Offender Act (the “HFOA”), § 13A-5-9, Ala.Code 1975. On November 27, 2000, the Court of Criminal Appeals affirmed Swearingen’s conviction and sentence, in an unpublished memorandum. Swearingen v. State, (No. CR-99-1805) 820 So.2d 172 (Ala.Crim.App.2000) (table). We granted certiorari review to determine whether the Court of Criminal Appeals erred in holding 1) that the State presented sufficient evidence to convict Swearin-gen of second-degree burglary, and 2) that Swearingen was not entitled to a new sentencing hearing.
I.
Swearingen first contends that the evidence presented at trial was insufficient to sustain a conviction for second-degree burglary. The Court of Criminal Appeals held that the State presented sufficient evidence to sustain Swearingen’s conviction. We agree with the Court of Criminal Appeals as to this holding and affirm as to that issue.
*247II.
Swearingen also contends that the Court of Criminal Appeals erred in holding that he was not entitled to a new sentencing hearing. At Swearingen’s sentencing hearing, the State introduced evidence indicating that, in offenses unrelated to the charged offense, Swearingen had previously pleaded guilty to two charges of third-degree burglary and two charges of stalking. Because Swearingen had prior felony convictions, the trial court applied the HFOA when it sentenced Swearingen. The record indicates that although the trial court ultimately sentenced Swearingen to life imprisonment, the court initially sentenced him to 15 years’ imprisonment, based upon the mistaken belief that Swearingen had been convicted of a Class C felony. The prosecutor pointed out that second-degree burglary is a Class B felony. The following then occurred:
“THE COURT: Wait just a minute. I’m sorry. This was a Class B felony offense. You are correct. And the Court is incorrect in the sentence. Yes, it is mandatory life sentence.
“THE COURT: All right. Let me re-sentence him, then. Mr. Swearingen, the Court sentences you to a term of life in the state penitentiary.... ”
Neither the trial court nor the parties were aware at the time of Swearingen’s sentencing hearing that the HFOA had been amended six days earlier. Before the amendment, effective May 25, 2000, the HFOA required a mandatory life sentence following the conviction for a Class B felony when the defendant had three prior felony convictions. § 13A~5-9(c)(2), Ala. Code 1975. The amendment gave the trial court the option of sentencing Swearingen to “imprisonment for life or any term of not less than 20 years.” Act No. 2000-759, § 1, Ala. Acts 2000 (effective May 25, 2000).
Swearingen timely filed a motion to vacate the sentence and to hold a new sentencing hearing so that the trial court could sentence him according to the HFOA, as amended. The trial court denied the motion. The Court of Criminal Appeals affirmed Swearingen’s sentence, noting that the trial court retained jurisdiction to modify the sentence for 30 days after the sentence was pronounced. It held that because Swearingen’s motion made the trial court aware of the fact that the HFOA had been amended, the trial court was within its discretion to refuse to modify the sentence. The Court of Criminal Appeals also concluded that where the sentence is within the statutory range, it would not overturn the trial court’s sentencing decision absent a clear abuse of discretion by the trial court.
Swearingen contends that the Court of Criminal Appeals’ decision conflicts with Ex parte Thomas, 435 So.2d 1324 (Ala.1982), in which this Court reversed a sentence of 10 years’ imprisonment and remanded the case for resentencing because in sentencing the defendant the trial court had erroneously considered his pri- or adjudication as a youthful offender. Swearingen also contends that the Court of Criminal Appeals’ decision conflicts with its decisions in McClintock v. State, 773 So.2d 1057, 1059 (Ala.Crim.App.2000), and Pickens v. State, 475 So.2d 637, 640 (Ala.Crim.App.1985). In both cases, the Court of Criminal Appeals remanded for new sentencing hearings because there was evidence indicating that the trial courts had relied upon improper information in sentencing the defendants.
In Ex parte Thomas, the defendant had been convicted of third-degree burglary; he was sentenced as a habitual offender to 10 years’ imprisonment. 435 So.2d at *2481325. The trial court based the sentence upon one previous felony conviction and a youthful-offender adjudication. Id. On appeal this Court concluded .that the trial court should not have considered the youthful-offender adjudication in determining the defendant’s sentence. Id. The State argued that, although the trial court had relied on improper information — i.e., the youthful-offender adjudication — to sentence the defendant, the sentence should not have been reversed because the 10-year sentence was within the statutory range for a defendant having only one previous felony conviction. Id. This Court rejected that argument, holding instead that the defendant was entitled to a new sentencing hearing at which the trial court’s sentencing decision was based upon proper information. Id. at 1326. This Court agreed with the language of Judge Bowen’s dissent to the Court of Criminal Appeals’ opinion: “ ‘Merely because the defendant could have been sentenced to ten years does not mean he would have been if the trial judge had not considered the youthful offender conviction.’ ” Id., quoting Thomas v. State, 435 So.2d 1319, 1324 (Ala.Crim.App.1981) (Bowen, J., dissenting).
The Court of Criminal Appeals applied this rationale in Pickens v. State, supra. In Pickens, the defendant argued that he was entitled to a new sentencing hearing because the trial court had improperly relied upon a youthful-offender adjudication to enhance his sentence. 475 So.2d at 640. The State responded that the sentence should be affirmed because the sentence imposed was within the allowable range of punishment. Id. The Court of Criminal Appeals rejected this argument, relying on this Court’s opinion in Ex parte Thomas. According to the Court of Criminal Appeals, the trial judge had sentenced the defendant under the mistaken belief that life imprisonment was the mandatory sentence, when in fact there was a broad range of possible sentences that could have been imposed. Id. The Court of Criminal Appeals vacated the defendant’s sentence and remanded the cause for the trial court to conduct a new sentencing hearing. Id.
Similarly, in McClintock, supra, the Court of Criminal Appeals held that the defendant was entitled to a new sentencing hearing because the trial court had relied upon improper information in sentencing the defendant. 773 So.2d at 1059. The Court rejected the State’s argument that although the trial court had relied upon an invalid prior felony conviction to enhance the defendant’s sentence under the HFOA, the original sentence was still within the range authorized under the HFOA. Id. According to the Court of Criminal Appeals, fundamental fairness required that the cause be remanded for a new sentencing hearing, so that it might be established with certainty that the trial court exercised the discretion allowed in imposing the sentence. Id.
We agree that the result reached by the Court of Criminal Appeals in the present case is inconsistent with the rationale expressed in Ex parte Thomas, McClintock, and Pickens. There is no dispute that the trial court sentenced Swearingen under a version of the HFOA that was no longer effective. The record clearly indicates that the trial court believed that a life sentence was mandatory and that it had no discretion to sentence Swearingen to a term shorter than life imprisonment, when, in fact, a broad range of possible sentences was available.
We are unpersuaded by arguments that Swearingen’s life sentence was within the statutorily authorized range under the amended HFOA and that because the trial court retained jurisdiction to modify the sentence for 30 days it considered the *249amended HFOA and determined not to resentence Swearingen. Merely because life imprisonment was within the statutory range available under the amended HFOA, given the wide sentencing .range of 20 years’ imprisonment to life imprisonment available to the trial court under the amended HFOA, we cannot say that the trial court would have sentenced Swearin-gen to life imprisonment had the court applied the amended version of the HFOA. Indeed, the record reflects that the trial court sentenced Swearingen to 15 years’ imprisonment before it was erroneously informed that the HFOA mandated a sentence of life imprisonment. The trial court resentenced Swearingen to life imprisonment only after it was erroneously advised that a sentence of life imprisonment was mandatory. The trial court quite clearly expressed its view, albeit erroneous, that such a sentence was mandatory. Under these circumstances, we decline to accept the State’s argument that we should infer merely from the fact that the trial court denied the motion calling its attention to the recent amendment to the HFOA that the trial court at that time fully considered and then rejected a sentence other than life imprisonment. Fundamental fairness requires that Swearingen receive a new sentencing hearing to establish with certainty that the trial court exercised the discretion allowed under the amended HFOA. We affirm the judgment of the Court of Criminal Appeals insofar as it affirmed Swearingen’s burglary conviction. We reverse the judgment of the Court of Criminal Appeals insofar as it affirmed Swearingen’s sentence, and we remand the cause for that court to order a new sentencing hearing consistent with this opinion.
AFFIRMED IN PART; REVERSED IN PART; AND REMANDED.
HOUSTON, SEE, BROWN, HARWOOD, WOODALL, and STUART, JJ., concur. MOORE, C.J., concurs in part and dissents in part. JOHNSTONE, J., concurs as to Part II and dissents as to Part I.