A defendant who is indicted for a capital offense may plead guilty to it, but the state, only in cases where the death penalty is to be imposed, must prove the defendant's guilt of the capital offense beyond a reasonable doubt to a jury. The guilty plea may be considered in determining whether the state has met that burden of proof. The guilty plea shall have the effect of waiving all non-jurisdictional defects in the proceeding resulting in the conviction except the sufficiency of the evidence. A defendant convicted of a capital offense after pleading guilty to it shall be sentenced according to the provisions of Section 13A-5-43(d).
Ala. Code § 13A-5-42 (1975)