
    Said AHMAD, also known as Jumaat At-Tariq, Plaintiff-Appellee, v. Robert FURLONG; Mike Ehrmann, Defendants-Appellants. and John Watts; Steve Bergman, Defendants.
    No. 04-1450.
    United States Court of Appeals, Tenth Circuit.
    Jan. 18, 2006.
    
      Edward T. Farry, Jr., Farry and Rector, L.L.P., Colorado Springs, Colorado, for the Defendants-Appellants.
    James P. Rouse, Rouse & Associates, P.C., Greenwood Village, Colorado, for the Plaintiff-Appellee.
    Before TACHA, Chief Circuit Judge, HOLLOWAY, Senior Circuit Judge, and HARTZ, Circuit Judge.
   HARTZ, Circuit Judge.

Appellants Mike Ehrmann, a corrections officer at Colorado’s Sterling Correctional Facility (SCF), and Robert Furlong, a former warden of the facility, appeal the district court’s refusal to decide whether they are entitled to qualified immunity on a claim under the Religious Land Use and Institutionalized Persons Act (RLUIPA), 42 U.S.C. § 2000cc et seq. The district court held that it need not address the merits of the defense because their Amended Answer did not raise qualified immunity as a defense to the RLUIPA claim. Even accepting the district court’s view that the defense was not raised in Appellants’ Amended Answer, we hold that the defense was adequately raised in their motion for summary judgment and the district court should have addressed it. We reverse and remand for it to do so.

BACKGROUND

Said Ahmad, an inmate at SCF and an “adherent to the Suni branch of Islam,” ApltApp. at 130, filed in the United States District Court for the District of Colorado a pro se civil rights complaint and two amended complaints raising several federal constitutional claims. All claims revolved around the prison’s policy of refusing to allow prisoners to congregate for prayer outside their assigned cells without prior approval. The defendants named in the Third Amended Complaint were Appellants, as well as John Watts, a correctional officer at SCF, and Steven Bergman, SCF’s hearings officer and case manager.

Mr. Ahmad then obtained counsel, who filed a Fourth Amended Complaint which added a claim under RLUIPA. (The Fourth Amended Complaint dropped Mr. Bergman as a defendant. Later, Mr. Ahmad filed a Fifth Amended Complaint which added as a defendant the new warden of SCF, Gary Golder, solely for purposes of seeking injunctive relief. Mr. Golder is not a party to this appeal.)

RLUIPA forbids a prison from “imposing] a substantial burden on the religious exercise” of an inmate “unless [it] demonstrates that imposition of the burden on that person ... (I) is in furtherance of a compelling governmental interest; and (2) is the least restrictive means of furthering that compelling governmental interest.” 42 U.S.C. § 2000cc-1(a). RLUIPA defines religious exercise to “include[] any exercise of religion, whether or not compelled by, or central to, a system of religious belief.” 42 U.S.C. § 2000cc-5(7)(A).

Appellants contend that they are not personally liable for any alleged RLUIPA violation because they are entitled to qualified immunity. Qualified immunity protects from litigation a public official whose possible violation of a plaintiffs civil rights was not clearly a violation at the time of the official’s actions. It “is an entitlement not to stand trial or face the other burdens of litigation. The privilege is an immunity from suit rather than a mere defense to liability.” Roska v. Peterson, 328 F.3d 1230, 1239 (10th Cir.2003) (internal quotation marks, citations, and italics omitted). When a defendant asserts the defense of qualified immunity, the burden shifts to the plaintiff to overcome the asserted immunity. Medina v. Cram, 252 F.3d 1124, 1128 (10th Cir.2001). “The plaintiff must first establish that the defendant’s actions violated a constitutional or statutory right. If the plaintiff establishes a violation of a constitutional or statutory right, he must then demonstrate that the right at issue was clearly established at the time of the defendant’s unlawful conduct.” Id. (internal quotation marks and citations omitted).

The issue on appeal is not the merits of Appellants’ qualified-immunity claim, but whether they adequately raised the defense below. Their answer to Mr. Ahmad’s Third Amended Complaint (which did not include a RLUIPA claim) stated the defense. Then in response to the Fourth Amended Complaint, they and defendant Watts filed an Amended Answer and Jury Demand containing the following paragraphs:

Original Answer and Affirmative Defenses Reaffirmed
3. The Defendants reassert and reaffirm their original ANSWER as well as the affirmative defenses in the ANSWER, to wit: Defendants are immune under the doctrine of Qualified Immunity; and any conduct of the defendants was based on a legitimate penological interest and or authorized by law.
RLUIPA Claim
4. The Defendants deny that they have violated any provisions of RLUI-PA.
RLUIPA Affirmative Defenses
5. RLUIPA is unconstitutional, violates the separation of powers doctrine, and the establishment clause. RLUIPA was not properly enacted pursuant to the Commerce Clause and or the Spending Clause. Finally, RLUIPA violates the Tenth Amendment.

Aplt.App. at 141.

On September 5, 2003, Appellants moved for summary judgment. In their Motion for Summary Judgment they state: “The State Defendants move for Summary Judgment, Fed.R.Civ.P. 56, and dismissal of the § 1983 and RLUIPA claims against them for the reasons iterated below.” Id. at 182. Five reasons are listed: (1) “No violation of § 1983”; (2) “There is No Violation of RLUIPA”; (3) “No Personal Participation”; (4) “Qualified Immunity”; and (5) “No Evidence to Support Punitive Damages.” Id. at 182-83. Under the qualified-immunity heading Appellants state:

[Appellants] were/are Colorado State Officials at CDOC’s SCF and are presumptively entitled to Qualified Immunity. All conduct engaged in by [Appellants] was pursuant to and consistent with a valid regulation: CDOC Administrative Regulation 800-01 dated 10-1-99. Therefore, these two defendants are entitled to Qualified Immunity for this reason.

Id. at 183.

In their memorandum in support they further contend, “[Appellants] are here sued in their individual capacity and are therefore presumed to be immune from suit and liability.” Id. at 195. They then set forth their description of qualified-immunity doctrine and conclude, “Therefore the claims must be dismissed against the State Defendants in their individual capacity.” Id. at 197. The section does not address any specific claim, mentioning neither RLUIPA nor any specific constitutional provisions, nor does it specifically exempt any claim from their assertion of qualified immunity. Mr. Ahmad’s responsive brief, however, specifically argues that Appellants are not entitled to qualified immunity on the RLUIPA claim. In the section headed, “Summary Judgment is inappropriate with respect to Defendant’s [sic] Affirmative Defense of Qualified Immunity,” id. at 236, it states:

Furthermore, even if the Court were to find that Plaintiffs right to exercise his religion in this context was not “clearly established” under pre-RLUI-PA analysis, RLUIPA’s heightened standard requires that once Plaintiff has asserted that his religious freedom has been violated, Defendants must (1) have a compelling state interest in prohibiting the practice and (2) must be employing the least restrictive means of reaching that interest. 42 U.S.C. § 2000cc-1. Defendants have made no efforts to ensure that their policy of prohibiting group prayer outside the cells, nor their policy of prohibiting individual Muslim prayer outside the cell, is the least restrictive means available to them. Defendants were aware of RLUIPA.... As argued above, the fact that Plaintiff was allowed to pray in the multi-purpose room prior to January of 2000 tends to show that there is a least [sic] restrictive means of allowing corporate prayer in that room.

Id. at 238-39. In the Final Pretrial Order, filed before Appellants’ motion for summary judgment was decided, Appellants again assert in general terms the defense of qualified immunity.

On August 5, 2004, the magistrate judge issued a recommendation on Appellants’ motion for summary judgment. The recommendation addresses qualified immunity with respect to each of Mr. Ahmad’s constitutional claims and concludes that Appellants (and defendant Watts) should be granted qualified immunity with respect to these claims. Because Mr. Ahmad failed to show that Mr. Watts personally participated in any of the alleged wrongs, the recommendation also says that he should be granted summary judgment on a separate retaliation claim (filed only against him) and on the RLUIPA claims. Finally, the recommendation concludes that the prison’s prohibition against congregate prayer in the living units does not violate RLUIPA, but that Mr. Ahmad should be allowed to go forward against Appellants on his claim that RLUIPA was violated by the prison’s refusal to allow him to engage in individual demonstrative prayer outside his cell. The RLUIPA discussion twice states that Appellants had not raised a qualified-immunity defense to the RLUIPA claim. One footnote states:

[Appellants], in their individual capacities, do not assert qualified immunity as a defense to plaintiffs request for monetary relief on his RLUIPA claims. See Amended Answer,’ filed March 21, 2003, ¶¶ 4-5; State Defendants’ Brief in Support of MSJ, at 11-13 (asserting qualified immunity defense against constitutional claims only).

Id. at 328 n. 16. And a later footnote

note[s] again that [Appellants] did not assert qualified immunity as a defense to plaintiffs RLUIPA claim in their Amended Answer, filed March 21, 2003.... Further, [Appellants] argued in their motion for summary judgment that they were entitled to qualified immunity ... on plaintiffs constitutional claims only.... Qualified immunity is an affirmative defense which must be asserted in an answer or in a motion for summary judgment.

Id. at 348 n. 24.

The magistrate ■ judge thus recommended that all claims against Appellants be dismissed except the individual-prayer RLUIPA claim. Appellants filed an objection to the recommendation, disputing that they had failed to plead and argue qualified immunity with respect to the RLUI-PA claim. The district court rejected the objection and issued an order adopting the recommendation, stating:

The burden of pleading qualified immunity is on [Appellants].... Under a separate heading labeled “RLÜÍPA Claim” in [Appellants’] Amended Answer, [Appellants] deny violating RLUIPA. Another heading, labeled “RLUIPA Affirmative Defenses,” cláims that RLUIPA is unconstitutional. If [Appellants] had wished to claim qualified immunity as to the added RLUIPA claim, they should have done so under'. “RLUIPA Affirmative Defenses’’ in their Amended Answer. They did not do so. Therefore, [Appellants] have failed to properly plead qualified immunity to the RLUI-PA Claim....

Id. at 371.

Appellants appeal the district court’s failure to resolve the merits of their qualified-immunity defense to the RLUIPA claim.

DISCUSSION

Appellants’ Amended Answer and Motion for Summary Judgment are both ambiguous with respect to whether they are raising a qualified-immunity defense to the RLUIPA claim. The district court’s analysis was straightforward: It resolved the ambiguity against Appellants with respect to the Amended Answer and then concluded that the failure to plead the defense barred its consideration by the court. In our-view, a less rigid approach is required. We do not question the district court’s resolution of the ambiguity in the Amended Answer. Were we required to decide one way or the other with respect to whether qualified immunity to the RLUI-PA claim had been raised in the Amended Answer, we might well agree with the district court. Nevertheless, in light of (1) the purposes for requiring affirmative defenses-to be pleaded, (2) the ambiguity in both the Amended Answer and the Motion for Summary Judgment, and, critically, (3) Mr. Ahmad’s discussion of the qualified-immunity defense to the RLUIPA claim in his response to the motion, we hold as a matter of law that the defense was adequately presented to the court and should have been decided. See FDIC v. Oaklawn Apartments, 959 F.2d 170, 173 (10th Cir.1992) (Whether an affirmative defense has been waived is a mixed question of law and fact, which “require[s] us to accept the district court’s factual conclusions unless clearly erroneous but review the application of the facts to the law under a de novo standard.”); Mullan v. Quickie Aircraft Corp., 797 F.2d 845, 850 (10th Cir.1986) (mixed question of law and fact is reviewed de novo when issue involves primarily consideration of legal principles).

We first address whether failure to plead qualified immunity to the RLUIPA claim in their Amended Answer is fatal to Appellants’ argument. “In pleading to a preceding pleading, a party shall set forth affirmatively ... any ... affirmative defense.” Fed.R.Civ.P. 8(c). “Since qualified immunity is a defense, the burden of pleading it rests with the defendant.” Gomez v. Toledo, 446 U.S. 635, 640, 100 S.Ct. 1920, 64 L.Ed.2d 572 (1980).

The D.C. Circuit has held that an affirmative defense may not be raised for the first time in a post-answer motion without first amending the answer. Harris v. Secretary, U.S. Dep’t of Veterans Affairs, 126 F.3d 339, 344-45 (D.C.Cir.1997). But strict adherence to the pleading requirement is inappropriate when the purpose of the requirement has been otherwise fulfilled. “The purpose of ... pleading [an affirmative defense] is to give the opposing party notice of the [defense] and a chance to argue, if he can, why the imposition of [the defense] would be inappropriate.” Blonder-Tongue Lab., Inc. v. Univ. of Ill. Found., 402 U.S. 313, 350, 91 S.Ct. 1434, 28 L.Ed.2d 788 (1971). Accordingly, “[m]ost other courts are not so strict [as the D.C. Circuit]. They do permit a defendant to raise an affirmative defense for the first time in a post-answer motion if the defense is raised in sufficient time that there is no prejudice to the opposing party merely because of the delay.” 2 James Wm. Moore et ah, Moore’s Federal Practice, § 8.07[2] (3d ed.1997). See Williams v. Ashland Eng’g Co., 45 F.3d 588, 593 (1st Cir.1995) (“Rule 8(e)’s core purpose [is] to act as a safeguard against surprise and unfair prejudice.... Where, as here, a plaintiff clearly anticipates that an issue will be litigated, and is not unfairly prejudiced when the defendant actually raises it, a mere failure to plead the defense more particularly will not constitute a waiver.”); Saks v. Franklin Covey Co., 316 F.3d 337, 350 (2d Cir.2003) (“[A] district court may still entertain affirmative defenses [not pleaded in the answer] at the summary judgment stage in the absence of undue prejudice to the plaintiff, bad faith or dilatory motive on the part of the defendant, futility, or undue delay of the proceedings.”); Pro v. Donatucci, 81 F.3d 1283, 1286 n. 2 (3d Cir.1996) (“Our court previously has taken the position that whether an affirmative defense that must be pleaded in the answer is waived will depend on whether the defense was raised at a pragmatically sufficient time and the plaintiff was prejudiced in the ability to respond.” (internal quotation marks omitted)); Brinkley v. Harbour Recreation Club, 180 F.3d 598, 612 (4th Cir.1999) (“[T]here is ample authority in this Circuit for the proposition that absent unfair surprise or prejudice to the plaintiff, a defendant’s affirmative defense is not waived when it is first raised in a pre-trial disposi-tive motion.”); Giles v. Gen. Elec. Co., 245 F.3d 474, 491-92 (5th Cir.2001) (“Although failure to raise an affirmative defense under rule 8(c) in a party’s first responsive pleading generally results in a waiver, where the matter is raised in the trial court in a manner that does not result in unfair surprise technical failure to comply with Rule 8(c) is not fatal.” (internal quotation marks, brackets, and ellipses omitted)); Moore, Owen, Thomas & Co. v. Coffey, 992 F.2d 1439, 1445 (6th Cir.1993) (“It is well established, however, that failure to raise an affirmative defense by responsive pleading does not always result in waiver.”); Fin. Timing Publ’ns, Inc. v. Compugraphic Corp., 893 F.2d 936, 944 n. 9 (8th Cir.1990) (affirmative defense not waived when other “notices were sufficient to avoid unfair surprise”); Camarillo v. McCarthy, 998 F.2d 638, 639 (9th Cir.1993) (“Qualified immunity is an affirmative defense that should be pled by the defendant. In the absence of a showing of prejudice, however, an affirmative defense may be raised for the first time at summary judgment.” (internal citation omitted)); Grant v. Preferred Research, Inc., 885 F.2d 795, 797 (11th Cir.1989) (“[I]f a plaintiff receives notice of an affirmative defense by some means other than pleadings, the defendant’s failure to comply with Rule 8(c) does not cause the plaintiff any prejudice. When there is no prejudice, the trial court does not err by hearing evidence on the issue.” (internal quotation marks and citation omitted)).

We have recognized the same underlying principle in the context of a plaintiffs complaint: “A plaintiff should not be prevented from pursuing a claim simply because of a failure to set forth in the complaint a theory on which the plaintiff could recover, provided that a late shift in the thrust of the case will not prejudice the other party in maintaining its defense.” Green Country Food Mkt., Inc. v. Bottling Group, LLC, 371 F.3d 1275, 1279 (10th Cir.2004). And we have held that an affirmative defense was not waived for trial purposes when it had first been raised in a motion for summary judgment three months earlier. Ball Corp. v. Xidex Corp., 967 F.2d 1440, 1443-44 (10th Cir.1992) (“This court has held that the purpose behind rule 8(c) is that of putting plaintiff on notice well in advance of trial that defendant intends to present a defense in the nature of an avoidance.” (internal quotation marks and brackets omitted)).

We agree with the D.C. Circuit that the best procedure is to plead an affirmative defense in an answer or amended answer. And, as that court pointed out, absence of prejudice to the opposing party is not the only proper consideration in determining whether to permit an amended answer; a motion to amend may also be denied on grounds such as “ ‘undue delay, bad faith or dilatory motive ..., or repeated failure to cure deficiencies by amendments previously allowed.’ ” Harris, 126 F.3d at 345 (quoting Foman v. Davis, 371 U.S. 178, 182, 83 S.Ct. 227, 9 L.Ed.2d 222 (1962)) (internal brackets omitted). Accordingly, courts should not permit a party to circumvent these other restrictions on amendments simply by filing a dispositive motion rather than a motion to amend. See id. But that concern can be obviated without a strict requirement that the answer be amended before raising a defense in a motion for summary judgment. Rather than demanding that the defendant first move to amend the answer, we need only apply the same standards that govern motions to amend when we determine whether the defendant should be permitted to “constructively” amend the answer by means of the summary-judgment motion. Because we review for abuse of discretion a district court’s ruling on a motion to amend, see The Tool Box, Inc. v. Ogden City Corp., 419 F.3d 1084, 1086-87 (10th Cir.2005), we apply the same standard to a ruling on whether an affirmative defense may first be raised in a motion for summary judgment.

Having determined that Appellants were not necessarily barred from raising a RLUIPA qualified-immunity defense in their motion for summary judgment, we now turn to whether the defense was so raised. The district court did not address the issue; in its view, it was irrelevant whether the motion for summary judgment raised the defense because the defense was foreclosed by Appellants’ failure to plead it in an answer. There is no need, however, for a remand to the district court to decide the issue, because the record compels the conclusion that the defense was raised in the summary-judgment motion.

To be sure, Appellants’ motion did not clearly raise qualified immunity with respect to the RLUIPA claim. Although both the motion and supporting memorandum asserted qualified immunity as to “[a]ll” their conduct, and requested that “the claims” be dismissed on this basis, Aplt-App. at 183, 197, they did not expressly mention RLUIPA in the context of qualified immunity. One who did not read the Amended Answer as asserting qualified immunity with respect to the RLUIPA claim might have reasonably read the motion as raising qualified immunity only with respect to the constitutional claims. If Mr. Ahmad’s response had not addressed qualified immunity in the RLUI-PA context, the district court could have properly determined that it would be unfair to him to decide the issue.

But in fact Mr. Ahmad’s response to Appellants’ motion for summary judgment did address RLUIPA qualified immunity. Thus, we need not worry about whether the ambiguity in Appellants’ motion misled Mr. Ahmad into believing that qualified immunity was being relied upon only to defend against the constitutional claims. The district court might still have questioned whether Appellants actually intended to assert qualified immunity with respect to the RLUIPA claim, but that question was resolved by Appellants’ objection to the magistrate judge’s statements that they had not asserted the defense. In this circumstance, no purpose would be served by resolving the ambiguity in the summary-judgment motion against Appellants. If Appellants intended to raise the defense and Mr. Ahmad thought they had, why should a court insist on reading the motion differently? Doing so would be similar to a court’s resolving a contractual ambiguity contrary to the intent of both contracting parties. See Restatement (Second) of Contracts § 201(1) (1979) (“Where parties have attached the same meaning to a promise or agreement or a term thereof, it is interpreted in accordance with that meaning.”). We hold as a matter of law that RLUIPA qualified immunity was raised for the district court to consider in ruling on the motion for summary judgment.

At oral argument, counsel for Mr. Ahmad asserted that his response to the summary-judgment motion did not acknowledge that Appellants had raised a qualified-immunity defense to the RLUI-PA claim. He characterized the response as an “even if’ argument, meaning that he was simply arguing that “even if’ the pleadings alleged qualified immunity on the RLUIPA claim, Appellants were not entitled to summary judgment. But that is not how the response framed the argument, and the district court could not have reasonably read the response that way. Moreover, Mr. Ahmad posed no objection to the RLUIPA qualified-immunity defense being raised before the district court. Instead, the magistrate judge sua sponte concluded that Appellants had limited their qualified-immunity defense to the constitutional claims.

Finally, having accepted the district court’s determination that qualified immunity with respect to the RLUIPA claim was not pleaded in the Amended Answer, but also having concluded that it was adequately raised by the summary-judgment motion, we consider whether Appellants should have been precluded from constructively amending their answer by raising the defense in the motion. No grounds for such preclusion are apparent to us. Indeed, perhaps because Mr. Ahmad read the Amended Answer as asserting the defense, his response to the motion for summary judgment raised no objection to Appellants’ claiming RLUI-PA qualified immunity. Nor did his counsel at oral argument point to any prejudice he would have suffered had the district court considered the defense. In particular, counsel acknowledged that no additional discovery would have been necessary. We therefore hold that the defense could be raised for the first time in the summary-judgment motion. Had the district court ruled otherwise, the ruling would have been an abuse of discretion.

We REVERSE the district court’s ruling that Appellants waived the defense of qualified immunity on the RLUIPA claim, and REMAND for a determination of the issue. 
      
      . Perhaps a better analogy is to Fed.R.Civ.P. 15(b), which provides that when an issue "not raised by the pleadings [is] tried by express or implied consent of the parties, [it] shall be treated in all respects as if [it] had been raised in the pleadings,” Fed.R.Civ.P. 15(b). We have applied Rule 15(b) to a defense raised in a motion for summary judgment on the eve of trial. See Suiter v. Mitchell Motor Coach Sales, Inc., 151 F.3d 1275, 1279-80 (10th Cir.1998). But there is a split among the circuits (and within some circuits) on whether the rule applies at the summary-judgment stage. Compare Cruz v. Coach Stores, Inc., 202 F.3d 560, 569 (2d Cir.2000) (applying Rule 15(b) at summary-judgment stage); United States ex rel. Canion v. Randall & Blake, 817 F.2d 1188, 1193 (5th Cir.1987) (same); Smith v. Transworld Sys., Inc., 953 F.2d 1025, 1030 (6th Cir.1992) (same); Walton v. Jennings Cmty. Hosp. Inc., 875 F.2d 1317, 1320 n. 3 (7th Cir.1989) (same); Jackson v. Hayakawa, 605 F.2d 1121, 1129 (9th Cir.1979) (same); and Kulkarni v. Alexander, 662 F.2d 758, 762 (D.C.Cir.1978) (Rule 15(b)’s "general principle” has been applied at summary judgment stage), with Crawford v. Gould, 56 F.3d 1162, 1168-69 (9th Cir.1995) ("The present case did not go to trial; it was decided on motions for summary judgment. Therefore, the situation which Rule 15(b) addresses simply did not arise in the present case.”); Blue Cross Blue Shield v. Weitz, 913 F.2d 1544, 1550 (11th Cir.1990) (Rule 15(b) is "inapposite” when case decided on summary judgment); Harris, 126 F.3d at 344 n. 3 (Rule 15(b) does not apply when case does not reach trial); and Indep. Petroleum Ass'n. of Am. v. Babbitt, 235 F.3d 588, 596 (D.C.Cir.2001) ("It is an open question whether the Federal Rules permit parties to impliedly consent to 'try’ issues not raised in their pleadings through summary judgment motions.”).
     