
892 So.2d 869 (2004)
Ex parte State of Alabama
(In re STATE of Alabama v. Clennan Hill WEBBER).
1021743.
Supreme Court of Alabama.
March 5, 2004.
Rehearing Denied May 28, 2004.
Eleanor I. Brooks, district atty., and Vernetta R. Perkins, deputy district atty., for petitioner.
Thomas M. Goggans, Montgomery, for respondent Clennan Hill Weber.
Tracy S. McCooey, Circuit Judge, Montgomery.
H.W. "Bucky" McMillan, Presiding Judge; and Sue Bell Cobb, Pamela W. Baschab, and A. Kelli Wise, Judges, Alabama Court of Criminal Appeals.
*870 JOHNSTONE, Justice.
The State has petitioned this Court for a writ of mandamus directing the trial judge to vacate her order dismissing the "case" against the defendant Clennan Hill Webber and to adjudicate him guilty and to sentence him in accordance with his guilty pleas. For the reasons explained in this opinion, we must dismiss the petition for the writ of mandamus.
In December 2001, Webber was indicted for four property crimes. He declined to participate in the "pre-trial diversion program" operated by the district attorney but agreed to participate in the "drug court" instituted and supervised by the trial judge herself. He entered guilty pleas to the four charges in the "case," and the trial court deferred adjudications and sentencing subject to certain conditions, including participation in the trial judge's "drug court." After the defendant completed the drug court program and fulfilled all other conditions imposed by the trial court, it, over the district attorney's objection, dismissed the "case" against the defendant with prejudice on April 24, 2003.
On May 1, 2003, within the seven days next following the date of the judgment of dismissal, see Rule 21(a), Ala. R.App. P., and Rule 15.7, Ala. R.Crim. P., the State, through the district attorney, petitioned the Alabama Court of Criminal Appeals for the same mandamus relief the State now seeks from us. The Court of Criminal Appeals dismissed that petition on July 9, 2003, without an opinion, State v. Webber, (No. CR-02-1386), 886 So.2d 187 (Ala.Crim.App.2003) (table); and the State petitioned us within seven days thereafter, on July 16, 2003.
The State claims that the trial court "usurped the authority of the district attorney" and "abused its discretion by arbitrarily and capriciously dismissing the charges against the Defendant over the State's objection." The State does not claim lack of notice or opportunity to be heard before the trial court.
Because the trial court now lacks jurisdiction to vacate the judgment of dismissal, and the appellate courts of the state now lack jurisdiction to order the judgment vacated, we cannot reach the merits of the claim of the State, as the claim is moot, and accordingly we must dismiss the petition for a writ of mandamus directing that the dismissal of the case be vacated, the charges adjudicated, and the defendant sentenced. Parkerson v. Seventeenth Judicial Circuit Court, Sumter County, 277 Ala. 345, 170 So.2d 491 (1965). See State ex rel. City of Prichard v. Jansen, 271 Ala. 104, 122 So.2d 736 (1960). We will explain.
The April 24, 2003 dismissal of the case constituted a final judgment, as distinguished from an interlocutory judgment or order. Ex parte Sullivan, 779 So.2d 1157, 1160 (Ala.2000).[1]See also Fong Foo v. United States, 369 U.S. 141, 82 S.Ct. 671, 7 L.Ed.2d 629 (1962). The trial court lost subject-matter jurisdiction of the cases at the expiration of thirty days following entry of the final judgments. Ex parte Hitt, 778 So.2d 159 (Ala.2000); Massey v. State, 587 So.2d 448 (Ala.Crim.App.1991); and Shepard v. State, 347 So.2d 1017 (Ala.Crim.App.1977). See Rule 24, Ala. R.Crim. P.
No party filed an appeal.[2] Because no party filed a timely appeal, no appellate *871 court ever acquired any appellate jurisdiction over the cases. Spina v. Causey, 403 So.2d 199 (Ala.1981); Lewis v. State, 463 So.2d 154 (Ala.1985); Woods v. State, 371 So.2d 944, 945 (Ala.1979); and Turner v. State, 365 So.2d 335, 336 (Ala.Crim.App.1978).
Within seven days after the trial court entered the final judgments, during the thirty days when the trial court did retain subject-matter jurisdiction, the State petitioned the Court of Criminal Appeals for a writ of mandamus directing the trial judge to vacate the dismissal, to adjudicate the charges, and to sentence the defendant. The State did not, however, obtain, from either the trial court or any appellate court, any stay of the final judgment.
The filing of a petition for a writ of mandamus against a trial judge does not divest the trial court of jurisdiction, stay the case, or toll the running of any period for obeying an order or perfecting a filing in the case. See Ex parte St. John, 805 So.2d 684 (Ala.2001); State ex rel. S.N. v. W.Y., 622 So.2d 378, 381 (Ala.Civ.App.1993); and Continental Oil Co. v. Williams, 370 So.2d 953, 954 (Ala.1979). The petition for a writ of mandamus, if meritorious, merely prompts the appellate court to exercise its supervisory power to tell the trial judge, as an official, as distinguished from the trial court itself, to do his or her duty when that duty is so clear that there are no two ways about it. Ex parte Little, 837 So.2d 822, 824 (Ala.2002). Further, a petition for a writ of mandamus is not a substitute for an appeal. State v. Van Reed, 673 So.2d 857, 858 (Ala.Crim.App.1996); and Ex parte City of Tuscaloosa, 636 So.2d 692, 694 (Ala.Crim.App.1993).
Therefore, in the case now before us, the filing of the petition for a writ of mandamus neither transferred the retained subject-matter jurisdiction of the trial court to the appellate court, nor tolled the expiration of the thirty days of retained jurisdiction of the trial court, nor conferred appellate jurisdiction (as distinguished from supervisory jurisdiction over the trial judge) on the Court of Criminal Appeals. Thus, after the thirty days of retained jurisdiction in the trial court expired, and after any applicable period for appeal, if any,[3] expired, the trial court lost all jurisdiction and all possibility of reacquiring jurisdiction to vacate the judgment of dismissal, and the appellate courts lost all possibility of acquiring appellate jurisdiction to remand the case for the judgment to be vacated.
PETITION DISMISSED.
HOUSTON, LYONS, and HARWOOD, JJ., and GORDON, Special Justice,[*] concur.
SEE, J., concurs specially.
WOODALL, J., concurs in the result.
BROWN and STUART, JJ., dissent.
SEE, Justice (concurring specially).
Although I agree with Justice Stuart that the trial court improperly dismissed the case, I do not reach this issue for the reasons stated in the main opinion.
WOODALL, Justice (concurring in the result).
I believe the State's petition for a writ of mandamus was not filed in a timely manner. Therefore, I concur in the result.
*872 STUART, Justice (dissenting).
The State of Alabama, through the Montgomery County District Attorney's Office ("the State"), petitions this Court to issue a writ of mandamus ordering Judge Tracy S. McCooey to reinstate the case against Clennan Hill Webber. The majority denies the petition on jurisdictional grounds. I, however, believe that a petition for a writ of mandamus is the proper vehicle by which to address this matter. Therefore, I would not dismiss the petition; I would address the merits.
In December 2001 the Montgomery County grand jury indicted Webber for two counts of burglary in the third degree, violations of § 13A-7-7, Ala.Code 1975, and two counts of theft of property in the second degree, violations of § 13A-8-4, Ala.Code 1975. In May 2002 the State mailed a letter to Webber's counsel explaining the district attorney's pretrial-diversion program established pursuant to Act No. 706, Ala. Acts 1978.[4] The letter stated:
"At this time the only way the State of Alabama will nolle prosse the charges is if [Webber] complete[s] Pre-Trial Diversion. There is no Drug Court Program accepting defendants at this time.
"While I cannot guarantee [Webber] will be accepted, based on the information available to me, I believe it to be in [his] interest to apply for Pre-Trial Diversion."
(State's petition, Exhibit A.) Webber declined to participate in the pretrial-diversion program.
On June 10, 2002, Webber pleaded guilty to the charges. The trial court did not adjudicate Webber guilty, but ordered him to participate in the trial court's drug-court program.[5] On June 13, 2002, the State filed a motion requesting that the trial court adjudicate and sentence Webber. On June 25, 2002, the trial court denied the motion.
On April 21, 2003, the trial court informed the district attorney that Webber had successfully completed all the requirements of its drug-court program and requested that the charges against Webber be nol-prossed. On April 24, 2003, the State filed a refusal to nol-pros the case and an objection to a dismissal. The State also filed a second motion requesting that Webber be adjudicated and sentenced. The trial court dismissed Webber's case.
On May 1, 2003, the State filed a petition for a writ of mandamus requesting that the Court of Criminal Appeals order the trial court to reinstate its case against Webber, to adjudicate the case, and to sentence Webber. See Ex parte Sullivan, 779 So.2d 1157 (Ala.2000). The Court of Criminal Appeals, citing Rule 21(a), Ala. R.App. P., and Ex parte Thomas, 828 So.2d 952 (Ala.2001), dismissed the petition. The State then filed the present *873 petition for a writ of mandamus with this Court pursuant to Rule 21(e)(1), Ala. R.App. P.
In its petition the State contended that the trial court exceeded the scope of its authority by, it said, arbitrarily and capriciously dismissing the charges against Webber.
First, I note that a Rule 13.5(c)(1), Ala. R.Crim. P., provides:
"(1) A motion to dismiss the indictment may be based upon objections to the venire, the lack of legal qualifications of an individual grand juror, the legal insufficiency of the indictment, or the failure of the indictment to charge an offense."
See also State v. Sharp, [Ms. CR-02-0294, January 31, 2003] ___ So.2d ___ (Ala.Crim.App.2003). In her affidavit submitted to the Court of Criminal Appeals, Judge McCooey stated that she dismissed Webber's case with prejudice "per [his] successful completion of [the drug-court] program." This reason does not fall within one of the bases designated in Rule 13.5(c)(1), Ala. R.Crim. P.; therefore, the Rules of Criminal Procedure do not provide a basis for the dismissal of the charges.
Webber and Judge McCooey maintain in their answer to the State's petition that
"[t]he dismissal of a case for lack of prosecution is discretionary with the trial court. Hart v. Priceville, 631 So.2d 301, 302 (Ala.Crim.App.1993). By the same logic, the dismissal of a case when the defendant, over the course of a year, has completed a court drug program and the prosecution has done nothing to halt the trial court's drug program, is discretionary with the trial court."
I agree with Webber and Judge McCooey that the dismissal of a case for lack of prosecution is within a trial court's discretion. When the trial court dismisses a case for lack of prosecution, the trial court has concluded that the State has not fulfilled its duties in a timely manner. However, I do not agree that "by the same logic" the dismissal of a case when the State is not derelict in its duties and the trial court has usurped the State's executive responsibility is within the trial court's discretion.
In Piggly Wiggly No. 208, Inc. v. Dutton, 601 So.2d 907, 910-11 (Ala.1992), this Court addressed the role of the judiciary and the role of the prosecutor in the judicial system, stating:
"`A duty rests upon the prosecuting attorney to prosecute in his county or district, on behalf of the people, all public offenses. Where a statute so provides, the prosecuting attorney must initiate proceedings for the prosecution of persons charged with or reasonably suspected of public offenses, when he has information that such offenses have been committed. But, as a general rule, if a prosecutor has possible cause to believe that the accused committed an offense defined by statute, the decision whether or not to prosecute, and what charge to file or bring before a grand jury, rests entirely in his discretion. In other words, the duty to prosecute is not absolute, but qualified, requiring of the prosecuting attorney only the exercise of a sound discretion, which permits him to refrain from prosecuting whenever he, in good faith and without corrupt motives or influences, thinks that a prosecution would not serve the best interests of the state, or that, under the circumstances, a conviction could not be had, or that the guilt of the accused is doubtful or not capable of adequate proof.
"`A prosecutor is not subject to judicial supervision in determining what charges to bring and how to draft *874 accusatory pleadings; he is protected from judicial oversight by the doctrine of separation of powers ....'
"....
"Article III, § 43, Constitution of Alabama 1901, provides in pertinent part:
"`[T]he judicial [branch of government] shall never exercise the legislative and executive powers ....'
"In Finch v. State, 271 Ala. 499, 503, 124 So.2d 825, 829 (1960), this Court recognized:
"`Great care must be exercised by the courts not to usurp the functions of other departments of government. § 43, Constitution 1901. No branch of the government is so responsible for the autonomy of the several governmental units and branches as the judiciary. Accordingly, we have held that courts cannot and will not interfere with the discretion vested in other units or branches of government.
"`....'
"This Court is precluded by Art. III, § 43, of the Alabama Constitution from interfering with [the prosecutor's] exercise of discretion in this regard."
Here, the State did not neglect its duties. The State provided Webber with notice of the availability of the pretrial-diversion program. Webber refused to participate in that program. The State prosecuted the case; Webber pleaded guilty. The trial court, however, did not fulfill its judicial role to pronounce judgment and to sentence Webber. See Rule 26.9, Ala. R.Crim. P. Instead, the trial court placed Webber in its drug-court program and requested that the State, after Webber successfully completed the program, nol-pros the case. When the State refused to nol-pros, the trial court dismissed the case. At that time, the trial court exceeded the scope of its discretion and usurped the authority of the State.
In C.D.C. v. State, 821 So.2d 1021, 1025 (Ala.Crim.App.2001), the Court of Criminal Appeals addressed C.D.C.'s claim that he was denied due process when he was denied admittance into the drug-court program created pursuant to § 12-23-5, Ala.Code 1975.[6] The Court stated:
"We note that § 12-23-5, Ala.Code 1975, provides that those accused of certain drug offenses may request to enroll in a drug abuse program as an alternative to prosecution. The statute provides, `Admission to such treatment program and deferral of prosecution may be granted at the discretion of the district attorney. The Office of Prosecution Services shall establish guidelines, which shall be used by the prosecutor in evaluating the request for diversion from the criminal justice system into rehabilitation.' § 12-23-5, Ala.Code 1975 (emphasis added). We believe that, like the prosecutor's decision to permit a defendant to complete a treatment program, the prosecutor's decision to refer a defendant to drug court is solely within the prosecutor's discretion."
(Some emphasis omitted; first emphasis original; second emphasis added.) As the Court of Criminal Appeals opined, it is the prosecutor's decision, not the trial court's, to admit a defendant to a pretrial-diversion program. After Webber pleaded guilty, it became incumbent upon the trial court to adjudicate and to sentence Webber. The State performed its role by prosecuting Webber; the trial court, however, did not perform its judicial role of pronouncing judgment and sentence. By dismissing *875 the case upon Webber's completion of its drug-court program, the trial court engaged in a responsibility specifically designated to the State and thereby exceeded the scope of its discretion.
Additionally, I note that it appears that the trial court's drug-court program was not authorized by the Legislature or conducted under the parameters of the legislatively authorized pretrial-diversion program for the Fifteenth Judicial Circuit. While I find it meritorious that a trial court would invest its time engaging in a drug-court program by conducting biweekly reviews of a defendant's drug treatment, participation in counseling sessions, etc., such a program must fall within lawful parameters. A trial court does not represent the people; the State does. It is not the trial court's responsibility to determine whether a case should be prosecuted. It is the trial court's responsibility to pronounce the judgment and to sentence the wrongdoer. Rule 26.9, Ala. R.Crim. P. The trial court in this situation usurped the authority of the State and invaded the province of the executive branch.
Because I conclude that the State properly invoked the jurisdiction of this Court and established a clear legal right to have the charges against Webber reinstated, an imperative duty for the trial court to reinstate the charges and its refusal to do so, and the lack of another remedy, I would grant the petition and issue the writ. "A writ of mandamus is not granted unless there is a clear showing of error in the trial court to the injury of the petitioner. Ex parte Slade, 382 So.2d 1127 (Ala.1980)." Ex parte Southland Bank, 514 So.2d 954, 955 (Ala.1987). The State has made a clear showing of error. The trial court exceeded its authority by dismissing the charges against Webber. "Mandamus is an extraordinary remedy, but is appropriate in exceptional circumstances which amount to judicial usurpation of power." Ex parte Nice, 407 So.2d 874, 877 (Ala.1981). For the foregoing reasons, I dissent.
BROWN, J., concurs.
NOTES
[1]  Ex parte Sullivan also recognized a petition for a writ of mandamus as the proper vehicle for review of a dismissal similar to the one in the case now before us. In Ex parte Sullivan, as in Ex parte Thomas, 828 So.2d 952 (Ala.2001), however, no party raised, and this Court overlooked and did not address, the expiration of the subject-matter jurisdiction of the trial court and the appellate courts in the absence of a stay of or relief from the final judgment of the trial court within 30 days of its entry.
[2]  This opinion does not suggest that the State could or could not have appealed. The issue is not before us.
[3]  See footnote 2.
[*]  Retired Circuit Judge William Gordon was appointed on November 14, 2003, to be a Special Justice in regard to this appeal.
[4]  Act No. 706 specifically provides that the district attorney for the Fifteenth Judicial Circuit "may utilize such discretion to screen or divert such cases out of the criminal justice system when he [or she] feels that the advantages of such diversion, or preprosecution probation would outweigh the advantages of prosecution." If an indictment has been issued, the case cannot be diverted without the express approval of the presiding judge of the circuit or the circuit court judge assigned to the case. Act No. 706 identifies certain criminal offenses that can prevent a defendant's participation in the program. Act No. 706 further provides for a committee to make recommendations to the district attorney as to which defendants may be eligible for pretrial diversion and suggests conditions to be imposed upon the defendant. Once the defendant successfully completes the pretrial-diversion program, the defendant is entitled to a noncriminal disposition of the charges.
[5]  The State maintains that the trial court's drug-court program is not authorized by the Legislature. Neither Webber nor the trial court refutes that assertion.
[6]  Section 12-23-5, Ala.Code 1975, is similar to Act No. 706. While § 12-23-5 provides a pretrial-diversion program for persons accused of committing certain drug offenses, Act No. 706 provides a pretrial-diversion program for persons accused of various minor offenses in addition to drug offenses.
