The Governor of Washington and state prison authorities, defendants-appellants, appeal the district court’s denial of their motion for summary judgment based on the defense of qualified immunity. Plaintiff-appellee Lanford D. Tribble, an inmate at the Washington State Penitentiary in Walla Walla, Washington, brought this action under 42 U.S.C. § 1983 seeking damages, declaratory and injunctive relief based upon the digital body cavity searches routinely conducted whenever a prisoner is *323moved into the Intensive Management Unit, a secure housing unit within the maximum security prison. We affirm.
I
In June 1984, the Washington State Penitentiary in Walla Walla opened an Intensive Management Unit (“IMU”), a ninety-six cell secure housing unit within the maximum security prison.1 Washington State Department of Corrections Policy Directive 420.110(A)(4)(a) provides that a digital body cavity search, including the rectum, shall be conducted on all inmates prior to initial placement in the IMU, and upon return to the IMU from other portions of the prison “when a good opportunity for concealment has occurred.” In other words, when an inmate has left the direct supervision and custody of escorting officers, a digital rectal search is required to be conducted on the inmate upon re-entry into the IMU. The ostensible purpose of the policy is based on the need for security in the IMU.
On January 16, 1986, prison officials discovered contraband during a search of the general population three-man cell in which Tribble resided. Tribble, on the basis of a “cell tag” regulation, Wash.Admin.Code § 137-28-031 (1986),2 was cited for possession of the contraband. The following day, a prison officer told Tribble he was to be transferred to the IMU. The officer allegedly smiled and stated: “Today, you meet ‘Mr. Big Finger,’ Tribble----”
Prior to his move from the general population to the IMU, Tribble was handcuffed behind his back, placed in leg irons, chained around his waist, and taken to the prison hospital.3 He was placed on an examination table and a physician’s assistant conducted a digital body cavity search including digital penetration and examination of his rectum. This examination was videotaped by correctional officers. It is undisputed that the search occurred pursuant to policy, and was not based upon a suspicion that Tribble had secreted any item in his rectum. Tribble was then taken to the IMU.
Tribble brought suit alleging, in part, that the policy of conducting digital body cavity searchés upon entry to the IMU from other portions of the prison without any individualized cause to do so constitutes an unreasonable search under the fourth amendment and cruel and unusual punishment under the eighth amendment. Appellants moved for summary judgment, in part, based upon the qualified immunity defense, contending that the constitutionality of the policy was an open question.
II
We have jurisdiction over this interlocutory appeal pursuant to Mitchell v. Forsyth, 472 U.S. 511, 529-30, 105 S.Ct. 2806, 2817-18, 86 L.Ed.2d 411 (1985) (“[A] district court’s denial of a claim of qualified immunity, to the extent that it turns on an issue of law, is an appealable ‘final decision’ within the meaning of 28 U.S.C. § 1291 notwithstanding the absence of a final judgment.”). See generally Kraus v. County of Pierce, 793 F.2d 1105, 1107-08 (9th Cir.1986), cert. denied, 480 U.S. 932, 107 S.Ct. 1571, 94 L.Ed.2d 763 (1987).
We review de novo the denial of a qualified immunity defense. White by White v. Pierce County, 797 F.2d 812, 814 (9th Cir.1986). We review the evidence in the light most favorable to the nonmoving party. Id.
III
In this appeal, we do not determine whether the search conducted on Tribble violated the fourth amendment’s proscription against unreasonable searches. Nor *324do we determine whether the particular search amounted to “unnecessary and wanton infliction of pain” forbidden by the eighth amendment. Estelle v. Gamble, 429 U.S. 97, 104, 97 S.Ct. 285, 291, 50 L.Ed.2d 251 (1976) (quoting Gregg v. Georgia, 428 U.S. 153, 173, 96 S.Ct. 2909, 2925, 49 L.Ed.2d 859 (1976) (joint opinion)); see McRorie v. Shimoda, 795 F.2d 780, 784 (9th Cir.1986).4 Instead, first we must determine whether, at the time of the search, Tribble had a clearly established right to be free from a digital rectal search conducted for purposes unrelated to security concerns. See Davis v. Scherer, 468 U.S. 183, 191, 104 S.Ct. 3012, 3017, 82 L.Ed.2d 139 (1984). Second, we must determine whether, given the facts of this case, a reasonable person would have known that searches pursuant to Policy Directive 420.110(A)(4)(a) violated Tribble’s clearly established rights. See Anderson v. Creighton, — U.S. -, 107 S.Ct. 3034, 3040, 97 L.Ed.2d 523 (1987).
“[Government officials performing discretionary functions[ ] generally are shielded from liability for civil damages [in a section 1983 action] insofar as their conduct does not violate 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). The “clearly established law” test requires more than an alleged “violation of extremely abstract rights.” Anderson, 107 S.Ct. at 3038-39. Rather, “[t]he contours of the right must be sufficiently clear that a reasonable official would understand that what he is doing violates that right.” Id. at 3038. In other words, “in the light of preexisting law the unlawfulness must be apparent.” Id.
To determine whether a right is clearly established, “in the absence of binding precedent, a court should look at all available decisional law including decisions of state courts, other circuits and district courts____” Ward v. County of San Diego, 791 F.2d 1329, 1332 (9th Cir.1986), cert. denied, — U.S. -, 107 S.Ct. 3263, 97 L.Ed.2d 762 (1987). An additional factor that may be considered is “a determination of the likelihood that the Supreme Court or this circuit would have reached the same result as courts which had previously considered the issue.” Capoeman v. Reed, 754 F.2d 1512, 1515 (9th Cir.1985). Government officials are charged with knowledge of constitutional developments, including all available decisional law. Gutierrez v. Municipal Court, 838 F.2d 1031, 1048 (9th Cir.1988).
We begin with the well-settled principle that “a prison inmate ‘retains those [constitutional] rights that are not inconsistent with his status as a prisoner or with the legitimate penological objectives of the corrections system.’ ” Turner v. Safley, 482 U.S. 78, 107 S.Ct. 2254, 2265, 96 L.Ed.2d 64 (1987) (quoting Pell v. Procunier, 417 U.S. 817, 822, 94 S.Ct. 2800, 2804, 41 L.Ed.2d 495 (1974)) (brackets in original). Supreme Court decisions express the general principle in this area. Procunier v. Martinez, 416 U.S. 396, 94 S.Ct. 1800, 40 L.Ed.2d 224 (1974), Pell v. Procunier, 417 U.S. 817, 94 S.Ct. 2800, 41 L.Ed.2d 495 (1974), Jones v. North Carolina Prisoners’ Union, 433 U.S. 119, 97 S.Ct. 2532, 53 L.Ed.2d 629 (1977), and Bell v. Wolfish, 441 U.S. 520, 99 S.Ct. 1861, 60 L.Ed.2d 447 (1979), established the principle that, to avoid constitutional infirmity, a prison regulation that infringes on inmates’ constitutional rights must be reasonably related to legitimate penological objectives. See Turner, 107 S.Ct. at 2257-62 (discussing cases).
Accordingly, because digital rectal searches are highly intrusive and humiliating, the Second and Fifth Circuits have stated that the government must show that a legitimate penological need necessitated the search. United States v. Lilly, 576 F.2d 1240, 1246 (5th Cir.1978); Sostre v. *325Preiser, 519 F.2d 763, 764 (2nd Cir.1975) (dicta).5
In Lilly, defendants attempted to smuggle contraband into prison and were subjected to a digital rectal cavity search. Acknowledging that “[t]he history and purpose underlying the fourth amendment ... require that prisoners retain at least some degree of their fourth amendment protection,” 576 F.2d at 1244, the court opined that “[i]t is now settled law ... that a prisoner loses only those rights that must be sacrificed to serve legitimate penological needs.” Id. (citing United States v. Savage, 482 F.2d 1371, 1372 (9th Cir.1973), cert. denied, 415 U.S. 932, 94 S.Ct. 1446, 39 L.Ed.2d 491 (1974)).
In view of these decisions, were this court to face the constitutionality of the precise type of search conducted in this case, we would have reached the same result as the Second and Fifth Circuits. See United States v. Savage, 482 F.2d 1371, 1373 (9th Cir.1973) (warrantless search of prisoner’s cell violates the fourth amendment unless it serves a justifiable purpose of imprisonment or prison security), cert. denied, 415 U.S. 932, 94 S.Ct. 1446, 39 L.Ed.2d 491 (1974). Accord United States v. Vallez, 653 F.2d 403, 406 (9th Cir.1981), cert. denied, 454 U.S. 904, 102 S.Ct. 412, 70 L.Ed.2d 223 (1982); United States v. Hearst, 563 F.2d 1331, 1344-45 (9th Cir.1977), cert. denied, 435 U.S. 1000, 98 S.Ct. 1656, 56 L.Ed.2d 90 (1978); United States v. Dawson, 516 F.2d 796, 806 (9th Cir.), cert. denied, 423 U.S. 855, 96 S.Ct. 104, 46 L.Ed.2d 80 (1975). Therefore, we hold that this rule, that the regulation must be reasonably related to a legitimate penological need, was clearly established law at the time Tribble was subjected to the digital rectal search.6
The district court found that Tribble produced substantial probative evidence that the searches are conducted for purposes unrelated to security considerations.7 We agree. In addition, viewing the evidence in the light most favorable to Tribble, there is sufficient evidence that a reasonable person would have known that such searches violated Tribble’s clearly established rights.
First, digital rectal searches are one of the most intrusive methods of detecting contraband; yet, Tribble has presented evidence that the prison staff do not search *326clothing, hair, hands or any body cavity other than the rectal cavity. Of all the evidence Tribble submitted, this evidence is most telling of the actual purpose of the digital rectal search policy.
Allen Breed, a penologist who testified in related proceedings in the Eastern District of Washington and whose report was submitted to the district court in this case, reviewed “a number of videotapes of forced digital searches” and found that in those cases
no effort was made to search the clothing, other body cavities, hair, or even hands. The entire focus and effort of the exercise was the finger probe, after which the inmates’ clothing was pulled up and he was carried to a van and transported to IMU. The inmates viewed were placed in their cells at IMU with the same clothing on that they were wearing when the forced move was started!
In addition, Tribble submitted an affidavit from an inmate who stated that, despite carrying a full pack of tobacco in the pocket of his overalls,8 he was not subjected to any method of search other than a digital rectal cavity probe upon his entry to the IMU. One can draw an inference that a search limited to the rectal cavity may be done for punitive purposes because prisoners can smuggle contraband into the IMU by concealing it elsewhere.
Second, Tribble presented evidence that the prison guards use the digital rectal search policy as a threat to influence inmates in the general population to conform to prison regulations.
Finally, Tribble contends that, because the prison staff conducted an unnecessary digital rectal search upon his return from the prison hospital in April 1986, the policy must be based upon a punitive purpose. At the hospital, Tribble had x-rays which indicated that he had no contraband concealed in his rectum. Tribble claims that the prison staff was aware of his x-ray results yet conducted the search because of a prison policy purportedly based on a need to detect such items.
Defendants contend only that Tribble’s assertions tending to show a purpose unrelated to security considerations were improperly relied upon by the district court in denying their motion. In particular, defendants claim that the district court erred as a matter of law by inquiring into their motivation for the implementation and execution of the digital rectal search policy.
Generally, an official’s state of mind is not a factor in determining the application of qualified immunity. Anderson, 107 S.Ct. at 3040; Harlow, 457 U.S. at 817, 102 S.Ct. at 2737. This rule is based upon the substantial costs of subjecting government officials to the risks of trial. Judicial inquiry into subjective motivation “may entail broad-ranging discovery and the deposing of numerous persons, including an official’s professional colleagues. Inquiries of this kind can be peculiarly disruptive of effective government.” Harlow, 457 U.S. at 817, 102 S.Ct. at 2737-38.
We recently opined, however, that in one class of cases an inquiry into defendants’ motive is permissible. In Gutierrez v. Municipal Court, 838 F.2d 1031 (9th Cir.1988), plaintiff challenged as unconstitutional an English-only rule enacted by a judicial district of the Los Angeles Municipal Court. Plaintiff claimed, in part, that the rule constituted racial and national origin discrimination in violation of the equal protection clause of the fourteenth amendment. Such a claim required the plaintiff to prove intentional discrimination. The defendants in that case moved for summary judgment on the basis of qualified immunity. We held that “ ‘[w]hen the governing precedent identifies the defendant’s intent (unrelated to knowledge of the law) as an essential element of plaintiff's constitutional claim, the plaintiff must be afforded an opportunity to overcome an asserted immunity with an offer of proof of the defendant’s alleged unconstitutional purpose.’ ” Id. at 1050 (quoting Martin v. D.C. Metro. Police Dep’t, 812 F.2d 1425, 1433, vacated in part, 817 F.2d 144 (section IV of opinion and dissenting opinion), *327reh’g denied, 824 F.2d 1240 (section IV of opinion, dissenting opinion and judgment reinstated) (D.C.Cir.1987)).
Defendants rely on the District of Columbia Circuit’s decision in Martin for the principle that, in cases where the court does inquire into the defendants’ motivation, “some direct evidence that the officials’ actions were improperly motivated must be produced if the case is to proceed to trial.” 812 F.2d at 1435. “Where the defendant’s subjective intent is an essential component of plaintiff’s claim, ... then plaintiff, to avert dismissal short of trial, must come forward with something more than inferential or circumstantial support for his allegation of unconstitutional motive.” Id.
While we are mindful of our responsibility not to reimpose the burden upon government officials Harlow sought to prevent, we are presented with a different type of case than Martin. In Martin, the plaintiff charged officers of the United States Capitol Police, in part, with violations of the fifth amendment. As part of his constitutional claims, the plaintiff needed to establish that the officers acted with an unconstitutional motive. Id. at 1431. Here, in contrast, we are not concerned with the defendants’ subjective malice in conducting the particular search upon Tribble; rather, Tribble asks us to examine the purpose of the policy requiring such searches. See Note, Qualified Immunity for Government Officials: The Problem of Unconstitutional Purpose in Civil Rights Litigation, 95 Yale L.J. 126 (1985). In cases where the purpose of a prison regulation is at issue, there is no “direct evidence” equivalent to legislative history that plaintiffs may examine. To hold plaintiffs in such cases to a “direct evidence” standard would effectively insulate arbitrary governmental action from judicial scrutiny.
Moreover, as noted above, this suit is not an insubstantial one; Tribble’s evidence is probative and significant. In contrast, in attempting to support the policy below, defendants relied solely on the presumed inherent propensity of IMU inmates to violate prison regulations. In view of Trib-ble’s evidence of how the digital rectal search policy is executed, the policy does not reflect this justification.
Accordingly, we agree with the district court that Tribble has produced sufficient evidence to show that the searches are conducted for punitive purposes unrelated to security concerns and that a reasonable person would have known that searches based on such motives violated Tribble’s clearly established rights.9 Therefore, we hold that, viewing the facts in the light most favorable to the plaintiff, the district court was correct in denying defendants’ motion for summary judgment on the basis of qualified immunity. Cf. Allen v. Scribner, 812 F.2d 426, 436 (when motivation of defendants is relevant to application of qualified immunity and is in dispute, jury must decide issue), amended, 828 F.2d 1445 (9th Cir.1987).
IV
Defendants also assert that Tribble has failed to produce sufficient evidence linking any named defendant either to the particular search of him or to the creation of the digital rectal search policy. The difficulty, as defendants view it, is that Tribble has not adequately alleged that any of the named defendants harbored an unconstitutional motive. Tribble’s suit, however, is not based upon the particular subjective intent of the defendants; rather, it is based upon the purpose of the policy.
Nevertheless, a defendant “is entitled to summary judgment if he makes a showing by affidavit or otherwise that he did not commit those acts and ‘discovery fails to *328uncover evidence sufficient to create a genuine issue as to whether the defendant in fact committed those acts.’ ” Kraus v. County of Pierce, 793 F.2d 1105, 1108 (9th Cir.1986) (quoting Mitchell v. Forsyth, 472 U.S. 511, 526, 105 S.Ct. 2806, 2815, 86 L.Ed.2d 411 (1985)). Thus, to the extent that a named defendant shows that he did not play a role in creating the digital body cavity search policy or that he did not participate in the search upon Tribble, he is entitled to summary judgment. Here, however, no named defendant has attempted to make such a showing.10
V
Tribble argues that he is entitled to attorney’s fees. 42 U.S.C. § 1988 authorizes a court to award attorney’s fees to the prevailing party under any of several civil rights statutes, including 42 U.S.C. § 1983. In some circumstances, a person may be a prevailing party without having obtained a favorable final judgment on the merits. Hanrahan v. Hampton, 446 U.S. 754, 756-57, 100 S.Ct. 1987, 1988-89, 64 L.Ed.2d 670 (1980) (per curiam). However, Congress intended to permit an award of attorney’s fees “only to a party who has established entitlement to some relief on the merits of his claims____” Id. at 757, 100 S.Ct. at 1989. In Hanrahan, the Supreme Court held that the respondents were not prevailing parties merely because the court of appeals had found they were entitled to a trial. Id. at 758, 100 S.Ct. at 1989.
Although we affirm the district court’s decision to deny summary judgment on qualified immunity grounds, Tribble has not yet succeeded on the merits of his claim. Contrary to Tribble’s contention, our decision does not confirm that defendants are not immune from liability. Rather, our decision simply allows Tribble a trial on the merits. At trial, defendants may still be entitled to qualified immunity if the trier of fact finds that the searches are reasonably related to a legitimate peno-logical goal, or that the defendants reasonably could have believed that the searches were conducted to further such a purpose. See Bilbrey by Bilbrey v. Brown, 738 F.2d 1462 (9th Cir.1984). Therefore, Tribble’s request for attorney’s fees is denied.
AFFIRMED.
. Assignment to the IMU occurs when "in the judgment of the superintendent, the presence of such inmate in the general inmate population would constitute a serious threat____” Wash.Admin.Code § 137-32-005 (1986).
. The “cell tag" regulation provides that each cellmate is responsible “for an infraction that occurs within the confines of such cell unless he/she can establish a lack of involvement in the infraction.” The propriety of such a rule presently is not before us.
.All inmates who are subject to a digital rectal search are similarly bound prior to the search.
. While the constitutionality of such searches, if based on legitimate penological objectives, may be an open question, we are faced with a different question in this appeal. Here, we must consider the searches in light of Tribble’s evidence that they are conducted for reasons other than legitimate penological goals.
. Cases that have upheld the constitutionality of digital rectal search policies are distinguishable in view of the nature of the security risk involved and the evidence presented here that the digital rectal searches are conducted for purposes unrelated to security concerns. In Daughtery v. Harris, 476 F.2d 292 (10th Cir.), cert. denied, 414 U.S. 872, 94 S.Ct. 113, 38 L.Ed.2d 91 (1973), the court upheld a policy requiring a digital rectal examination prior to transferring an inmate out of the prison to the custody of U.S. Marshals. In Bruscino v. Carlson, 654 F.Supp. 609, 620 (S.D.Ill.1987), decided after the search at issue in this case, the district court upheld a policy requiring a rectal examination upon “Control Unit” inmates each time the prisoner re-entered the Control Unit "following contact with the public.” Id. at 619. Further, the policy examined in Bruscino provided that "[i]nmates may request that an x-ray be taken in lieu of the digital search.” Id. In Jeffries v. Reed, 631 F.Supp. 1212 (E.D.Wash.1986), also decided after the search at issue here, the district court upheld a policy requiring a digital rectal search of Death Row inmates who are to be permanently housed in the IMU because such prisoners "present particular and heightened security risks.” Id. at 1214.
. This rule applies to both fourth and eighth amendment claims. If the search were conducted for purposes unrelated to security considerations, not only would it violate the fourth amendment, Lilly, 576 F.2d at 1244, but also it may constitute cruel and unusual punishment under the eighth amendment. After incarceration, the eighth amendment prohibits the " 'unnecessary and wanton infliction of pain.’ ” Estelle, 429 U.S. at 104, 97 S.Ct. at 291 (quoting Gregg v. Georgia, 428 U.S. 153, 173, 96 S.Ct. 2909, 2925, 49 L.Ed.2d 859 (1976) (joint opinion)). As noted above, when a prison regulation burdens fundamental rights, the government must show that the regulation is reasonably related to a legitimate penological goal. In the absence of such a showing, an intent to punish may be inferred, Bell v. Wolfish, 441 U.S. at 539 & n. 20, 99 S.Ct. at 1874 & n. 20; consequently, to the extent that the digital rectal search inflicts pain, the eighth amendment’s requirement of wantonness may be shown.
.Subsequent to the filing of this lawsuit, the Washington State Penitentiary has withdrawn its policy of conducting a digital rectal search upon entry to the IMU. The prison now conducts such searches only upon a reasonable suspicion that the inmate has secreted contraband in his rectum.
. Tobacco is considered contraband within the confines of the IMU.
. In view of the substantial evidence that, in enacting Policy Directive 420.110(A)(4)(a), defendants have exaggerated their response to purported security considerations, we do not defer to their expert judgment in these matters. See, e.g., Whitley v. Albers, 475 U.S. 312, 322, 106 S.Ct. 1078, 1086, 89 L.Ed.2d 251 (1986) (deference accorded to prison administrators "does not insulate from review actions taken ... for no legitimate purpose”); Pell v. Procunier, 417 U.S. 817, 827, 94 S.Ct. 2800, 2806, 41 L.Ed.2d 495 (1974) ("Courts cannot ... abdicate their constitutional responsibility to delineate and protect fundamental liberties.”).
. Of course, a named defendant may make such a showing at trial.