Although 45-day hold placed on defendant to evaluate him for a sexually violent predator (SVP) petition was unlawful, trial court was not required to dismiss the petition because the hold resulted from good faith mistake of law. On appeal Orey challenged the trial court’s denial of his motion to dismiss an SVP petition, claiming the petition was not filed while he was in lawful custody (Welf. & Inst. Code, § 6601, subd. (a)(2)). The petition was filed while Orey was in custody under a 45-day hold, which he argued was invalid because it was issued without good cause. Held: Affirmed. An SVP petition may be filed only while the defendant is in lawful custody, which means a determinate prison term, parole revocation, or hold placed pursuant to section 6601.3. The hold must be based on good cause as outlined in the statute. Here, BPH placed the hold for public safety reasons, which is not an “exigent circumstance” under the statute. Thus, the 45-day hold was without good cause. Under section 6601, subdivision (a)(2) a person’s unlawful custody does not result in the dismissal of a petition if the unlawful custody resulted from a good faith mistake of fact or law. In this case, BPH’s belief that public safety constituted good cause was a good faith mistake of law.