
840 So.2d 132 (2002)
Ex parte Randall TURNER.
(In re Tawanda Ware, as next friend of Demonica Ware v. Randall Turner et al.)
1010861.
Supreme Court of Alabama.
June 21, 2002.
*133 Mark S. Boardman and Alicia Fritz Bennett of Boardman, Carr, Weed & Hutcheson, P.C., Chelsea, for petitioner.
Submitted on petitioner's brief only.
STUART, Justice.
Randall Turner, an assistant principal at Bellingrath Junior High School in Montgomery, filed this petition for a writ of mandamus directing Judge William A. Shashy to dismiss all claims against him *134 based on qualified or State-agent[1] immunity.
Turner states that on November 21, 1998, while patrolling the halls of Bellingrath Junior High School, he stopped Demonica Ware, who was 12 years old at the time, and asked her to present her "hall pass." Turner asserts that he did not know Demonica or know whether she was enrolled as a student at Bellingrath Junior High School. According to Turner, Demonica refused to produce a pass; she loudly resisted his efforts to stop her for questioning; and she tried to force her way past Turner. Turner says that when he grabbed Demonica's arm to stop her, both he and Demonica fell to the floor. Demonica hit her head on a locker and suffered a bruise, but there were no lacerations or broken bones. Demonica, who it turns out was a student at Bellingrath, was expelled from school.
On November 22, 2000, Tawanda Ware, as next of friend of Demonica, sued Turner in his individual capacity and in his official capacity as assistant principal of Bellingrath Junior High School; she also named as defendants the Montgomery County Board of Education and the State Board of Education. In her complaint, Ware alleged assault and battery, 42 U.S.C. § 1983 civil rights violations, negligence, and intentional infliction of emotional distress (the tort of outrage) and claimed damages for "loss of services of a child." Turner filed a motion for a summary judgment asserting that he was immune from civil liability on the basis of State-agent immunity and that he enjoyed qualified immunity from the § 1983 claims. In his petition, Turner says the trial court dismissed the other defendants, but denied his motion for a summary judgment.
On January 29, 2002, Turner filed this petition for a writ of mandamus directing Judge Shashy to dismiss all claims asserted against him. On March 15, 2002, this Court ordered Ware to file an answer and a brief within 14 days. "[A]n answer in a mandamus proceeding is very important, as is evidenced by this Court's holding that uncontroverted averments of fact stated in an answer should be taken as true." Ex parte Sharpe, 513 So.2d 609, 610 (Ala.1987). See also Ex parte Helbling, 278 Ala. 234, 177 So.2d 454 (1965). Moreover, mandamus relief may not be granted unless the respondent is granted an opportunity to answer the allegations in the petition. Sharpe, 513 So.2d 609; see also Rule 21(a), Ala.R.App.P.
In Guaranty Funding Corp. v. Bolling, 288 Ala. 319, 327, 260 So.2d 589, 596 (1972), a case decided before the adoption of Rule 21, Ala.R.App.P., this Court stated:
"[T]he answer does not contain a denial of any of the facts stated in the petition for mandamus, nor does it contain averments of other facts sufficient in law to defeat the petitioner's application. It follows that the averments of fact in the petition for mandamus ... will be taken as true.State ex rel. St. Peter's M. Baptist Church v. Smith, [215 Ala. 449, 111 So. 28 (Ala.1927)]; Ex parte Cullinan, [224 Ala. 263, 139 So. 255 (Ala. 1932)]."
Ware did not comply with this Court's order; she did not file an answer and brief. Ware's failure to respond to the allegations in Turner's petition for a writ of mandamus compels this Court to *135 consider the averments of fact in Turner's petition as true.
Standard of Review
"While the general rule is that the denial of a motion for summary judgment is not reviewable, the exception is that the denial of a motion grounded on a claim of immunity is reviewable by petition for writ of mandamus. Ex parte Purvis, 689 So.2d 794 (Ala. 1996)....
"Summary judgment is appropriate only when `there is no genuine issue as to any material fact and ... the moving party is entitled to a judgment as a matter of law.' Rule 56(c)(3), Ala. R. Civ. P., Young v. La Quinta Inns, Inc., 682 So.2d 402 (Ala.1996). A court considering a motion for summary judgment will view the record in the light most favorable to the nonmoving party, Hurst v. Alabama Power Co., 675 So.2d 397 (Ala.1996), Fuqua v. Ingersoll-Rand Co., 591 So.2d 486 (Ala.1991); will accord the nonmoving party all reasonable favorable inferences from the evidence, Fuqua, supra, Aldridge v. Valley Steel Constr., Inc., 603 So.2d 981 (Ala.1992); and will resolve all reasonable doubts against the moving party, Hurst, supra, Ex parte Brislin, 719 So.2d 185 (Ala. 1998).
"An appellate court reviewing a ruling on a motion for summary judgment will, de novo, apply these same standards applicable in the trial court. Fuqua, supra, Brislin, supra. Likewise, the appellate court will consider only that factual material available of record to the trial court for its consideration in deciding the motion. Dynasty Corp. v. Alpha Resins Corp., 577 So.2d 1278 (Ala.1991), Boland v. Fort Rucker Nat'l Bank, 599 So.2d 595 (Ala.1992), Rowe v. Isbell, 599 So.2d 35 (Ala.1992)."
Ex parte Rizk, 791 So.2d 911, 912-13 (Ala. 2000).

Analysis
Turner asks this Court to issue a writ of mandamus directing the trial court to enter a summary judgment in his favor, on the ground that he is protected against civil liability by the doctrines of State-agent immunity and qualified immunity.
In Ex parte Cranman, 792 So.2d 392 (Ala.2000), Justice Lyons restated the rule governing State-agent immunity:
"A State agent shall be immune from civil liability in his or her personal capacity when the conduct made the basis of the claim against the agent is based upon the agent's
"(1) formulating plans, policies, or designs; or
"(2) exercising his or her judgment in the administration of a department or agency of government, including, but not limited to, examples such as:
"(a) making administrative adjudications;
"(b) allocating resources;
"(c) negotiating contracts;
"(d) hiring, firing, transferring, assigning, or supervising personnel; or
"(3) discharging duties imposed on a department or agency by statute, rule, or regulation, insofar as the statute, rule or regulation prescribes the manner for performing the duties and the State agent performs the duties in that manner; or
"(4) exercising judgment in the enforcement of the criminal laws of the State, including, but not limited to, law-enforcement officers' arresting or attempting to arrest persons; or
"(5) exercising judgment in the discharge of duties imposed by statute, rule, or regulation in releasing prisoners, *136 counseling or releasing persons of unsound mind, or educating students.

"Notwithstanding anything to the contrary in the foregoing statement of the rule, a State agent shall not be immune from civil liability in his or her personal capacity
"(1) when the Constitution or laws of the United States, or the Constitution of this State, or laws, rules, or regulations of this State enacted or promulgated for the purpose of regulating the activities of a governmental agency require otherwise; or
"(2) when the State agent acts willfully, maliciously, fraudulently, in bad faith, beyond his or her authority, or under a mistaken interpretation of the law."
792 So.2d at 405 (emphasis added).
We review Turner's claim of immunity by the standards set forth in Cranman. Turner is protected under the doctrine of State-agent immunity because his actions occurred while he was discharging his duties in educating students. The evidence before us indicates that Turner's decision to detain and question Ware was made while he was acting in his official capacity. In support of his motion for a summary judgment, Turner filed an affidavit, which contains uncontroverted sworn statements of fact that fit his conduct within category "(5)" of the Cranman restatement quoted above and that affirmatively negate exception "(2)" for acts committed willfully, etc. The affidavit describes the educational duty that Turner was discharging, provides the rule that imposed that duty, and demonstrates that Turner was exercising his judgment in discharging that duty. Turner also establishes his good faith, his lack of malice, his authority, and the absence of a mistake of law in the affidavit. Therefore, Turner's affidavit establishes State-agent immunity as to the state-law causes of action.
We recognize that, with the benefit of hindsight, one might question the wisdom of Turner's method of detaining Ware; we will not, however, second-guess his decision. Viewing the facts in a light most favorable to Ware, as we must, see Guaranty Funding, supra, we conclude that there is insufficient evidence indicating that Turner acted "willfully, maliciously, fraudulently, in bad faith" in exercising his judgment when he confronted Ware. State-agent immunity protects educators, as agents of the State, in their exercise of judgment in educating students. The trial court erred in denying Turner's motion for a summary judgment as to the state-law causes of action.
Turner further asks this Court to direct the trial court to enter a summary judgment in his favor with regard to the § 1983 claim on the ground that his actions were protected by qualified immunity.
"`To state a claim under § 1983, the plaintiff must allege facts constituting a deprivation of a constitutional right, under color of state law.' C.B. v. Bobo, 659 So.2d [98] at 102 [ (Ala.1995) ]. Furthermore, in order to recover against a teacher or a school administrator under § 1983, a student must establish not only that he or she was deprived of a constitutional right, but also that the person who deprived him or her of that right did so in bad faith or with deliberate indifference to his or her rights. Id."

Boyett v. Tomberlin, 678 So.2d 124, 127 (Ala.Civ.App.1995). "School officials are entitled to qualified immunity from § 1983 liability for good faith, nonmalicious actions taken to fulfill their official duties. Wood v. Strickland, 420 U.S. 308, 318, 95 S.Ct. 992, 999, 43 L.Ed.2d 214 (1975)." *137 Byrd v. Sullivan, 657 So.2d 830, 833 (Ala. 1995).
Turner's affidavit provides uncontroverted sworn statements that sufficiently establish qualified immunity from the § 1983 action. No evidence was presented indicating that Turner acted in bad faith or maliciously in handling the incident. Nothing before us indicates that Turner deprived Ware of her rights under the United States Constitution. The trial court erred in denying Turner's motion for a summary judgment on the ground of qualified immunity from the § 1983 action.

Conclusion
Turner has shown that he has a clear legal right to the relief sought. The trial court is directed to enter a summary judgment in favor of Turner.
PETITION GRANTED; WRIT ISSUED.
MOORE, C.J., and HOUSTON, SEE, LYONS, BROWN, JOHNSTONE, HARWOOD, and WOODALL, JJ., concur.
NOTES
[1]  Throughout his petition to this Court and his pleadings in the trial court, Turner asserts "discretionary-function immunity" as a ground for relief. This Court in Ex parte Cranman, 792 So.2d 392 (Ala.2000), abandoned the use of the term "discretionary-function immunity" in favor of the term "State-agent immunity." Therefore, we have analyzed this petition in terms of "State-agent immunity."
