S. Myron Klarfeld appeals pro se the district court’s order dismissing his complaint for failure to state a claim. Klarfeld contends the district court erred by dismissing the complaint without leave to amend. We reverse and remand.
FACTS AND PRIOR PROCEEDINGS
In his complaint, Klarfeld, an attorney, alleges that on or about April 12, 1989, he *585entered the United States Courthouse in Los Angeles dressed in a sports jacket, shirt and tie, slacks, loafers, and carrying only an appointment calendar. In anticipation of having to pass through the courthouse magnetometer, a mechanical device which is designed to detect metal objects, Klarfeld removed his pocket change, keys, nail clipper, and wrist watch and placed them in a basket provided for that purpose. In addition, Klarfeld removed his sport jacket and placed it on the conveyor belt. When Klarfeld passed through the magnetometer, however, the alarm sounded. Klarfeld searched his pockets, removed a small pocket knife in the watch pocket of his slacks, and passed through the magnetometer a second time, whereupon the alarm sounded again. Klarfeld then alleges that he “held his arms outstretched and asked to be searched by the Marshall’s [sic] hand metal detector.” However, the guard allegedly refused to do so and ordered Klarfeld to go back through the metal detector, remove his belt and shoes, and place his shoes on the conveyor belt. At this point, Klarfeld alleges that he:
identified himself as an attorney and explained that he would rather be searched by the hand metal detector than to take off his shoes and have to walk several yards in his stocking feet to gain entrance to the Courthouse. [Klarfeld] was then informed by the guard: “If you want to get into the Courthouse you will have to take off your shoes and place them on the conveyor!! You could have a gun there.” [Klarfeld] begrudgingly complied and had to walk several yards over a dirty floor in his stocking feet, much to the amusement of the guard and onlookers, in order to gain entrance to the Courthouse to conduct his business.
Complaint at 3 (emphasis in original). The guard then placed Klarfeld’s shoes on the conveyor belt, whereupon it was discovered that a metal shank in the arch of the shoes had been setting the alarm off. Klarfeld then entered the Courthouse without further incident.
Klarfeld wrote a note to the Chief Judge of the Central District of California and complained about the security procedures at the Courthouse, but received no response. Klarfeld then brought suit on April 25, 1989, seeking injunctive and declaratory relief. Klarfeld sought to enjoin the defendants from requiring him to remove his shoes and walk in his stocking feet in order to gain entrance to the United States Courthouse. Klarfeld also claimed that his rights were violated by the fact that courthouse personnel were not required to comply with the same security procedures. The district court dismissed the action with prejudice for failure to state a claim. Klarfeld timely appeals.
Klarfeld contends the district court erred by dismissing his complaint without leave to amend. Klarfeld asserts that he raised valid constitutional claims as to whether the courthouse search procedures were reasonable, and whether the search procedures discriminated against lawyers.
DISCUSSION
Standard of Review
We review de novo a district court’s dismissal of an action for failure to state a claim. Pau v. Yosemite Park & Curry Co. 928 F.2d 880, 886 (9th Cir.1991). We must accept all material allegations in the complaint as true and construe them in the light most favorable to Klarfeld. See NL Indus, v. Kaplan, 792 F.2d 896, 898 (9th Cir.1986). Dismissal is appropriate only if the plaintiff “can prove no set of facts in support of his claim which would entitle him to relief.” Gibson v. United States, 781 F.2d 1334, 1337 (9th Cir.1986), cert. denied, 479 U.S. 1054, 107 S.Ct. 928, 93 L.Ed.2d 979 (1987) (internal quotations and citations omitted).
We review a denial of leave to amend for an abuse of discretion. Saul v. United States, 928 F.2d 829, 843 (9th Cir.1991). If a complaint is dismissed for failure to state a claim, leave to amend should be granted “unless the court determines that the allegation of other facts consistent with the challenged pleading could not possibly cure the deficiency.” Schreiber Distributing Co. v. Serv-Well Furniture Co., 806 F.2d *5861393, 1401 (9th Cir.1986). However, a district court does not err in denying leave to amend where the amendment would be futile. Reddy v. Litton Indus., 912 F.2d 291, 296 (9th Cir.1990), petition for cert. filed (U.S. July 15, 1991) (No. 91-95).
Analysis
We first consider Klarfeld’s contention that he raised a valid constitutional claim that his fourth amendment right to be free from unreasonable searches and seizures was violated by security procedures in effect at the United States District Court in Los Angeles. We note that Klarfeld does not challenge the constitutionality of the search procedures on their face. Instead, Klarfeld challenges the reasonableness of the search policy that required him to remove his shoes and walk several yards over a dirty floor in order to gain entry to the Courthouse.
Under the fourth amendment, a search of private property without proper consent is unreasonable in all but “certain carefully defined classes of cases” unless it has been authorized by a valid search warrant. Camara v. Municipal Court, 387 U.S. 523, 528-29, 87 S.Ct. 1727, 1730-31, 18 L.Ed.2d 930 (1967). Among the “carefully defined classes of cases” for which no warrant is needed are administrative searches. United States v. $124,570 U.S. Currency, 873 F.2d 1240, 1243 (9th Cir.1989). Under the so-called “administrative search” exception, a limited warrantless search of a person seeking to enter sensitive facilities is lawful if “conducted as part of a general regulatory scheme in furtherance of an administrative purpose, rather than as part of a criminal investigation to secure evidence of crime.” Id. (quoting United States v. Davis, 482 F.2d 893, 908 (9th Cir.1973)). Nonetheless, “[t]o pass constitutional muster, an administrative search must meet the Fourth Amendment’s standard of reasonableness.” Davis, 482 F.2d at 910.
In McMorris v. Alioto, 567 F.2d 897 (9th Cir.1978), a case very similar to this one, we held that courthouse security procedures in the San Francisco Hall of Justice, including the use of a magnetometer, fell into the category of permissible administrative searches. Id. at 900-01. Taking judicial notice of threats of violence directed at courthouses that had given rise to an urgent need for protective measures, we concluded that security measures that included a pat-down search as a secondary search procedure were reasonable under the fourth amendment. Id. at 900.
Here, Klarfeld contends that the search policy that required him to remove his shoes in order to gain entry to the Courthouse was unreasonable. We disagree. Voluntarily removing one’s shoes in order to gain entry into a courthouse is far less intrusive than the pat-down search that was expressly approved of in McMor-ris.1 Thus, requiring Klarfeld to remove his shoes was not unreasonable. If Klar-feld’s claim were limited to this argument, we would be inclined to affirm the district court’s dismissal of this claim and hold that Klarfeld can prove no set of facts in support of it.
However, Klarfeld does not argue that the removal of his shoes, in and of itself, was unreasonable. Rather, he alleges that the method of search was unnecessarily intrusive, since a hand-held magnetometer was available and would have enabled the marshals to determine whether he was carrying a weapon without the removal of his shoes. He further contends that the search was unreasonable because the marshals required him to walk without shoes for an unnecessarily long distance over a dirty floor before passing through the metal detector in order to gain entry into the courthouse, exposing him to embarrassment and the ridicule of onlookers.
In McMorris we emphasized that the method of search used was “less offensive *587than alternative methods.” McMorris, 567 F.2d at 900. A method of search which exposes the person searched to substantial embarrassment could well be more intrusive than the search approved in McMorris and may rise to the level of a fourth amendment violation. Because the search of Klarfeld may have been more intrusive than the search in McMorris, and because the intrusiveness of the search may have been unnecessary, we cannot say that Klar-feld can prove no set of facts entitling him to relief. See Waco v. Baltad, 934 F.2d 214, 215 (9th Cir.1991) (per curiam).
Klarfeld also contends that he raised a valid constitutional claim that he was discriminated against as a member of a class (attorneys) because the courthouse security procedures in effect at the United States District Court in Los Angeles required him and other attorneys to remove their shoes and walk several yards over a dirty floor when the magnetometer was activated, while those who worked in the courthouse, e.g., police officers, court personnel, and judges, were not required to do so upon presentation of their employee badges. Klarfeld asserts that the FBI’s failure to afford attorneys the opportunity to undergo background checks and receive security clearances similar to those provided courthouse employees discriminates against attorneys as a class. We agree with the district court’s interpretation of this argument as an equal protection argument.
A classification scheme is permissible under the equal protection obligation imposed by the fifth amendment’s due process clause, so long as it does not employ a classification that is inherently invidious or that impinges on fundamental rights, if it “classifpes] the persons it affects in a manner rationally related to legitimate governmental objectives.” Schweiker v. Wilson, 450 U.S. 221, 230, 101 S.Ct. 1074, 1080, 67 L.Ed.2d 186 (1981).
Here, the only distinction between courthouse personnel and others is that courthouse personnel are not required to pass through the metal detector a second time if they display their employee identification badges. This security scheme is rationally related to a legitimate governmental purpose, viz., the protection of the Courthouse from violence.2 See McMorris, 567 F.2d at 900. Courthouse personnel in Los Angeles are subjected to less scrutiny because they are required to undergo an extensive background check by the FBI.3 To implement such a procedure for all attorneys, or simply those who might want to enter the courthouse at some time, would result in a severe administrative burden out of all proportion to the benefit of forgoing a second trip through the magnetometer. Such precautionary measures are not at all irrational.
Accordingly, we hold that Klarfeld can prove no set of facts consistent with his claim that the security procedures in effect at the Courthouse discriminated against lawyers. However, because we cannot say that Klarfeld can prove no set of facts consistent with his claim that his fourth amendment rights were violated by the requirement that he walk several yards over a dirty floor, we reverse and remand the district court’s dismissal of Klarfeld’s complaint.
REVERSED AND REMANDED.
The parties shall bear their own costs on appeal.
. In McMorris, we held that, although persons entering the Hall of Justice "do not consent to the search in the full and generally accepted meaning of that term”, the limited courthouse searches in question are "performed only after the individual seeking to enter the courthouse has consented, as that term is used in our previous decisions upholding limited searches." Id. at 901. Here, Klarfeld concedes that he consented to the search, albeit "begrudgingly."
. At the hearing on the motion to dismiss, the district judge noted that “just last week someone was apprehended coming in with a loaded gun going upstairs to a courtroom where there is a multiple-defendant case going on involving drugs. We have to be very concerned about security...."
. On appeal and in his opposition to the motion to dismiss, Klarfeld accepted the government’s assertion that courthouse personnel are required to undergo background checks by the FBI in order to receive security clearance.