
424 So.2d 662 (1982)
John David LUKER
v.
STATE.
1 Div. 327.
Court of Criminal Appeals of Alabama.
June 8, 1982.
Rehearing Denied June 29, 1982.
Certiorari Quashed January 7, 1983.
*663 Michael E. Box, Saraland, for appellant.
Charles A. Graddick, Atty. Gen. and Jan A. Wade, Asst. Atty. Gen., for appellee.
Alabama Supreme Court 81-850.
BARRON, Judge.
John David Luker was convicted in the Circuit Court of Mobile County on July 31, 1975, for possession of controlled substances, and was sentenced to 30 years. The conviction was affirmed by this court in Luker v. State, 344 So.2d 1219 (Ala.Cr. App.); writ quashed, 344 So.2d 1224 (Ala. 1977).
The trial court, pursuant to the drug recidivist statute, sentenced appellant to 30 years because of his prior narcotics convictions. The indictment under which he was tried did not aver any prior narcotics convictions. Consequently, appellant contends that the maximum sentence he could have received was 15 years.
On January 13, 1981, appellant, who was then serving his sentence in Holman Prison, filed a petition for writ of habeas corpus in the Circuit Court of Escambia County. The petition was transferred to the Mobile County Circuit Court on April 28, 1981. Upon a hearing held on September 16, 1981, the petition was denied. Hence this appeal.
In his petition in the habeas corpus proceedings, the appellant contends that the sentence he received exceeded that permitted by law because the prior drug offenses were not alleged in the indictment or proved at the trial.
In appellant's direct appeal (Luker, supra, at page 1224), this court held:
"... The sentence prescribed and imposed was authorized by the law under which appellant was prosecuted. The evidence disclosed that he was a multiple drug convicted felon. This was his third narcotic conviction and the sentence was authorized by Title 22, Section 258(53) Code of Alabama 1940...."
Thus, the trial court's sentencing jurisdiction was clearly established and became the law of the case. Even if errors existed in the judgment, which we do not concede, habeas corpus is not the proper remedy where the trial court's jurisdiction is clearly established.
The writ of habeas corpus cannot be used to replace a writ of error or an appeal. The writ cannot be used to correct errors in a judgment if the jurisdiction of the court rendering the judgment is without question. The writ is against void, but not irregular or voidable, judgments. Hable v. State, 41 Ala.App. 398, 132 So.2d 271 (1961). Habeas corpus does not serve the office of appeal. Greer v. State, 49 Ala. App. 36, 268 So.2d 502 (1972).
The drug recidivist statute, Section 20-2-76(a), Code of Alabama, 1975, formerly Title 22, Section 258(53), Code of Alabama, 1940, provides:

*664 "Any person convicted of a second or subsequent offense under this chapter may be imprisoned for a term up to twice the term otherwise authorized, fined an amount up to twice that otherwise authorized or both."
While the quoted statute contains no language suggesting that the prior offense must be alleged in the indictment and proved at trial, this court has considered that issue in several prior cases.
In Funches v. State, 56 Ala.App. 22, 318 So.2d 762 (Ala.Cr.App.), cert. denied, 294 Ala. 757, 318 So.2d 768 (1975), it was held:
"In order to make operative Title 22, Section 258(53)(a)(b), supra, evidence of a former conviction is not admissible unless it is alleged in the indictment and proof offered in support thereof."
In Napier v. State, 344 So.2d 1235 (Ala. Cr.App.), cert. denied, 344 So.2d 1239 (Ala. 1977), this court observed:
"We hold that it is proper for an indictment for an offense in violation of the Uniform Alabama Controlled Substances Act to contain the averment that the defendant has heretofore been convicted of an offense under the act."
In Luttrell v. State, 357 So.2d 1021 (Ala. Cr.App.1978), it was held:
"We have examined the indictment and have found that no prior narcotic conviction is averred therein. The trial court, in the absence of such averment in the indictment, was without authority to impose an imprisonment sentence in excess of fifteen years imprisonment."
Also, in Kidd v. State, 398 So.2d 349 (Ala.Cr.App.), cert. denied, 398 So.2d 353 (Ala.1981), this court held:
"It is reasonably clear from Napier, supra, and from Funches v. State, 56 Ala. App. 22, 318 So.2d 762, cert. denied, 294 Ala. 757, 318 So.2d 768 (1975), that when the State wishes to bring a defendant under the ambit of Section 20-2-76 the prior conviction must be alleged in the indictment and later proven at trial."
The thrust of appellant's contention is based on Luttrell, supra, and Kidd, supra, both of which rely on Funches, supra, and Napier, supra, for their reasoning. Also, it is noted that both Luttrell and Kidd were decided some time after appellant was sentenced.
Funches and Napier address the issue of whether an allegation of a prior narcotics offense in the indictment is so prejudicial to a criminal defendant's right to a fair trial as to require a reversal of the conviction.
A re-examination of Funches and Napier leads us to the inescapable conclusion that neither case requires that the prior drug offense be alleged in the indictment in order for a convicted defendant to be sentenced under the drug recividist statute. Funches held, in essence, that in order to make operative the recividist statute, former drug conviction evidence is not admissible at the trial unless it is alleged in the indictment, and that everything alleged in the indictment must be proved at trial. We do not construe this to be a requirement that the prior offense be alleged in the indictment. Napier holds that it is proper for a prior offense to be alleged in the indictment.
In our view, Luttrell and Kidd incorrectly interpret Funches and Napier to require the allegation of a prior offense in an indictment. To that extent, Luttrell and Kidd are overruled.
A better reasoned view of the recidivist statute is that the prior offense may be alleged in the indictment, in which event it must be proved at trial, but the allegation of the prior offense in the indictment is not mandatory. It is noted that the utilization of the recidivist statute itself by the trial judge is permissible but not mandatory.
For the reasons stated, the judgment of the trial court is due to be affirmed.
AFFIRMED.
All the Judges concur.
