
855 So.2d 486 (2003)
Ex parte Marty CONNORS, as chairman of the Alabama Republican Executive Committee.
(In re Steve Flowers v. Jim Bennett et al.)
Marty Connors, individually and as chairman of the Alabama Republican Party
v.
Steve Flowers and Jim Bennett.
1011608 and 1012111.
Supreme Court of Alabama.
February 7, 2003.
*487 Dorman Walker of Balch & Bingham, L.L.P., Montgomery; and Edward S. Allen and Allen M. Estes of Balch & Bingham, L.L.P., Birmingham, for petitioner/appellant Marty Connors, as chairman of the Alabama Republican Executive Committee.
Algert S. Agricola, Jr., of Crosslin, Slaten & O'Connor, P.C., Montgomery; Albert L. Jordan of Wallace, Jordan, Ratliff & Brandt, L.L.C., Birmingham; and Perry O. Hooper, Sr., Montgomery, for respondent/appellee Steve Flowers.
WOODALL, Justice.
These proceedings (a petition for a writ of mandamus and an appeal) were brought in this Court to challenge the judgment of the Montgomery Circuit Court, dismissing an action commenced by Steve Flowers. That action began on April 17, 2002, when Flowers filed a motion for a temporary restraining order ("TRO motion") against Jim Bennett, in his capacity as the Secretary of State of Alabama, as well as against the probate judges and circuit clerks of the counties composing state senate district 14. (Bennett, the probate judges, and the circuit clerks are hereinafter referred to collectively as "Bennett.")
At that time, Flowers was seeking to maintain his candidacy in the June 4, 2002, Republican Party primary election for the office of state senator for district 14, having been certified by the Republican Party as a candidate on April 10, 2002. Flowers was one of four candidates so certified. As the result of a challenge to Flowers's qualifications for candidacy, the Alabama Republican Executive Committee (the "Committee") had determined that Flowers did not satisfy certain residency requirements and had requested that Secretary Bennett omit Flowers's name from the primary-election ballot. In the TRO motion, Flowers sought to enjoin Bennett "from failing to take all necessary actions that would result in the name of Petitioner Steve Flowers being placed upon the ballot for the June 4, 2002, Republican primary election for the office of state senator, district 14." On April 23, 2002, the trial court entered an order enjoining Bennett from removing Flowers's name from the primary ballot and scheduling a final hearing on the matter for June 26, 2002.
On April 30, 2002, Marty Connors, as chairman of the Committee, filed a "Motion to Intervene and Complaint for Temporary Restraining Order and Injunctive Relief." In addition to an order allowing him to intervene, Connors sought injunctive relief directly opposite to the relief granted in the April 23 order. On May 1, 2002, the trial court granted Connor's motion to intervene and scheduled a hearing on his requested injunctive relief on June 26, 2002.
On May 2, 2002, Connors filed a "Notice of Withdrawal and/or Dismissal," in which he purported to "withdraw[ ] and/or dismiss [the] Motion to Intervene and Complaint for Temporary Restraining Order and Injunctive Relief." On May 24, 2002, the trial court purported to deny the "Withdrawal and/or Dismissal."
*488 On May 28, 2002, Connors filed in this Court a petition for a writ of mandamus (case no. 1011608) directing the trial court (1) to "honor the `Notice of Withdrawal and/or Dismissal' filed by Connors and [to] expressly release Connors from its jurisdiction and the ... action"; and (2) to desist from "maintaining jurisdiction over... the issue of Steve Flowers'[s] residency and disqualification as a candidate in State Senate District 14" (the "first petition"). On May 30, 2002, this Court ordered the respondents to answer the petition and to file briefs. In that order, this Court also stayed "all proceedings and orders entered as to petitioner Connors subsequent to the filing on May 2, 2002, of petitioner Connors's notice of withdrawal and/or dismissal."
The Republican primary election for senate district 14 proceeded as scheduled on June 4, 2002; Flowers's name was on the ballot. Flowers finished third.
On June 26, 2002, the Montgomery Circuit Court conducted the previously scheduled hearing. On that date, the trial court entered the following order:
"This cause came before the court on June 26, 2002. The court is of the opinion that the Petitioner, Steve Flowers, was and is a legal resident of Senate District 14 and thus, was a qualified candidate for the office of State Senator, District 14; however, the issues in this case now appear to be moot. Accordingly, this case is hereby dismissed without prejudice with each party to bear their respective costs."
(Emphasis added.)
On July 24, 2002, Connors filed in case no. 1011608 a "Supplemental Petition for Writ of Mandamus" (the "second petition"). The second petition soughtin addition to the relief requested in the first petitionan order directing the trial court to "vacate that portion of its June 26, 2002, Order purporting to find that Steve Flowers was a legal resident of, and qualified candidate in, State Senate District 14."
On August 7, 2002, Connors filed a notice of appeal from the June 26, 2002, judgment of dismissal (case no. 1012111) (the "appeal"). In the appeal, Connors asked this Court to "nullify the June 26, 2002, Order of Dismissal ... to the extent that order relates to [him] or opines on [the issue of Flowers's residency] and [to] dismiss this action." Connors's brief, at 21. No response has been filed to the second petition or to the appeal.
Neither the appeal nor the second petition addresses the dispositive aspect of this case, namely, the fact that the case is patently moot. The underlying dispute involved Flowers's right to participate in the Republican primary election. He did participate, but the voters of the district he sought to represent rejected him. In other words, the question whether his name should have appeared on the ballots has been mooted by the election results.
It is well settled that the judiciary of Alabama is not empowered "`to decide moot questions, abstract propositions, or to give advisory opinions, however convenient it might be to have these questions decided for the government of future cases.'" Stamps v. Jefferson County Bd. of Educ., 642 So.2d 941, 944 (Ala.1994) (quoting Town of Warrior v. Blaylock, 275 Ala. 113, 114, 152 So.2d 661, 662 (1963)) (emphasis omitted)." `[I]f a case has become moot, or [if a] judgment would not accomplish an end recognized as sufficient in law, there is no necessity for the judgment, the court will decline to consider the merits, and [the court] will dismiss the case.'" Hornsby v. Sessions, 703 So.2d 932, 938 (Ala.1997) (quoting Chisolm v. Crook, 272 Ala. 192, 194, 130 So.2d 191, 193 (1961)) (emphasis added).
*489 When Flowers lost the primary election on June 4, 2002, the validity of his candidacy no longer presented a justiciable controversy, the question becoming at that point purely academic. Subsequently, the action was due to be dismissed, ex mero motu if necessary, either by this Court or by the trial court. Ala. R. Civ. P. 12(h)(3) ("Whenever it appears by suggestion of the parties or otherwise that the court lacks jurisdiction of the subject matter, the court shall dismiss the action."). See Ex parte Punturo, [Ms. 1000115, February 8, 2002] ___ So.2d ___, ___ (Ala.2002) ("Subject-matter jurisdiction cannot be waived, and the lack of subject-matter jurisdiction may be raised at any time by a party or by a court ex mero motu."); see also Water Works & Sewer Bd. of Birmingham v. Petitioners Alliance, 824 So.2d 705 (Ala.2001) (an action to enjoin an election was moot after the election occurred, and the dismissal of that action would not support an appeal).
The substantive reason for Connors's objection to the June 26, 2002, judgment of dismissal is not clear. He seeks a writ or a judgment from this Court dismissing the action. But the trial court dismissed the action. For purposes of this case, the trial court's judgment of dismissal is as effective as any judgment of dismissal from this Court.
Connors also challenges the language in the order involving Flowers's residency. However, on the date the judgment was entered, the trial court lacked subject-matter jurisdiction to decide any substantive legal question. Moreover, we do not construe its language as any purported finding of fact, given the trial court's recognition that "the issues in this case now appear to be moot." We regard that language as merely harmless surplusage, having no legal effect whatsoever.
In short, we find no reason to disturb the trial court's judgment of dismissal. Consequently, the mandamus petition in case no. 1011608 is denied. The judgment challenged in case no. 1012111 is affirmed.
1011608PETITION DENIED.
1012111AFFIRMED.
MOORE, C.J., and HOUSTON, LYONS, BROWN, JOHNSTONE, HARWOOD, and STUART, JJ., concur.
