In May 2005, the Montgomery County grand jury indicted D.L.A. for unlawful possession of a controlled substance. The trial court granted D.L.A.’s request for treatment as a youthful offender. During court proceedings on September 26, 2005, the following occurred:
“THE COURT: ... You’re here on possession of a controlled substance, and I granted you Youthful Offender [status] ....
[[Image here]]
“... How do you plead to possession of a controlled substance?
“THE DEFENDANT: Guilty.
[[Image here]]
“THE COURT: The Court finds that you understand your constitutional rights; that you enter your plea, knowingly, voluntarily, intelligently. The Court accepts the plea and defers adjudication for one year. And if you do not get into any trouble for one year, the Court will consider dismissing this case at that time.
“Now, if you get into any kind of trouble during the year, you will come back for sentencing, and then whatever the sentence will be you might serve the time.”
During court proceedings on November 3, 2006, the following occurred:
“THE COURT: Now, you entered a plea of guilty. The Court did not adjudicate you guilty. I granted you [youthful offender status], and the Court placed you on what is called court-supervised probation for one year. And I instructed you if you did not get into anymore trouble within that year, the Court would consider dismissing this case, which is similar to pretrial diversion.
“You have complied with the Court’s instruction. The victim who put — took the prescription, forged the prescription to the drug — to the drug store has pled guilty, sent a letter saying you had absolutely nothing with this, you just provided her a ride to the store. She claimed she couldn’t get out of the car, and asked you to go in and get the prescription, and that’s how you were charged. Okay? That’s how I understand the facts.
“Based on the fact that the Court told you if you stayed out the trouble for a year, he’d consider dismissing this case; and based on the defendant who has pled guilty’s admission that you had nothing to do with this crime, the Court is going to dismiss this case against you.
“I understand—
“[PROSECUTOR]: Your Honor, can I put on the record, the State would object to the dismissal. The defendant admitted guilt, and she did plead guilty. The Court withheld adjudication—
“THE COURT: That’s why I withheld adjudication because the Court was suspicious of her guilt at the time. And the victim who actually took the prescription and committed the crime, has confessed to it, and has stated emphatically that this lady had nothing to do with it.”
The State has filed both a petition for a writ of mandamus, which we docketed as CR-06-0240, and a pre-trial appeal, which we docketed as CR-06-0281, challenging the dismissal of the case against D.L.A. We consolidated the actions because they both challenge the same order of dismissal.
As a threshold matter, we must determine whether this case is properly before us by way of a petition for a writ of mandamus or a pre-trial appeal.
*1017“ ‘It is well established in Alabama that a writ of mandamus, which is a drastic and extraordinary remedy, will not issue when there is an adequate remedy by appeal, and that the writ cannot be used as a substitute for appellate review.’ Ex parte Fowler, 574 So.2d 745, 747 (Ala.1990).”
Ex parte Weaver, 781 So.2d 944, 949 (Ala.2000). Also,
“[t]he State has a limited right to appeal; that right is governed by § 12-12-70, Ala.Code 1975, § 12-22-91, Ala.Code 1975; and Rule 15.7, Ala. R.Crim. P. According to these provisions, the State may appeal from ... pretrial rulings ... dismissing charges.... The State has no right to appeal from an order dismissing a case once jeopardy has attached.”
State v. Maddox, 828 So.2d 946, 947 (Ala.Crim.App.2001). “ ‘Jeopardy attaches on a guilty plea when the plea is accepted and entered by a court with jurisdiction.’ Ex parte Wright, 477 So.2d 492, 493 (Ala.1985).” Ex parte Peterson, 890 So.2d 990, 992 (Ala.2004).
In this case, the trial court clearly accepted D.L.A.’s guilty plea, but it did not adjudicate D.L.A. guilty. In Ex parte Eason, 929 So.2d 992, 992 (Ala.2005), the Alabama Supreme Court discussed a similar plea as follows:
“David Eason pleaded guilty to first-degree theft of property, a violation of § 13A-8-3, Ala.Code 1975. At the time of the guilty-plea colloquy, the trial court found Eason guilty of first-degree theft, but withheld formal adjudication to allow Eason to apply for a pretrial diversion program. After Eason’s application for pretrial diversion was denied, the trial court sentenced Eason to five years’ imprisonment. Before sentencing Eason, the trial court did not formally pronounce him guilty of first-degree theft or enter a judgment of guilt.”
In this court and in the supreme court, Eason argued that this court did not have jurisdiction to hear his appeal because the trial court did not formally adjudicate him guilty. The supreme court rejected his argument, holding as follows:
“Because a judgment of conviction does not have to be phrased in formal language or include particular words of adjudication, we hold that if the record is clear that the trial court intended to adjudicate a defendant guilty and the sentence order necessarily involves the substance of the adjudication, then a judgment of conviction has been entered and the defendant may appeal.
“Considering the whole record in this case, it is clear that the trial court intended to adjudicate Eason guilty in response to his guilty plea, and the sentencing order necessarily involved the substance of the adjudication. The record establishes that after the trial court found that Eason had entered his plea voluntarily and knowingly, the trial court accepted the plea and found him guilty of first-degree theft of property. Several months later, the trial court sentenced Eason in accordance with the range of punishment for a conviction of first-degree theft of property, a Class B felony. The record unequivocally establishes that Eason was aware that he was being sentenced for a conviction of first-degree theft of property. The record also establishes that the trial judge believed he had adjudicated Eason guilty of theft of property, that he entered the proper sentence, and that the conviction and sentence were ready for appeal. The trial court’s determination of guilt and the entry of the sentence adequately establishes that the trial court adjudicat*1018ed Eason guilty and that the conviction and sentence were ripe for appeal.”
Eason, 929 So.2d at 995. See also Ginn v. State, 894 So.2d 793 (Ala.Crim.App.2004).
Although the trial court stated that it was accepting D.L.A.’s guilty plea, it also specifically stated that it was going to defer adjudication for one year and that it would consider dismissing the case if D.L.A. did not get into trouble for one year. Later, after it found that D.L.A. had not gotten into trouble for one year, the trial court dismissed the case. Based on the trial court’s comments and actions during both proceedings, we conclude that it did not intend to adjudicate D.L.A. guilty pursuant to her guilty plea and that it did not enter her guilty plea. Therefore, jeopardy did not attach, and this case is properly before this court by way of the State’s pre-trial appeal in CR-06-0281. See Eason, supra; but see Maynor v. State, 644 So.2d 974, 977 (Ala.Crim.App.1994) (holding that “jeopardy had attached to this appellant upon the juvenile court’s acceptance of his guilty pleas and upon the court’s finding that he was guilty”). Accordingly, we dismiss the State’s petition for a writ of mandamus in CR-06-0240.
The State argues that “[t]he trial court has usurped the authority of the executive branch in conducting an unsanctioned diversionary program and then, on its own motion, dismissing the case.” (State’s brief at p. 10) (footnote omitted). During the November 3, 2006, proceedings, the trial court stated that it had placed D.L.A. on court-supervised probation for one year and noted that its actions were similar to pre-trial diversion. Thus, we must determine whether the trial court had the authority to place D.L.A. on “court-supervised probation” and later to dismiss the charge against her.
Because the trial court granted D.L.A.’s request for treatment as a youthful offender, we will first determine whether its actions were in compliance with the Youthful Offender Act. See §§ 15-19-1 through 15-19-7, Ala.Code 1975.
“The Youthful Offender Act is intended to extricate persons below twenty-one years of age from the harshness of criminal prosecution and conviction. It is designed to provide them with the benefits of an informal, confidential, rehabilitative system....
“The Act ... affords several alternative sentencing provisions should the accused be adjudged a youthful offender and the underlying charge be a felony.”
Raines v. State, 294 Ala. 360, 363, 317 So.2d 559, 561 (1975). In this regard, § 15-19-6(a), Ala.Code 1975, provides, in relevant part:
“If a person is adjudged a youthful offender and the underlying charge is a felony, the court shall:
“(1) Suspend the imposition or execution of sentence with or without probation;
“(2) Place the defendant on probation for a period not to exceed three years;
“(3) Impose a fine as provided by law for the offense with or without probation or commitment;
“(4) Commit the defendant to the custody of the Board of Corrections for a term of three years or a lesser term.”
Clearly, the trial court did not use any of the alternatives set forth in § 15-19-6(a)(1) through (a)(4), Ala.Code 1975. Therefore, it exceeded the authority granted by the Youthful Offender Act.
With regard to dismissal of indictments, Rule 13.5(c)(1), Ala. R.Crim. P., provides:
*1019“A motion to dismiss the indictment maybe 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.”
In this case, the trial court dismissed the charge against D.L.A. because she had not gotten into any trouble for one year. As the State correctly asserts, this is not a proper basis for dismissal pursuant to Rule 13.5(c)(1), Ala. R.Crim. P. See also State v. McClain, 911 So.2d 54 (Ala.Crim.App.2005) (holding that a lack of evidence is not a viable basis for dismissing an indictment pursuant to Rule 13.5(c)(1), Ala. R.Crim. P.). Therefore, the trial court’s actions were not authorized by Rule 13.5(c)(1), Ala. R.Crim. P.
The trial court indicated that its actions were similar to pre-trial diversion. However, the Alabama Legislature has allowed for pre-trial diversion programs only in limited circumstances. In this regard, § 12-23-5, Ala.Code 1975, provides, in relevant part:
“Any person arrested or charged with the violation of a controlled substance offense as set forth in Sections 13A-12-212, 13A-12-213 or 13A-12-214 may file a request with the district attorney having jurisdiction over the offense to enroll in a drug abuse treatment program in lieu of undergoing prosecution. Admission to such treatment program and deferral of prosecution may be granted at the discretion of the district attorney.”
Also, the district attorney’s pre-trial diversion program for the Fifteenth Judicial Circuit was established pursuant to Act No. 706, Ala. Acts 1978. In both instances, the decision to permit a defendant to be admitted to the program is solely within the discretion of the district attorney. See also C.D.C. v. State, 821 So.2d 1021 (Ala.Crim.App.2001). Therefore, the trial court’s actions were not authorized by § 12-23-5, Ala.Code 1975, or Act No. 706, Ala. Acts 1978.
In this case, it appears that the trial court fashioned its own pre-trial diversion program. However, as the Alabama Supreme Court explained in Piggly Wiggly No. 208, Inc. v. Dutton, 601 So.2d 907, 910-11 (Ala.1992):
“In exposing and prosecuting crimes, district attorneys are members of the executive branch of state government. Dickerson v. State, 414 So.2d 998, 1008 (Ala.Crim.App.1982). . . . See, also, 63A Am.Jur.2d Prosecuting Attorneys § 24 (1984):
“ ‘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.
*1020“ ‘A prosecutor is not subject to judicial supervision in determining what charges to bring and how to draft accusatory pleadings; he is protected from judicial oversight by the doctrine of separation of powers. Thus, it has been held that mandamus will not lie to compel a prosecuting attorney to institute a criminal prosecution, since the acts of a prosecuting attorney are not purely ministerial acts, but involve in a large measure learning and the exercise of discretion.’
[[Image here]]
“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.
[[Image here]]
“This Court is precluded by Art. Ill, § 43, of the Alabama Constitution from interfering with [the prosecutor’s] exercise of discretion in this regard.”
Also, in Dickerson v. State, 414 So.2d 998, 1008 (Ala.Crim.App.1982), abrogated on other ground by Ex parte Bohannon, 564 So.2d 854 (Ala.1988), we stated:
“[I]t is obvious that the office of district attorney falls under the purview of the executive rather than the judicial branch of government. While the office of district attorney may be enumerated in § 6.20(a) of Amendment No. 328 to the 1901 Alabama Constitution, the district attorney is not a judicial officer or a part of the judicial branch of government because of his office....
“The district attorney is a public officer representing the sovereign power of the people and has been defined as ‘the foremost representative of the executive branch of government in the enforcement of the criminal law in his county.’ 27 C.J.S. District and Prosecuting Attorneys § 1(a) (1959). He is only an officer of the court to the extent that all attorneys are officers of the court. People v. Rodriguez, 13 Misc.2d 1004, 178 N.Y.S.2d 993 (1958), cert. denied, 362 U.S. 984, 80 S.Ct. 959, 4 L.Ed.2d 1009 (1959).
“Amendment 328 does not give the judicial branch any power, authority, or control over the office of district attorney. No rule of judicial administration governs the office. Even the powers and duties of the district attorney make no reference to control and regulation by the judicial branch. Section 12-17-184, Code of Alabama 1975.
“It is the obligation of the attorney general and the district attorney to expose and prosecute crimes. In re White, 53 Ala.App. 377, 300 So.2d 420, cert. denied, 293 Ala. 778, 300 So.2d 439 (1974). Such is not the primary function of the judicial branch of government.”
Therefore, the trial court did not have the authority to create its own pre-trial diversion program.
Clearly, the trial court was trying to help D.L.A., and that was an admirable *1021goal. However, for the reasons set forth herein, the trial court exceeded its authority when it implemented what was, in essence, its own pre-trial diversion program and dismissed the charge against D.L.A. Accordingly, we reverse the trial court’s judgment and remand this case with instructions that that court reinstate the charge against D.L.A.
REVERSED AND REMANDED AS TO CR-06-0281; PETITION DISMISSED AS TO CR-06-0240.
McMILLAN, SHAW, WISE, and WELCH, JJ., concur.