ORDER
The memorandum disposition filed April 2, 1993, is redesignated as an authored opinion by Judge Farris.
OPINION
Defendants, California state prison officials, appeal the denial of their motion for summary judgment in an action brought by former state prisoner James Haynes Camar-illo pursuant to 42 U.S.C. § 1983. While incarcerated, Camarillo, who is HIV-positive, was transferred to a housing unit for HIV-positive inmates. Camarillo’s suit alleged that his transfer violated his constitutional rights of: (1) equal protection; (2) privacy; (3) due process; (4) freedom from cruel and unusual punishment; and (5) freedom of association. On cross-motions for summary judgment, the district court held that qualified immunity barred suit against the officials for the first four of the alleged constitutional violations. On the freedom of association claim, the court did not address qualified immunity. Instead, it denied the defendants’ motion for summary judgment and ordered the matter to proceed to trial because a question remained as to whether Camarillo’s freedom to associate in fact was curtailed.
We have jurisdiction over this interlocutory appeal pursuant to the collateral order doctrine.
See Mitchell v. Forsyth,
I.
Camarillo argues that the prison officials waived the defense of qualified immunity by failing to raise it as an affirmative defense in their answer to the complaint. Qualified immunity is an affirmative defense that should be pled by the defendant.
Gomez v. Toledo,
II.
Qualified immunity protects government officials performing discretionary functions from liability for civil damages, unless the official’s conduct violates clearly established statutory or constitutional rights of which a reasonable person would have known.
Harlow v. Fitzgerald,
*640
A law is “clearly established” when “the contours of the right [are] sufficiently clear that a reasonable official would understand that what he is doing violates that right.”
Anderson v. Creighton,
The district court should have ordered summary judgment for the defendants. Once it was determined that no clearly established constitutional right was violated, the factual dispute became immaterial.
See Romero,
III.
Camarillo argues that it was clearly established at the time he was segregated in the HIV unit that prison inmates have First Amendment rights, including freedom of association. Camarillo misapprehends the level of generality at which a law must be “clearly established.”
See Anderson,
depends substantially upon the level of generality at which the relevant “legal rule” is to be identified. For example, the right to due process of law is quite clearly established by the Due Process Clause, and thus there is a sense in which any action that violates the Clause (no matter how unclear it may be that the particular action is a violation) violates a clearly established right. Much the same could be said of any other constitutional or statutory violation. But if the test of “clearly established law” were to be applied at this level of generality, it would bear no relationship to the “objective legal reasonableness” that is the touchstone of Harlow.
Id.
The relevant, properly particularized question,
see id.
A prison regulation that impinges on uan inmate’s constitutional rights is valid if it is reasonably related to legitimate penological interests.
Turner v. Safley,
REVERSED and REMANDED for entry of summary judgment for defendants on the issue of freedom of association.
Notes
. Several recent cases in other circuits have upheld as constitutional prison policies mandating segregation of HIV-positive inmates.
See, e.g., Moore
v.
Mabus,
. This is not to say that any particular HIV-segregation policy-including that of the California Department of Corrections-is constitutional. That question is not before us. We hold only that the officials in this action are immune from suit under the doctrine of qualified immunity.
.Although it is Camarillo's responsibility to "identify the universe of statutory or decisional law from which the court can determine whether the right allegedly violated was clearly established,”
see Elder,
