ORDER
The opinion filed on June 23, 2009, is hereby amended by (1) deleting the first full paragraph found in the slip opinion at page 7613 (lines 7 through 24); (2) inserting “Kennedy v. Los Angeles Police Dep’t, 901 F.2d 702 (9th Cir.1990) (impliedly overruled on other grounds by Hunter v. Bryant, 502 U.S. 224, 112 S.Ct. 534, 116 L.Ed.2d 589 (1991) (per curiam))” in the slip opinion on page 7613 after the word “Kennedy ” on line 27, (3) deleting the material “901 F.2d” on page 7613 on line 29, and inserting “Id.” in lieu thereof; and (4) deleting “Ward, 791 F.2d at 1333; Giles, 746 F.2d at 615” on page 7617, line 22.
With the amendment, Judges Thomas and Roth have voted to deny the petition for panel rehearing. Judge Thomas has voted to deny the petition for rehearing en banc and Judge Roth so recommends. Judge Callahan has voted to grant the petition for panel rehearing and petition for rehearing en banc.
The full court has been advised of the petition for rehearing en banc, and no judge of the court has requested a vote on the petition for rehearing en banc. Fed. R.App. P. 35(b).
The petition for rehearing and the petition for rehearing en banc are rejected.
No further petitions for rehearing will be entertained.
OPINION
THOMAS, Circuit Judge:Las Vegas Metropolitan Police Detective Dolphus Boucher, with the approval of Clark County Deputy District Attorney Elissa Luzaich, forcefully extracted a DNA *851sample from Kenneth Friedman. The officer did not have a warrant or a court order authorizing the taking of the sample, nor was Friedman under any suspicion of a crime for which a DNA sample might be justified. The extraction occurred simply because the deputy district attorney wanted to put Friedman’s DNA sample in a cold case data bank. Friedman alleges that the forcible extraction occurred after he was shackled and chained to a metal bar.
Friedman brought suit against Boucher and Luzaich (“Defendants”) under 42 U.S.C. § 1983 on the ground that they violated his Fourth Amendment rights by taking the sample. The district court held that Boucher and Luzaich are entitled to qualified immunity and granted Defendants’ motion to dismiss. Because the forcible taking of the DNA sample under these circumstances violated Friedman’s clearly established Fourth Amendment rights, we reverse.
I
In 1980, Kenneth Friedman pled guilty to sexual intercourse without consent in the District Court of the Fourth Judicial District of the State of Montana. In 2001 Friedman completed his sentence and was released from Montana’s supervision. After his release he was not a parolee, probationer, or otherwise under the supervision of the State of Montana.1 He then moved to Las Vegas, Nevada.
In March 2003, Detective Boucher asked Friedman to provide a DNA sample. Friedman was at the time incarcerated in Clark County Jail as a pre-trial detainee pending the prosecution of unrelated charges. Boucher had no warrant, no court order, no individualized suspicion, had not articulated an offense for which a DNA sample was required or justified, and admitted as much to Friedman. He simply wanted the sample as an aid to solve cold cases.
Friedman declined to volunteer the DNA sample and asked to speak with his attorney. Boucher refused to allow Friedman to contact his attorney and told him that Deputy District Attorney Luzaich had authorized Boucher to obtain a DNA sample from Friedman, by force if necessary. Another detective told Friedman, “we can force you, we’re authorized and you can get hurt pretty bad.” Boucher and the other detective also threatened to call in other officers to beat him. Friedman alleges that, during the course of these interactions, he was sitting on a bench in chains and shackles and chained to a metal bar on the bench.
After Friedman repeatedly refused to voluntarily provide a DNA sample, Boucher forced Friedman’s jaw open and forcefully took a buccal swab2 from the inside of Friedman’s mouth. This search was not related to the Nevada charges then-pending against Friedman. Indeed, Luzaich later represented to a Nevada Justice Court that she had ordered the search to use Friedman’s DNA in the investigation of cold cases. Friedman was not a suspect in any of the cases. In fact, not only was Friedman not an active suspect in any cold case, the record does not suggest that *852Friedman’s DNA was ever actually used in the resolution of any cold case.
Friedman filed suit in federal district court, in the District of Nevada, on March 10, 2004, alleging that Boucher and Luzaich’s forcible taking of his DNA violated his Fourth Amendment right to be free from unreasonable searches. Boucher and Luzaich moved to dismiss the complaint, arguing that they were entitled to qualified immunity.
The district court initially denied Defendants’ Motion to Dismiss. Shortly thereafter, we decided United States v. Kincade, 379 F.3d 813 (9th Cir.2004) (en banc), which upheld the constitutionality of compulsory DNA profiling of certain conditionally-released federal offenders under the DNA Analysis Backlog Elimination Act of 2000., Pub.L. No. 106-546, 114 Stat. 2726 (2000). The district court then ordered Friedman to show cause why Boucher and Luzaich were not entitled to qualified immunity, in light of Kincade. On March 25, 2005, relying on Kincade and the exhibits attached to Defendants’ Motion to Dismiss, the district court granted summary judgment3 in favor of Defendants on the ground that Defendants were entitled to qualified immunity. This appeal followed.
II
We review de novo a district court’s decision to grant summary judgment on the ground of qualified immunity. Motley v. Parks, 383 F.3d 1058, 1062 (9th Cir. 2004). In reviewing a district court’s grant of summary judgment we must determine, viewing the evidence in the light most favorable to the nonmoving party, whether there are any genuine issues of material fact and whether the district court correctly applied the relevant substantive law. Olsen, 363 F.3d at 922.
To determine whether a government employee is entitled to qualified immunity, we use a two-part test. Saucier v. Katz, 533 U.S. 194, 201, 121 S.Ct. 2151, 150 L.Ed.2d 272 (2001). We must determine whether, viewed in the light most favorable to the plaintiff, the government employee violated the plaintiffs constitutional rights. Id. We must also determine whether the rights were clearly established at the time of the violation. Id.; Pearson v. Callahan, — U.S. -, 129 S.Ct. 808, 818-22, 172 L.Ed.2d 565 (2009).
Ill
We turn first to the question of whether the warrantless, suspicionless, forcible taking of Friedman’s DNA violated his constitutional rights. There is no question that the buccal swab constituted a search under the Fourth Amendment. The Supreme Court has held that invasions of the body are searches and, thus, are entitled to the protections of the Fourth Amendment. Skinner v. Ry. Labor Executives’ Ass’n, 489 U.S. 602, 616-17, 109 S.Ct. 1402, 103 L.Ed.2d 639 (1989) (breathalyzer and urine sample); Cupp v. Murphy, 412 U.S. 291, 295, 93 S.Ct. 2000, 36 L.Ed.2d 900 (1973) (finger nail scrapings); Schmerber v. California, 384 U.S. 757, 767-71, 86 S.Ct. 1826, 16 L.Ed.2d 908 (1966) (blood). We have held, similarly, that the Fourth Amendment protects against “all searches that invade the interi- or of the body — whether by a needle that punctures the skin or a visual intrusion into a body cavity.” Fuller v. M.G. Jewel*853ry, 950 F.2d 1437, 1449 (9th Cir.1991); see also Padgett v. Donald, 401 F.3d 1273, 1277 (11th Cir.2005) (swabbing the inside of mouth for saliva is a search); Schlicher v. Peters, 103 F.3d 940, 942-43 (10th Cir. 1996) (collection of saliva is a search). As we put it in United States v. Kriesel: “The compulsory extraction of blood for DNA profiling unquestionably implicates the right to personal security embodied in the Fourth Amendment, and thus constitutes a ‘search’ within the meaning of the Constitution.” 508 F.3d 941, 946 (9th Cir.2007) (quoting Kincade, 379 F.3d at 821).
There is also no dispute that the search was conducted -without a warrant. “A warrantless search is unconstitutional unless the government demonstrates that it ‘faJlfs] within certain established and well-defined exceptions to the warrant clause.’ ” United States v. Brown, 563 F.3d 410, 414-15(9th Cir.2009) (quoting United States v. Murphy, 516 F.3d 1117, 1120 (9th Cir.2008) (quoting United States v. Delgadillo-Velasquez, 856 F.2d 1292, 1298 (9th Cir.1988))).
Thus, unless the government can establish that the warrantless, suspicionless, forcible taking of a buccal swap satisfies one of the exceptions to the warrant requirement, we must hold the search to be unconstitutional.
Defendants offer three arguments in urging that an exception to the warrant requirement applies in this case: (1) the special needs exception to the warrant requirement; (2) a Montana statute authorized the search; and (3) the search was “reasonable.”
A
The government was not entitled to conduct the warrantless, suspicionless search based on the “special needs” exception. The “special needs” exception is “an exception to the general rule that a search must be based on individualized suspicion of wrongdoing.” City of Indianapolis v. Edmond, 531 U.S. 32, 54, 121 S.Ct. 447, 148 L.Ed.2d 333 (2000). Under this exception, suspicionless searches may be upheld if they are “conducted for important non-law enforcement purposes in contexts where adherence to the warrant-and-probable cause requirement would be impracticable.” Kincade, 379 F.3d at 823 (emphasis added); see also United States v. Heckenkamp, 482 F.3d 1142, 1147(9th Cir. 2007) (applying a special needs exception when a university computer system was under imminent threat).
The “special needs” exception is limited to “important non-law enforcement purposes.” Kincade, 379 F.3d at 823. The only government interest asserted by Nevada in taking Friedman’s DNA was to help solve “cold cases.” Solving crimes is clearly a normal law enforcement function. Because the “special needs” exception applies only to non-law enforcement purposes, and the State’s interest here is the use of data for purely law enforcement purposes, the “special needs” exception is inapplicable.
B
Defendants’ second argument is that they were permitted to take the buccal swab by Montana Code Annotated Section 44-6-103 (2003) (“the Montana Statute”). The Montana Statute was passed in 1995 and requires persons convicted of certain enumerated offenses to provide a biological sample to the Montana Department of Justice for DNA analysis. Mont.Code Ann. § 44-6-103. The crime to which Friedman pled guilty in 1980 was one of the predicate offenses.
As a preliminary matter, we note that adherence to a state statute does not guarantee compliance with the Fourth Amendment. See Virginia v. Moore, — U.S. -, 128 S.Ct. 1598, 1602, 170 L.Ed.2d 559 (2008). We need not consider *854whether the Montana statute itself violates the Fourth Amendment, however. Defendants’ argument that the buccal swab was properly taken in accordance with the Statute fails because the Montana statute does not apply to Friedman.
1
The Montana Statute does not apply extraterritorially. At the risk of stating the obvious, the Montana Statute is a statute passed by the Montana State Legislature which operates as law in the State of Montana. Defendants argue that Nevada state officials can take action which would otherwise be prohibited in Nevada4 against a Nevada citizen in the State of Nevada simply by relying on a Montana statute. This argument was rejected almost a century ago by the United States Supreme Court, when it considered “the power of the State of Missouri to extend the operation of its statutes beyond its borders into the jurisdiction of other States, so as in such other States to destroy or impair the right of persons not citizens of Missouri to contract.” N.Y. Life Ins. Co. v. Head, 234 U.S. 149, 160, 34 S.Ct. 879, 58 L.Ed. 1259 (1914). Holding that a state does not possess such power, the Court explained:
Such question, we think, admits of but one answer since it would be impossible to permit the statutes of Missouri to operate beyond the jurisdiction of that State and in the State of New York and there destroy freedom of contract without throwing down the constitutional barriers by which all the States are restricted. ... This is so obviously the necessary result of the Constitution that it has rarely been called in question and hence authorities directly dealing with it do not abound.
Id. at 161, 34 S.Ct. 879 (emphasis added). See also BMW of North America, Inc. v. Gore, 517 U.S. 559, 572, 116 S.Ct. 1589, 134 L.Ed.2d 809(citing N.Y. Life in support of the proposition that “[n]o State can legislate except with reference to its own jurisdiction.”).
More recently, the Supreme Court rejected the State of Nevada’s attempt to obtain immunity from suit in California by reliance on immunities granted under Nevada law. See Nevada v. Hall, 440 U.S. 410, 426, 99 S.Ct. 1182, 59 L.Ed.2d 416 (1979) (“The people of Nevada have consented to a system in which their State is subject only to limited liability in tort. But the people of California, who have had no voice in Nevada’s decision have adopted a different system. Each of these decisions is equally entitled to our respect.”).
Defendants were Nevada officials searching a Nevada citizen in the state of Nevada for Nevada law enforcement purposes. They are not entitled to justify their search with a Montana statute.
2
Even if the Montana Statute could constitutionally apply extraterritorially, the plain language of the Montana Statute makes the statute inapplicable to the seizure of Friedman’s DNA by Nevada officials for a number of reasons.
First, the Montana Statute does not apply to persons like Friedman who are not under state supervision. While the statute requires a DNA sample from all “person[s] convicted of a felony offense,” MontCode. Ann. § 44-6-103(1), the statute provides only one consequence if such a person refuses to provide a sample: “The knowing refusal or failure to provide a biological sample under this part is grounds for revocation of a suspended or deferred imposition of sentence.” § 44-6-103(5). At the time that Defendants de*855manded the DNA sample, Friedman was not subject to either a suspended or deferred imposition of sentence. Given that his criminal judgment had been satisfied, Montana had no further supervisory authority over Friedman. Friedman was not subject to the requirements of the statute. See State v. Johnson, 326 Mont. 161, 108 P.3d 485, 487 (2005) (noting that the DNA test requirements applied to prisoners, and distinguishing the privacy interests of private citizens); see also United States v. Sczubelek, 402 F.3d 175, 178 (3rd Cir.2005) (noting in context of federal law that “[i]f the government no longer has the authority to collect a DNA sample from [the defendant], there is no need to determine the constitutionality of taking that sample.”).5
Second, the Montana statute only authorizes the collection of DNA for placement in the Montana Department of Justice DNA identification index. Mont.Code Ann. § 44-6-1-102. When a sample is collected, the sample must be transmitted to the Montana Department of Justice within seven days. Mont.Code Ann. § 44-6-103(2); Mont. Admin. R. 23.4.503. Once placed in the Montana index, the DNA records may only be released on written request by a statutorily qualified party, on terms and conditions established by the Montana Department of Justice. Mont.Code Ann. § 44-6-106. DNA testing records maintained in the index are considered confidential criminal justice information, see MontCode Ann. § 44-6-108, subject to the strict restrictions on disclosure contained in the Montana Criminal Justice Information Act of 1979, Mont. Code Ann. § 44-5-303. Nevada officials did not purport to be taking the sample for transmittal to Montana; rather, they wanted the DNA sample to check against cold cases in Nevada. There is nothing in the record to indicate that Nevada transmitted the sample to Montana, or that it subsequently sought written permission from Montana for use of the sample, as required by the Montana Statute.
Third, the Montana Statute does not authorize Defendants to obtain a DNA sample. The statute explicitly provides: “If the person is not incarcerated in a facility administered by the department of corrections, the sample must be provided to a person or entity designated by the county sheriff.” § 44-6-103(2) (emphasis added). There is nothing in the record to indicate that either Boucher or Luzaich were ever designated by a Montana county sheriff to take Friedman’s DNA sample.6
*856Fourth, no part of the Montana Statute purports to authorize any entity or person to take a sample from any subject by force, as Defendants did in this case. The Montana Statute requires persons subject to its provisions to “provide” a biological sample. As discussed above, a “knowing refusal or failure to provide” is “grounds for revocation of a suspended or deferred imposition of sentence.” Mont.Code Ann. § 44-6-103(5). There are no other penalties prescribed for failure to willingly provide a sample, and the Montana Statute does not authorize any law enforcement official, either within or outside Montana, to extract a DNA sample by force.
Finally, the Montana Statute must be construed in light of the Constitution of Montana. The Montana Constitution contains one of the strongest state constitutional protections of privacy in the Nation. See Mont. Const, art. II, § 10(“The right of individual privacy is essential to the well-being of a free society and shall not be infringed without the showing of a compelling state interest.”). “Montana’s Constitution affords citizens broader protection at the hands of the government in search and seizure cases than does the Federal Constitution.” State v. Siegal, 281 Mont. 250, 934 P.2d 176, 183 (1997); see also Hon. James C. Nelson, The Right to Privacy, 69 Mont. L.Rev. 257, 259 (2007) (“This [privacy] right in Montana guarantees far greater protection from unreasonable searches and seizures than does the Fourth Amendment to the federal Constitution.”).
In State v. Johnson, the Montana Supreme Court was not only careful to exclude private citizens from its holding that the Montana Statute authorized the collection of DNA samples, but specifically reserved the question of whether the Montana Statute could withstand scrutiny under the Constitution of Montana. 108 P.3d at 487. Thus, whether the Montana Statute itself would withstand state constitutional scrutiny by the Montana Supreme Court is an open question. In construing statutes, “we are governed by the canon of constitutional avoidance, which requires a statute to be construed so as to avoid serious doubts as to the constitutionality of an alternate construction.” Nadarajah v. Gonzales, 443 F.3d 1069, 1076 (9th Cir.2006). Given the constitutional restrictions applicable to this statute, we are bound to construe it narrowly. A narrow construction of the Montana Statute cannot possibly support the extraterritorial, forcible extraction of DNA from a private citizen of another State, who is not subject to Montana supervision.
3
For all these reasons, we must reject the government’s reliance on the Montana statute as an exception to the warrant requirement.
C
Defendants’ final argument is that the search was “reasonable,” contending that pre-trial detainees have limited privacy rights that must yield to the desires of law enforcement to collect DNA samples for use in law enforcement databases. Thus, the reasoning goes, the government has the inherent right, without a search warrant and without suspicion of criminal activity, to extract DNA forcibly from pretrial detainees. However, neither the Supreme Court nor this Court has ever ruled that law enforcement officers may conduct suspicionless searches on pretrial detain*857ees for reasons other than prison security. Indeed, as the Supreme Court stated emphatically in Schmerber: “The interests in human dignity and privacy which the Fourth Amendment protects forbid any such intrusions on the mere chance that desired evidence might be obtained.” 384 U.S. at 769-70, 86 S.Ct. 1826. In contrast to the government’s position in this case, which would endorse routine, forcible DNA extraction, the Court concluded: “The importance of informed, detached and deliberate determinations of the issue whether or not to invade another’s body in search of evidence of guilt is indisputable and great.” Id. at 770, 86 S.Ct. 1826.
We have also carefully confined administrative searches at detention facilities to those reasonably related to security concerns. In Kennedy v. Los Angeles Police Dep’t, 901 F.2d 702 (9th Cir.1990) (impliedly overruled on other grounds by Hunter v. Bryant, 502 U.S. 224, 112 S.Ct. 534, 116 L.Ed.2d 589 (1991) (per curiam)), for example, we held unconstitutional a blanket strip search policy which subjected all felony arrestees to a visual body cavity search. Id. at 714. We noted that “the enacted policy, if it is to be constitutional, must be ‘reasonably related’ to the penal institution’s interest in maintaining security.” Id. at 713. Even in Bell v. Wolfish, 441 U.S. 520, 99 S.Ct. 1861, 60 L.Ed.2d 447 (1979), a case upon which the dissent relies, the Supreme Court repeated its observation that “[tjhere is no iron curtain drawn between the Constitution and the prisons of this country,” id. at 544, 99 S.Ct. 1861(quoting Wolff v. McDonnell, 418 U.S. 539, 555-56, 94 S.Ct. 2963, 41 L.Ed.2d 935 (1974)), but justified the search for contraband at issue on the basis of the “institution’s interest in maintaining jail security,” id. at 540, 99 S.Ct. 1861. Neither the Supreme Court nor our court has permitted general suspicionless, warrantless searches of pre-trial detainees for grounds other than institutional security or other legitimate penological interests. Thus, there is no support for the government’s contention that Friedman’s status as a pretrial detainee justifies forcible extraction of his DNA.
Defendants cite a number of appellate cases that uphold the constitutionality of state DNA bank laws. Not one of those cases involved a search of a pretrial detainee-as opposed to a convicted prisoner- or a state law that mandated searches of pretrial detainees.7 None of these cases uphold a search similar to the suspicionless one of a pretrial detainee in this case.
In Kincade and Kriesel, we upheld against Fourth Amendment challenges a federal DNA profiling law and amendments extending that law. However, both of those cases concerned extracting DNA from convicted felons still under state supervision. See Kriesel, 508 F.3d at 944 (Kriesel was on probation); Kincade, 379 F.3d at 821 (Kincade was on parole). The law at issue required DNA samples “to be collected from individuals in custody and those on probation, parole, or supervised release after being convicted of qualifying Federal offenses.” Kriesel, 508 F.3d at *858943(internal quotation marks omitted). The Supreme Court articulated the rationale for sustaining these types of searches in Samson v. California, in which the Court upheld a search on the basis of the plaintiffs status as a parolee, citing the requirement of “intense supervision” of such persons and the problems of “reintegration” of parolees into society. 547 U.S. 843, 854, 126 S.Ct. 2193, 165 L.Ed.2d 250 (2006).
However, the considerations underlying Samson, Kincade, and Kriesel are absent here. Friedman was not on parole. He had completed his term of supervised release successfully and was no longer the supervision of any authority. The Nevada authorities extracted the DNA from Friedman not because they suspected he had committed a crime, nor to aid in his reintegration into society, nor as a matter of his continuing supervision. Their purpose was simply to gather human tissue for a law enforcement databank, an objective that does not cleanse an otherwise unconstitutional search.
D
The warrantless, suspicionless, forcible extraction of a DNA sample from a private citizen violates the Fourth Amendment. The actions of the officers were not justified under the “special needs” exception, reliance on an extraterritorial statute, or on general Fourth Amendment principles. The search and seizure of Friedman’s DNA violated the Constitution.
IV
Having determined that the search violated the Constitution, we must next ask whether the constitutional right violated was clearly established at the time of the search. See Saucier, 533 U.S. at 201, 121 S.Ct. 2151. “The relevant, dispositive inquiry in determining whether a right is clearly established is whether it would be clear to a reasonable officer that his conduct was unlawful in the situation he confronted.” Id. at 202, 121 S.Ct. 2151. In other words, the inquiry is whether a reasonable person could have believed his actions lawful at the time they were undertaken. Anderson v. Creighton, 483 U.S. 635, 646, 107 S.Ct. 3034, 97 L.Ed.2d 523 (1987).
The rule that a search violates the Fourth Amendment if it is not supported by either probable cause and a warrant or a recognized exception to the warrant requirement has long been clearly established. See, e.g., Schmerber, 384 U.S. at 770-71, 86 S.Ct. 1826. Thus, the real question in determining whether Defendants are entitled to qualified immunity is whether it was clearly established, at the time of the search, that such a search does not fall under any recognized exception. As discussed above, the only recognized exceptions that the search could possibly fall under are the special needs exception, the Montana Statute, or its “reasonableness.” 8
No reasonable detective or prosecutor could have thought that the search was justified under the “special needs” exception. Under the “special needs” exception, suspicionless searches are upheld if they are “conducted for important non-law enforcement purposes in contexts where adherence to the warrant-and-probable cause requirement would be impracticable.” Kincade, 379 F.3d at 823 (emphasis added). There is no question that the DNA sample was taken for a law enforcement purpose — Luzaich admitted in court *859that she wanted the' sample for use in solving “cold cases” — nor is there any question that there would have been ample opportunity to obtain a warrant. Friedman was in custody in Clark County Jail when the sample was taken. There was no exigency or other reason that Defendants could not have sought a warrant before taking the sample, other than the fact that they had no probable cause on which to base their warrant request. The lack of probable cause is not itself a justification for conducting a search without a warrant and probable cause.
No reasonable police, detective or prosecutor could have believed that the Montana Statute authorized a forcible taking of a DNA sample from a Nevada citizen for Nevada law enforcement purposes. The reliance on an extraterritorial statute was not reasonable. As the Supreme Court observed: “This is so obviously the necessary result of the Constitution that it has rarely been called in question.” N.Y. Life, 234 U.S. at 161, 34 S.Ct. 879(holding that a Missouri statute cannot operate in New York). Nor was such a reliance reasonable based on a plain reading of the Montana Statute, as we have discussed in detail.
Similarly, controlling precedent at the time of the search disallowed warrantless, suspicionless, non-security related searches of pre-trial detainees. Our case law precluded the interpretation that the government could forcibly extract DNA from all pre-trial detainees as a matter of routine, unrelated to facility security considerations. Kennedy, 901 F.2d at 714. Our circuit precedent was consistent with the direction of the Supreme Court that searches invading the human body could not be justified “on the mere chance that desired evidence might be obtained.” Schmerber, 384 U.S. at 769-70, 86 S.Ct. 1826.
In short, no reasonable detective or prosecutor could have thought that they could forcibly take a DNA sample from Friedman without violating his Fourth Amendment rights. Because Friedman’s rights were clearly established at the time that Defendants took the sample, the Defendants are not entitled to qualified immunity.
Boucher additionally argues that he is entitled tó qualified immunity because he was acting on Luzaich’s orders. However, when a police officer argues he is entitled to qualified immunity because he relied on the advice of a prosecutor, it does not render the officer’s conduct per se reasonable, as Boucher suggests. See Stevens v. Rose, 298 F.3d 880, 884(9th Cir.2002). Rather, it may be evidence of good faith. Id. However, if the facts show that the right the officer violated “was clearly established and would be known to a reasonable officer in the circumstances,” then the officer is not entitled to qualified immunity, regardless of the prosecutor’s advice. Id. As we noted in Arnsberg v. United States, 757 F.2d 971, 981 (9th Cir. 1985), where a police officer is acquainted with the controlling law and does not need the advice of counsel to assess the legality of his actions, statements made by a prosecutor will not shield the officer from liability if he then violates the law.
Viewing the facts in the light most favorable to Friedman, as we must at this stage, we conclude that a reasonable officer in Boucher’s circumstances would have known that forcibly taking a DNA sample from a pre-trial detainee without a search warrant or other court authority would violate the detainee’s clearly established Fourth Amendment rights.9 When a right *860is clearly established and a reasonable officer should be familiar with that clearly established law, then the officer cannot escape liability purely by reliance on a prosecutor’s equally unconstitutional actions.
V
Shackling a detainee, chaining him to a bench, and forcibly opening his jaw to extract a DNA sample without a warrant, court order, reasonable suspicion, or concern about facility security is a violation of the detainee’s clearly established rights under the Fourth Amendment. Because the forcible taking of the DNA sample violated Friedman’s clearly established constitutional rights, neither Boucher nor Luzaich is entitled to qualified immunity. We need not, and do not, reach any other issue urged by the parties on appeal.
REVERSED AND REMANDED.
. Because the district court granted summary judgment in favor of the Defendants, the facts here are stated in the light most favorable to Friedman, the nonmoving party. See Olsen v. Idaho State Bd. of Medicine, 363 F.3d 916, 922 (9th Cir.2004). We recognize that the Defendants contest Friedman’s factual allegations, and our recitation of facts taken in the light most favorable to Friedman does not constitute any opinion or conclusion as to how the factual disputes ultimately may be resolved in the district court.
. A buccal swab is a swab taken from the mouth area to collect cheek cells.
. The motion granted by the district court was a motion to dismiss. However, in granting that motion, the court relied on documents attached to the motion which were outside the allegations in Friedman's complaint. When a district court relies on information outside the complaint in a motion to dismiss, the motion is automatically converted to a motion for summary judgment. Fed. R.Civ.P. 12(b)(6); Anderson v. Angelone, 86 F.3d 932, 934 (9th Cir. 1996).
. There is no Nevada statute comparable to the Montana Statute.
. Nor was Friedman subject under Montana law to further court jurisdiction after the formal term had expired, as was the case under federal law in Sezubelek, 402 F.3d at 179; see also United States v. Neville, 985 F.2d 992, 995-96 (9th Cir. 1993) (holding under federal statute that even if the term of supervised release had expired, a district court retained jurisdiction to hold a hearing and revoke the defendant’s supervised release provided that some formal revocation proceeding had begun within the term of supervised release-whether it be a warrant, summons, an order to show cause, or a petition charging a violation of supervised release.)
. After moving to Las Vegas, Friedman received a letter ("the Montana Letter”) from Bill Slaughter, of the Montana Department of Corrections. The letter directed Friedman to provide a DNA sample to Sergeant Tom Keller of the Clark County Sheriff's Department in Nevada. The letter cited the Montana Statute. Defendants argue that this letter gave them authority to take the DNA sample. However, the letter does not mention Boucher, Luzaich or the Las Vegas Police Department and was not issued with the authority of a Montana county sheriff, as would be required by the statute. Further, the letter was addressed only to Friedman and there is no evidence on the record that Boucher or Luzaich were even aware of the letter at the time of the search. Friedman declined to voluntarily provide a DNA sample, as requested by the letter. Friedman also avers that he and his attorney consulted with the Montana Attorney General’s Office and received oral con*856firmation that Montana would not and could not enforce compliance with the Montana Statute while Friedman resided as a private citizen in Nevada. In short, the letter cannot be construed to invoke the designation provision of the statute.
. See Rise v. Oregon, 59 F.3d 1556, 1558 (9th Cir. 1995) (upholding an Oregon law requiring persons convicted of murder, a sexual offense, or conspiracy or attempt to commit a sexual offense to submit a blood sample for use in a DNA bank); Roe v. Marcotte, 193 F.3d 72, 74 (2d Cir. 1999) (upholding a Connecticut state law requiring convicted sexual offenders to submit blood samples to a DNA bank); Schlicher v. Peters, 103 F.3d 940, 941 (10th Cir. 1996) (requiring certain convicted felons to submit blood and saliva specimens for a DNA bank); Boling v. Romer, 101 F.3d 1336, 1338 (10th Cir.1996) (upholding a Colorado law requiring inmates convicted of a sexual assault offense to provide the state with DNA samples); Jones v. Murray, 962 F.2d 302 (4th Cir.1992) (upholding a similar Virginia law that applies to convicted felons).
. Additionally, we note that, because the search took place in 2003, neither Samson, Kincade, nor Kriesel had yet been decided. Therefore Defendants would have had no basis to conclude that their search was reasonable absent the special needs exception or adherence to the Montana Statute.
. We recognize, however, that on close questions, reliance on the advice of counsel may be reasonable and constitute evidence of good faith relevant to the determination of qualified *860immunity. We further recognize that our conclusions on qualified immunity in this context are solely based on the facts as alleged and viewed in the light most favorable to the plaintiff. Our reversal of the district court’s grant of qualified immunity does not preclude Boucher from filing a summary judgment motion based on qualified immunity once the facts are fully developed through discovery.