YEGAN, J.
Pat Geier appeals from a judgment on demurrer to his taxpayer's suit against respondents, Santa Barbara County Sheriff's Office (SBCO), Sheriff Bill Brown, Santa Barbara County Clerk Recorder's Office, County Clerk/Recorder Joseph E. Holland, and county clerk/recorder employees Melinda Greene and Mary Rose Bryson. Appellant claims that he is the victim of wrongful foreclosure. He also claims that fraudulent foreclosure documents were recorded that can be used to oust him from the property if and when an unlawful detainer action is filed. The trial court sustained respondents' demurrer without leave to amend. We affirm. The complaint is brought under the guise of a taxpayer suit statute (Code Civ. Proc., § 526a)
In 2012, appellant defaulted on a $510,000 deed of trust encumbering his home at 3673 Pine Street, Santa Ynez. A notice of trustee's sale was recorded stating that the property would be sold on November 5, 2012.
On December 24, 2013, appellant filed a taxpayer's suit for declaratory and injunctive relief.
The trial court sustained the demurrer on the ground that "the parties that you're suing, the Sheriff and the County Recorder have mandated statutory duties. The County Recorder can't look through a document and say, `Oh, this is a fraudulent document, I'm not going to file it.' They're statutorily mandated, statutorily required to accept the documents. So because of that, that's not a basis for a lawsuit against the County Recorder. And similarly, the Sheriff, when the Sheriff serves the writ of execution is doing so by order of the Court and so the Sheriff is mandated to go out and serve the writ of execution, otherwise the Sheriff is in contempt of court."
On review, we exercise our independent judgment to determine whether a cause of action has been stated under any legal theory. (Shuster v. BAC Home Loans Servicing, LP (2012) 211 Cal.App.4th 505, 509.) We accept as true properly pleaded allegations of material fact, but not contentions, deductions or conclusions of fact or law. (Blank v. Kirwan (1985) 39 Cal.3d 311, 318.) Section 526a permits a taxpayer action to enjoin illegal governmental activity or the illegal expenditure/waste of public funds. (Van Atta v. Scott (1980) 27 Cal.3d 424, 449; see Blair v. Pitchess (1971) 5 Cal.3d 258, 268 [taxpayer suit to enjoin sheriff from expending public funds to enforce unconstitutional claim and delivery law].) A taxpayer action does not lie where the challenged governmental conduct is legal. (Coshow v. City of Escondino (2005) 132 Cal.App.4th 687, 714; Lucas v. Santa Maria Public Airport Dist. (1995) 39 Cal.App.4th 1017, 1027.)
Appellant's complaint collaterally attacks the trustee's sale and is outside the purview of section 526a. (Smith v. Allen (1968) 68 Cal.2d 93, 96 [properly conducted foreclosure sale constitutes a final adjudication of rights of borrower and lender].) It prays for a judgment that appellant's property is "lien free" and that respondents' actions are a waste of time and taxpayer funding.
The trial court correctly found that a taxpayer's action does not lie where the challenged government conduct is legal. (Humane Society of the United States v. State Board of Equalization (2007) 152 Cal.App.4th 349, 361.) "Conduct in accordance with regulatory [or statutory] standards `is a perfectly legal activity' "and beyond the scope of a section 526a taxpayer's action. (Coshow v. City of Escondino, supra, 132 Cal.App.4th at p. 714.)
The allegation that fraudulent foreclosure documents were recorded does not state a cause of action. The county recorder was required, as a matter of law, to record the documents when presented. Government Code section 27201, subdivision (a) provides: "The recorder shall, upon payment of proper fees and taxes, accept for recordation any instrument, paper, or notice that is authorized or required by statute, or court order to be recorded. . . . The county recorder shall not refuse to record any instrument, paper, or notice that is authorized or required by statute, or court order to be recorded on the basis of its lack of legal sufficiency." (See e.g., Jackson v. County of Amador (2010) 186 Cal.App.4th 514, 520-522 [county recorder did not violate law by recording a durable power of attorney and quitclaim deeds that were allegedly fraudulently procured].) Appellant cites no authority that a county recorder has a duty to conduct a fraud investigation before recording documents valid on their face.
The allegation that the sheriff will, in all likelihood, serve a writ of possession to oust appellant does not state a cause of action. It is settled that the purchaser at a trustee's sale may bring an unlawful detainer action against a trustor who refuses to relinquish possession after the foreclosure sale. (§ 1161a; Bernhardt, Cal. Mortgage and Deed of Trust Practice (Cont.Ed.Bar 2003) § 2.77, p. 111; Rutter, Cal. Practice Guide, Landlord-Tenant (2013) ¶¶ 7:256, 7:258, p. 7-583.) Code of Civil Procedure section 712.010 provides: "After entry of a judgment for possession or sale of property, a writ of possession or sale shall be issued by the clerk of the court upon application of the judgment creditor and shall be directed to the levying officer in the county where the judgment is to be enforced." The clerk of the court has a ministerial duty to issue the writ of possession. (Ibid.)
Once the writ of execution issues, the sheriff is statutorily required to levy on it. (§ 712.030, subd. (a).) The levying officer is immune from liability in the execution of "all process and orders regular on their face and issued by competent authority, whatever may be the defect in the proceedings upon which they were issued." (§ 262.1; see George v. County of San Luis Obispo (2000) 78 Cal.App.4th 1048, 1054-1055 [sheriff immune from liability for wrongful eviction when acting under order and writ of possession issued by bankruptcy court].) No cause of action has been stated against respondents.
Appellant contends that Civil Code section 2924, which authorizes nonjudicial foreclosures, violates the due process and equal protection rights of Santa Barbara residents and is a violation of the takings clause under the federal constitution. The argument fails because a nonjudicial foreclosure is not state action or subject to the due process clauses of the federal and state constitutions. (I.E. Associates v. Safeco Title Ins. Co. (1985) 39 Cal.3d 281, 286-287; Garfinkle v. Superior Court, supra, 21 Cal.3d at pp. 280-282 (Garfinkle); 4 Miller & Starr (3d ed. 2011) Cal. Real Estate, § 10:223, pp. 10-827 to 10-828.)
In Garfinkle, our State Supreme Court held that the power of sale arises from contract (i.e., the mortgage or deed of trust) and that the regulation of trustee's sales is designed to restrict creditor behavior. (Garfinkle v. Superior Court, supra, 21 Cal.3d at pp. 278-279.) The ministerial role of the county recorder in a trustee's sale is not state action. (Id., at p. 280.) "The fact that a purchaser who has acquired rights by virtue of a trustee's deed, like a party who has acquired rights under any other type of contract, may have a right to resort to the courts in order to enforce such previously acquired contractual rights when that becomes necessary, is not sufficient to convert the acts creating these contractual rights into state action. For to hold otherwise, would be to subject every private contract to review under the Fourteenth Amendment. [Citation.]." (Ibid.)
California's statutory regulation of nonjudicial foreclosures does not convert the actor's conduct (i.e., the foreclosing lender) into state action. (See Jackson v. Metropolitan Edison Co. (1974) 419 U.S. 345, 357 [42 L.Ed.2d 477, 487-488]; Homestead Savings v. Darmiento (1991) 230 Cal.App.3d 424, 428-429 [Civil Code section 2924 does not violate debtor's due process rights].) "The decision whether to exercise the power of sale is a determination to be made by the creditor. The statutes [i.e., Civil Code section 2924] merely restrict and regulate the exercise of the power of sale once a choice has been made by the creditor to foreclosure the deed of trust in that manner. [Citations.]" (Garfinkle, supra, 21 Cal.3d at pp. 278-279; see also U.S. Hertz, Inc. v. Niobrara Farms (1974) 41 Cal.App.3d 68, 87.)
Appellant argues that Civil Code section 2924, subdivision (a) requires that the trustee obtain a court order or judgment before the trustee's sale and that such an order/judgment is a prerequisite to an unlawful detainer action. This misstates the law.
Appellant's remaining arguments have been considered and merit no further discussion. The trial court sustained the demurrer because appellant was suing the wrong person. Appellant makes now showing that the trial court was biased or denied appellant due process of law. (Betz v. Pankow (1993) 16 Cal.App.4th 919, 926.) Leave to amend is properly denied where, under the substantive law, no liability exists and the plaintiff fails to make a prima facie showing that the complaint can be amended to state a cause of action. (Goodman v. Kennedy (1976) 18 Cal.3d 335, 349.)
The judgment is affirmed with costs to respondents.
GILBERT, P.J. and PERREN, J., concurs.