#### James Haynes CAMARILLO, Plaintiff-Appellee, v. Daniel J. McCARTHY, Director, et al., Defendants-Appellants.

No. 92-15991.

United States Court of Appeals, Ninth Circuit.

Submitted Feb. 3, 1993.*

Memorandum April 2, 1993.

Order and Opinion July 1, 1993.

*639Allen R. Crown, Deputy Atty. Gen., Sacramento, CA, for defendants-appellants.

James Haynes Camarillo, pro se.

Before: FARRIS, POOLE, and WIGGINS, Circuit Judges.

*

 The panel unanimously found this case suitable for decision without oral argument. Fed. R.App.P. 34(a); 9th Cir.R. 34-4.

ORDER

The memorandum disposition filed April 2, 1993, is redesignated as an authored opinion by Judge Farris.

OPINION

FARRIS, Circuit Judge:

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,*472 U.S. 511, 530, 105 S.Ct. 2806, 2817, 86 L.Ed.2d 411 (1985); *Romero v. Kitsap County,*931 F.2d 624, 626 (9th Cir.1991). We review de novo the denial of a defense based on qualified immunity. *Romero,*931 F.2d at 627.

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,*446 U.S. 635, 640, 100 S.Ct. 1920, 1923, 64 L.Ed.2d 572 (1980); Fed. R.Civ.P. 8(c). In the absence of a showing of prejudice, however, an affirmative defense may be raised for the first time at summary judgment. *See Rivera v. Anaya,*726 F.2d 564, 566 (9th Cir.1984). Camarillo has not claimed prejudice; nor is any suggested by the record. The defense of qualified immunity was not waived. *See id.*

*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,*457 U.S. 800, 818, 102 S.Ct. 2727, 2738, 73 L.Ed.2d 396 (1982); *Romero,*931 F.2d at 627. The plaintiff in a § 1983 action bears the burden of proving that the right allegedly violated was clearly established at the time of the official’s allegedly impermissible conduct. *Elder v. Holloway,*975 F.2d 1388, 1390 (9th Cir.1992), *petition for cert. filed,*— U.S. -, 113 S.Ct. 3033, 125 L.Ed.2d 721 (1993); *Romero,*931 F.2d at 627.

*640A 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,*483 U.S. 635, 640, 107 S.Ct. 3034, 3039, 97 L.Ed.2d 523 (1987). The magistrate judge, whose findings were adopted by the district court, canvassed relevant decisional law, *see Wood v. Ostrander,*879 F.2d 583, 591 (9th Cir.1989), *cert. denied,*498 U.S. 938, 111 S.Ct. 341, 112 L.Ed.2d 305 (1990), and concluded that “[i]t was not clearly established by statute or case law that such segregation violated statutory or constitutional rights.” Nevertheless, the court denied in part the defendants’ motion for summary judgment because a factual dispute remained as to whether Camarillo’s freedom to associate was restricted.

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,*931 F.2d at 628.

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,*483 U.S. at 639, 107 S.Ct. at 3038. The operation of the “clearly established” standard,

> 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.*483 U.S. at 640, 107 S.Ct. at 3039, is whether, at the time of the transfer, it was clearly established that inmates are entitled to be free from prison regulations that restrict their association with members of the general prison population.

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,*482 U.S. 78, 89, 107 S.Ct. 2254, 2261, 96 L.Ed.2d 64 (1987). It was not clearly established at the relevant time-nor is it now1-that a prison policy segregating HIV-positive inmates from the general prison population is unconstitutional.2 Camarillo failed to cite a single ease, either to the district court or on appeal, indicating otherwise.3

REVERSED and REMANDED for entry of summary judgment for defendants on the issue of freedom of association.

1

. Several recent cases in other circuits have upheld as constitutional prison policies mandating segregation of HIV-positive inmates. *See, e.g., Moore*v. *Mabus,*976 F.2d 268, 271 (5th Cir. 1992) ("the identification and segregation of HIV-positive prisoners obviously serves a legitimate penological interest.”); *Harris v. Thigpen,*941 F.2d 1495, 1521 (11th Cir.1991); *Muhammad v. Carlson,*845 F.2d 175, 177 (8th Cir.1988), *cert. denied,*489 U.S. 1068, 109 S.Ct. 1346, 103 L.Ed.2d 814 (1989); *Cordero v. Coughlin,*607 F.Supp. 9, 11 (S.D.N.Y.1984).

2

. 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.

3

.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,*975 F.2d at 1392, we may undertake our own inquiry. *See id.*at 1396. Our research convinces us that the right Camarillo asserts was not clearly established in June 1987.