Mr. Justice Marshall
delivered the opinion of the Court.
The question presented is whether, in an action brought under 42 U. S. C. § 1983 against a public official whose position might entitle him to qualified immunity, a plaintiff must allege that the official has acted in bad faith in order to state a claim for relief or, alternatively, whether the defendant must plead good faith as an affirmative defense.
I
Petitioner Carlos Rivera Gomez brought this action against respondent, the Superintendent of the Police of the Commonwealth of Puerto Rico, contending that respondent had violated his right to procedural due process by discharging him from employment with the Police Department’s Bureau of Criminal Investigation. Basing jurisdiction on 28 U. S. C. § 1343 (3), petitioner alleged the following facts in his complaint. Petitioner had been employed as an agent with the Puerto Rican police since 1968. In April 1975, he submitted a sworn statement to his supervisor in which he asserted that two other agents had offered false evidence for use in a criminal case under their investigation. As a result of this statement, petitioner was immediately transferred from the Criminal Investigation Corps for the Southern Area to Police Headquarters in San Juan, and a few weeks later to the Police Academy in Gurabo, where he was given no investigative authority. In the meantime respondent ordered an investigation of petitioner’s claims, and the Legal Division of the Police Department concluded that all of petitioner's factual allegations were true.
In April 1976, while still stationed at the Police Academy, petitioner was subpoenaed to give testimony in a criminal case arising out of the evidence that petitioner had alleged to be false. At the trial petitioner, appearing as a defense witness, testified that the evidence was in fact false. As a result of this testimony, criminal charges, filed on the basis of information furnished by respondent, were brought against petitioner for the allegedly unlawful wiretapping pf the agents’ telephones. Respondent suspended petitioner in May 1976 and discharged him without a hearing in July. In October, the District Court of Puerto Rico found no probable cause to believe that petitioner was guilty of the allegedly unlawful wiretapping and, upon appeal by the prosecution, the Superior Court affirmed. Petitioner in turn sought review of his discharge before the Investigation, Prosecution, and Appeals Commission of Puerto Rico, which, after a hearing, revoked the discharge order rendered by respondent and ordered that petitioner be reinstated with backpay.
Based on the foregoing factual allegations, petitioner brought this suit for damages, contending that his discharge violated his right to procedural due process, and that it had caused him anxiety, embarrassment, and injury to his reputation in the community. In his answer, respondent denied a number of petitioner’s allegations of fact and asserted several affirmative defenses. Respondent then moved to dismiss the complaint for failure to state a cause of action, see Fed. Rule Civ. Proc. 12(b)(6), and the District Court granted the motion. Observing that respondent was entitled to qualified immunity for acts done in good faith within the scope of his official duties, it concluded that petitioner was required to plead as part of his claim for relief that, in committing the actions alleged, respondent was motivated by bad faith. The absence of any such allegation, it held, required dismissal of the complaint. The United States Court of Appeals for the First Circuit affirmed. 602 F. 2d 1018 (1979).
We granted certiorari to resolve a conflict among the Courts of Appeals. 444 U. S. 1031 (1980). We now reverse.
II
Section 1983 provides a cause of action for “the deprivation of any rights, privileges, or immunities secured by the Constitution and laws” by any person acting “under color of any statute, ordinance, regulation, custom, or usage, of any State or Territory.” 42 U. S. C. § 1983. This statute, enacted to aid in “ The preservation of human liberty and human rights,’ ” Owen v. City of Independence, 445 U. S. 622, 636 (1980), quoting Cong. Globe, 42d Cong., 1st Sess., App. 68 (1871) (Rep. Shellabarger), reflects a congressional judgment that a “damages remedy against the offending party is a vital component of any scheme for vindicating cherished constitutional guarantees,” 445 U. S., at 651. As remedial legislation, § 1983 is to be construed generously to further its primary purpose. See 445 U. S., at 636.
In certain limited circumstances, we have held that public officers are entitled to a qualified immunity from damages liability under § 1983. This conclusion has been based on an unwillingness to infer from legislative silence a congressional intention to abrogate immunities that were both “well established at common law” and “compatible with the purposes of the Civil Rights Act.” 445 U. S., at 638. Findings of immunity have thus been “predicated upon a considered inquiry into the immunity historically accorded the relevant official at common law and the interests behind it.” Imbler v. Pachtman, 424 U. S. 409, 421 (1976). In Pierson v. Ray, 386 U. S. 547, 555 (1967), for example, we concluded that a police officer would be “excus[ed] from liability for acting under a statute that he reasonably believed to be valid but that was later held unconstitutional, on its face or as applied.” And in other contexts we have held, on the basis of “[c]ommon-law tradition . . . and strong public-policy reasons,” Wood v. Strickland, 420 U. S. 308, 318 (1975), that certain categories of executive officers should be allowed qualified immunity from liability for acts done on the basis of an objectively reasonable belief that those acts were lawful. See Procunier v. Navarette, 434 U. S. 555 (1978) (prison officials); O’Connor v. Donaldson, 422 U. S. 563 (1975) (superintendent of state hospital); Wood v. Strickland, supra (local school board members); Scheuer v. Rhodes, 416 U. S. 232 (1974) (state Governor and other executive officers). Cf. Owen v. City of Independence, supra (no qualified immunity for municipalities).
Nothing in the language or legislative history of § 1983, however, suggests that in an action brought against a public official whose position might entitle him to immunity if he acted in good faith, a plaintiff must allege bad faith in order to state a claim for relief. By the plain terms of § 1983, two — and only two — allegations are required in order to state a cause of action under that statute. First, the plaintiff must allege that some person has deprived him of a federal right. Second, he must allege that the person who has deprived him of that right acted under color of state or territorial law. See Monroe v. Pape, 365 U. S. 167, 171 (1961). Petitioner has made both of the required allegations. He alleged that his discharge by respondent violated his right to procedural due process, see Board of Regents v. Roth, 408 U. S. 564 (1972), and that respondent acted under color of Puerto Rican law. See Monroe v. Pape, supra, at 172-187.
Moreover, this Court has never indicated that qualified immunity is relevant to the existence of the plaintiff’s cause of action; instead we have described it as a defense available to the official in question. See Procunier v. Navarette, supra, at 562; Pierson v. Ray, supra, at 556, 557; Butz v. Economou, 438 U. S. 478, 508 (1978). Since qualified immunity is a defense, the burden of pleading it rests with the defendant. See Fed. Rule Civ. Proc. 8 (c) (defendant must plead any “matter constituting an avoidance or affirmative defense”) ; 5 C. Wright & A. Miller, Federal Practice and Procedure § 1271 (1969). It is for the official to claim that his conduct was justified by an objectively reasonable belief that it was lawful. We see no basis for imposing on the plaintiff an obligation to anticipate such a defense by stating in his complaint that the defendant acted in bad faith.
Our conclusion as to the allocation of the burden of pleading is supported by the nature of the qualified immunity defense. As our decisions make clear, whether such immunity has been established depends on facts peculiarly within the knowledge and control of the defendant. Thus we have stated that “[i]t is the existence of reasonable grounds for the belief formed at the time and in light of all the circumstances, coupled with good-faith belief, that affords a basis for qualified immunity of executive officers for acts performed in the course of official conduct.” Scheuer v. Rhodes, supra, at 247-248. The applicable test focuses not only on whether the official has an objectively reasonable basis for that belief, but also on whether “[t]he official himself [is] acting sincerely and with a belief that he is doing right,” Wood v. Strickland, supra, at 321. There may be no way for a plaintiff to know in advance whether the official has such a belief or, indeed, whether he will even claim that he does. The existence of a subjective belief will frequently turn on factors which a plaintiff cannot reasonably be expected to know. For example, the official’s belief may be based on state or local law, advice of counsel, administrative practice, or some other factor of which the official alone is aware. To impose the pleading burden on the plaintiff would ignore this elementary fact and be contrary to the established practice in analogous areas of the law.
The decision of the Court of Appeals is reversed, and the case is remanded to that court for further proceedings consistent with this opinion.
It is so ordered.
Mr. Justice Rehnquist joins the opinion of the Court, reading it as he does to leave open the issue of the burden of persuasion, as opposed to the burden of pleading, with respect to a defense of qualified immunity.
The complaint originally named the Commonwealth of Puerto Rico and the police of the Commonwealth of Puerto Rico as additional defendants, but petitioner consented to their dismissal from the action. See App. 14, n. 1.
That section grants the federal district courts jurisdiction “[t]o redress the deprivation, under color of any State law, statute, ordinance, regulation, custom or usage, of any right, privilege or immunity secured by the Constitution of the United States or by any Act of Congress providing for, equal rights of citizens or of all persons within the jurisdiction of the United States.”
At this stage of the proceedings, of course, all allegations of the complaint must be accepted as true.
This decision was in accord with earlier decisions in that Circuit. See, e. g., Gaffney v. Silk, 488 F. 2d 1248 (1973); Kostka v. Hogg, 560 F. 2d 37 (1977); Maiorana v. MacDonald, 596 F. 2d 1072 (1979).
Other Courts of Appeals have held that the burden of pleading a defense of good faith lies with the defendant. See Bivens v. Six Unknown Named Agents of Federal Bureau of Narcotics, 456 F. 2d 1339, 1348 (CA2 1972) ; Skehan v. Board of Trustees of Bloomsburg State College, 538 F. 2d 53, 61-62 (CA3) (en banc), cert. denied, 429 U. S. 979 (1976); Bryan v. Jones, 530 F. 2d 1210, 1213 (CA5) (en banc), cert. denied, 429 U. S. 865 (1976); Jones v. Perrigan, 459 F. 2d 81, 83 (CA6 1972); Tritsis v. Backer, 501 F. 2d 1021, 1022-1023 (CA7 1974); Landrum v. Moats, 576 F. 2d 1320, 1324-1325, 1329 (CA8), cert. denied, 439 U. S. 912 (1978); Martin v. Duffie, 463 F. 2d 464, 468 (CA10 1972); Dellums v. Powell, 184 U. S. App. D. C. 275, 284-285, 566 F. 2d 167, 175-176 (1977), cert. denied, 438 U. S. 916 (1978). Cf. McCray v. Burrell, 516 F. 2d 357, 370 (CA4 1975) (en banc) (burden of proof), cert. dism’d, 426 U. S. 471 (1976); Gilker v. Baker, 576 F. 2d 245 (CA9 1978) (same).
Section 1983 provides in full: “Every person who, under color of any statute, ordinance, regulation, custom, or usage, of any State or Territory, subjects, or causes to be subjected, any citizen of the United States or other person within the jurisdiction thereof to the deprivation of any rights, privileges, or immunities secured by the Constitution and laws, shall be liable to the party injured in an action at law, suit in equity, or other proper proceeding for redress.”
Actions under Puerto Rican law come within both § 1983 and its jurisdictional predicate, 28 U. S. C. § 1343 (3). Examining Board v. Flores de Otero, 426 U. S. 672 (1976).
As then Dean Charles Clark stated over 40 years ago: “It seems to be considered only fair that certain types of things which in common law pleading were matters in confession and avoidance — i. e., matters which seemed more or less to admit the general complaint and yet to suggest some other reason why there was no right — must be specifically pleaded in the answer, and that has been a general rule.” ABA, Proceedings Institute at Washington and Symposium at New York City on the Federal Rules of Civil Procedure 49 (1939). See also 5 C. Wright & A. Miller, Federal Practice and Procedure §§ 1270-1271 (1969). Cf. FTC v. A. E. Staley Mfg. Co., 324 U. S. 746, 759 (1945) (good-faith defense under Robinson-Patman Act); Barcellona v. Tiffany English Pub., Inc., 597 F. 2d 464, 468 (CA5 1979); Cohen v. Ayers, 596 F. 2d 733, 739-740 (CA7 1979); United States v. Kroll, 547 F. 2d 393 (CA7 1977).