
986 So.2d 408 (2007)
Ex parte State of Alabama.
(In re Thomas S. ATKINSON
v.
STATE of Alabama).
1061553.
Supreme Court of Alabama.
December 7, 2007.
*409 Troy King, atty. gen., and Jim R. Ippolito, Jr., chief counsel, and R. Mitchell Alton III, asst. counsel, Department of Transportation, for petitioner.
Jerry Guyton of Fite, Davis, Atchison, Guyton and Burt, P.C., Hamilton, for respondent.
PARKER, Justice.
The State of Alabama petitions for a writ of mandamus directing the Marion Circuit Court to enter an order granting the State's motion to dismiss Thomas S. Atkinson's claims against it, with prejudice, on the basis of State immunity. For the reasons presented below, we issue the writ.

Background
On October 2, 2000, Atkinson filed an action styled "Thomas S. Atkinson, Plaintiff, vs. State of Alabama, Defendant" in the Marion Circuit Court. He sought damages and attorney fees for inverse condemnation. Atkinson alleges that the State decreased the value of his real estate in the course of widening Alabama Highway 129 and that no condemnation proceedings had been instituted by the State.
The property affected by the road work fronts the east right-of-way of Alabama Highway 129 in Winfield. Atkinson operates a trucking business and a truck-repair shop on the property. Before the widening project began, Atkinson and the State negotiated a value of $20,000 for "part of his road frontage and one of his storage buildings," which Atkinson conveyed to the State in lieu of condemnation. When the State widened the road, it changed the elevation and location of the driveway that provides access from Highway 129 to Atkinson's property and his business. Atkinson claims that these changes have rendered the property useless "as a trucking terminal and trucking repair shop because [the] changes made it very difficult for a truck to enter or exit the premises."
In 2002, the State petitioned for a writ of mandamus directing the trial court to enter an order transferring the case from Marion County to Montgomery County. This Court denied the State's petition, without an opinion. Atkinson v. State (No. 1011078, Dec. 20, 2002), 877 So.2d 646 (Ala.2002)(table).
On June 13, 2006, the State filed a motion to dismiss Atkinson's complaint, arguing that the State was immune under Art. I, § 14, Ala. Const.1901. The trial court set a hearing for July 11, 2007, and denied the motion after the State failed to appear. Two days later, on July 13, 2007, the court scheduled a jury trial on Atkinson's claims for September 10, 2007. On July 27, 2007, the State filed a motion to stay the proceedings in the trial court and notified the trial court of its intent to file a petition for a writ of mandamus in this Court. The *410 trial court granted the stay on that same day.

Standard of Review
"A writ of mandamus is a
"`"drastic and extraordinary writ that will be issued only when there is: 1) a clear legal right in the petitioner to the order sought; 2) an imperative duty upon the respondent to perform, accompanied by a refusal to do so; 3) the lack of another adequate remedy; and 4) properly invoked jurisdiction of the court."'
"Ex parte Wood, 852 So.2d 705 (Ala. 2002) (quoting Ex parte United Serv. Stations, Inc., 628 So.2d 501, 503 (Ala. 1993)). A petition for a writ of mandamus `is an appropriate means for seeking review of an order denying a claim of immunity.' Ex parte Butts, 775 So.2d 173, 176 (Ala.2000)....
"In reviewing the denial of a motion to dismiss by means of a mandamus petition, we do not change our standard of review. [Butts, 775 So.2d at 176]; see also Wood, 852 So.2d at 709 (review of a denial of a summary-judgment motion grounded on a claim of immunity by means of a petition for a writ of mandamus does not change the applicable standard of review). Under Rule 12(b)(6), Ala. R. Civ. P., a motion to dismiss is proper when it is clear that the plaintiff cannot prove any set of circumstances upon which relief can be granted. Cook v. Lloyd Noland Found., Inc., 825 So.2d 83, 89 (Ala.2001). `"In making this determination, this Court does not consider whether the plaintiff will ultimately prevail, but only whether [she] may possibly prevail."' Id. (quoting Nance v. Matthews, 622 So.2d 297, 299 (Ala. 1993)). We construe all doubts regarding the sufficiency of the complaint in favor of the plaintiff. Butts, 775 So.2d at 177."
Ex parte Haralson, 853 So.2d 928, 931 (Ala.2003) (footnote omitted).

Analysis
Article I, § 14, Ala. Const.1901, states "[t]hat the State of Alabama shall never be made a defendant in any court of law or equity." "The wall of immunity erected by § 14 is nearly impregnable." Patterson v. Gladwin Corp., 835 So.2d 137, 142 (Ala. 2002).
The State filed its motion to dismiss based upon State immunity some five years after the action was commenced; however, a delay cannot constitute waiver. Patterson, 835 So.2d at 142 ("This immunity may not be waived."). "In erecting a `wall of immunity,' § 14 of the Constitution provides to the State a defense that is binding on the executive, legislative, and judicial branches alike, and that cannot be waived for purposes of a given suit, or for lawsuits generally, by any of these three branches." Alabama Dep't of Envt'l Mgmt. v. Town of Lowndesboro, 950 So.2d 1180, 1188 (Ala.Civ.App.2005), aff'd, Ex parte Town of Lowndesboro, 950 So.2d 1203 (Ala.2006).
"Such a case [an action against the State within the meaning of § 14] presents a question of subject-matter jurisdiction, which cannot be waived or conferred by consent." Patterson, 835 So.2d at 142-43.
"[E]ven where the State has not properly argued sovereign immunity as a defense to an action, `"`a trial or an appellate court should, at any stage of the proceedings, dismiss a suit when it becomes convinced that it is a suit against the State and contrary to Sec. 14 of the Constitution.'"' Larkins [v. Department of Mental Health & Mental Retardation,] 806 So.2d [358,] 364 [(Ala. 2001)] (quoting [Alabama State Docks Terminal Ry. v.] Lyles, 797 So.2d [432,] *411 435 [ (Ala.2001) ], quoting in turn Aland v. Graham, 287 Ala. 226, 250 So.2d 677, 678 (1971))."
Latham v. Department of Corr., 927 So.2d 815, 820 (Ala.2005).
Although the absolute bar of § 14 applies to the State and its agencies, Ex parte Alabama Department of Transportation, 764 So.2d 1263, 1268 (Ala.2000), this Court has recognized certain exceptions for actions against State officials. There is an exception for a valid inverse-condemnation action brought against a state official in a representative capacity. This Court held in Latham:
"A state official is not immune from an action that (1) seeks to compel a state official to perform his or her legal duties, (2) seeks to enjoin a state official from enforcing unconstitutional laws, (3) seeks to compel a state official to perform ministerial acts, or (4) seeks a declaration under the Declaratory Judgments Act...."
927 So.2d at 821. In addition, we have recognized two further exceptions:
"(5) valid inverse condemnation actions brought against State officials in their representative capacity; and (6) actions for injunction or damages brought against State officials in their representative capacity and individually where it is alleged that they had acted fraudulently, in bad faith, beyond their authority or in a mistaken interpretation of law."
Ex parte Carter, 395 So.2d 65, 68 (Ala. 1980); see also Drummond Co. v. Alabama Dep't of Transp., 937 So.2d 56, 58 (Ala.2006); and Ex parte Alabama Dep't of Transp., 978 So.2d 17, 21 (Ala.2007). Atkinson, however, did not bring his action against a State official in the official's representative capacity or move to substitute such an official as the defendant in his action.
The fact that the State waited five years to assert its defense of State immunity does not affect the State's right to the requested order. The assertion of State immunity challenges the subject-matter jurisdiction of the court; therefore, it may be raised at any time by the parties or by a court ex mero motu.

Conclusion
The State of Alabama has absolute immunity under § 14, Ala. Const.1901, and the petition for a writ of mandamus directing the trial court to issue an order dismissing Atkinson's complaint against the State of Alabama is due to be granted.
PETITION GRANTED; WRIT ISSUED.
COBB, C.J., and SEE, LYONS, WOODALL, STUART, SMITH, BOLIN, and MURDOCK, JJ., concur.
