
10 Cal.3d 729 (1974)
518 P.2d 329
111 Cal. Rptr. 897
GLENN E. WALKER, Plaintiff and Appellant,
v.
COMMUNITY BANK, Defendant and Respondent.
Docket No. L.A. 30150.
Supreme Court of California. In Bank.
February 5, 1974.
*732 COUNSEL
Graham A. Ritchie for Plaintiff and Appellant.
Schooling & Schooling and Russell F. Schooling, Jr., for Defendant and Respondent.
OPINION
SULLIVAN, J.
In this action to quiet title to real property and to enjoin a sale under a power of sale contained in a deed of trust, plaintiff appeals from an adverse judgment denying him all relief prayed for in his complaint. The action was tried by the court on a written stipulation of facts.
In July 1965, Diversified Enterprises, Inc. (DEI) obtained refinancing from defendant Community Bank (Bank) of debts owed to the Bank and Challenge-Cooke Brothers Equipment Company. DEI borrowed $153,946 from the Bank and in return gave it a promissory note in that amount secured by a chattel mortgage on equipment and trucks owned by DEI. As additional security for the same loan DEI gave the Bank an additional promissory note for $40,000 secured by a trust deed on real property in Los Angeles County.
DEI defaulted and the Bank commenced a judicial foreclosure of the chattel mortgage for $147,209.70, the unpaid balance due on the $153,946 note. Following foreclosure and sale of the chattels, the Bank recovered a deficiency judgment of $93,570.83. Neither the Bank nor DEI made any mention of the $40,000 note or its real property security in this action.
After the commencement of the foreclosure action but before entry of the deficiency judgment, DEI sold to plaintiff Walker the real property securing the $40,000 note. Thereafter but before the said judgment, the Bank commenced foreclosure of the real property by recording a notice of default and election to sell. Walker then commenced the instant action to quiet title in the subject property in himself and to enjoin the trustee's sale. The court granted a temporary injunction barring the foreclosure, which was dissolved upon entry of judgment in favor of the Bank. This appeal followed.
Plaintiff contends that section 726 of the Code of Civil Procedure,[1]*733 which provides that there can be but one form of action for the recovery of a debt secured by a mortgage on real property, bars the Bank from now resorting to its real property security at a trustee's sale since it failed to foreclose on such security in its prior action to foreclose on the chattel mortgage. We agree.
In California, as in most states, a creditor's right to enforce a debt secured by a mortgage or deed of trust on real property is restricted by statute. Under California law "the creditor must rely upon his security before enforcing the debt. (Code Civ. Proc., §§ 580a, 725a, 726.) If the security is insufficient, his right to a judgment against the debtor for the deficiency may be limited or barred by sections 580a, 580b, 580d, or 726 of the Code of Civil Procedure." (Roseleaf Corp. v. Chierighino (1963) 59 Cal.2d 35, 38-39 [27 Cal. Rptr. 873, 378 P.2d 97].) (1) However, since under section 726 "[t]here can be but one form of action for the recovery of any debt" secured by a mortgage or deed of trust on real property, where the creditor sues on the obligation and seeks a personal money judgment against the debtor without seeking therein foreclosure of such mortgage or deed of trust, he makes an election of remedies, electing the single remedy of a personal action, and thereby waives his right to foreclose on the security or to sell the security under a power of sale. (Salter v. Ulrich (1943) 22 Cal.2d 263, 268 [138 P.2d 7, 146 A.L.R. 1344]; James v. P.C.S. Ginning Co. (1969) 276 Cal. App.2d 19, 22 [80 Cal. Rptr. 457]; 3 Witkin, Summary of Cal. Law (8th ed. 1973) p. 1566; Hetland, Cal. Real Estate Secured Transactions (Cont.Ed.Bar 1970) § 6.18, pp. 257-258;[2] Comment, *734 Mortgages and Trust Deeds: Enforcement of a Secured Debt in California (1943) 31 Cal.L.Rev. 429, 433.)
In the last mentioned situation, section 726 is susceptible of a dual application  it may be interposed by the debtor as an affirmative defense or it may become operative as a sanction. If the debtor successfully raises the section as an affirmative defense, the creditor will be forced to exhaust the security before he may obtain a money judgment against the debtor for any deficiency. (Salter v. Ulrich, supra, 22 Cal.2d 263, 267; Hartman v. Smith (1963) 219 Cal. App.2d 415, 417 [33 Cal. Rptr. 147].) If the debtor does not raise the section as an affirmative defense, he may still invoke it as a sanction against the creditor on the basis that the latter by not foreclosing on the security in the action brought to enforce the debt, has made an election of remedies and waived the security. (Hall v. Arnott (1889) 80 Cal. 348, 354 [22 P. 200]; James v. P.C.S. Ginning Co., supra, 276 Cal. App.2d 19, 22.)
Prior to its amendment in 1963 (Stats. 1963, ch. 819, § 26, p. 2007, effective Jan. 1, 1965), section 726 applied to any debt secured by mortgage on real or personal property so that there could be but one form of action for the recovery of debt whether the debt was secured solely by real property, solely by personal property or by both real and personal property. Thus, in the case at bench if the Bank under pre-1963 law had foreclosed only on the chattel mortgage and had obtained a deficiency judgment against DEI, it would have waived the real property security for the same debt.
(2) However, upon the enactment of the California Uniform Commercial Code (hereafter Commercial Code) in 1963 (simultaneously with the above amendment to § 726 and simultaneously effective on Jan. 1, 1965 (Stats. 1963, ch. 819, § 1, p. 1849 et seq.)), the reference to personal property in section 726 was deleted. Commercial Code section 9501 unequivocally prescribes use of the Commercial Code enforcement procedures where the security is solely personal property. Thus, in such instance the deletion of personal property in section 726 clearly means that personal property security can be enforced only pursuant to the Commercial Code. However, where the security is both real and personal property, the effect of this deletion from section 726 is less clear due to the language used in subdivision (4) of section 9501 of the Commercial Code. That subdivision provides: "If the security agreement covers both real and personal property, the secured party may proceed under this chapter as to the personal property or he may proceed as to both the real and the personal property in *735 accordance with his rights and remedies in respect of the real property in which case the provisions of this chapter do not apply."
The above subdivision clearly specifies that if the creditor proceeds as to both real and personal property security, he must do so according to the rights and remedies accorded real property security and not pursuant to the Commercial Code. (3) We think it is clear that a creditor who has both real and personal property security, can elect to proceed solely as to the personal property under the Commercial Code. Although subdivision (4) is silent on the point, the official comment indicates that the effect of such an election is determined by other state law.[3]
Accordingly, the question which we must decide in the case at bench is whether the deletion from section 726 of the reference to personal property totally exempted personal property security from the one-form-of-action rule, even where together with real property it constitutes security for a single debt. Or, to put it another way, is section 726 still applicable where there is both real and personal property security?
Professor Hetland has answered this question as follows: "Prior to 1963, CCP 726 applied to enforcement of any right secured by mortgage on real or personal property. With the enactment of the Uniform Commercial Code, however, personal property was omitted from CCP 726. Clearly the effect of this is to allow the enforcement procedures of the Uniform Commercial Code where the security is entirely personal property. Where the debt is secured partially by real property and partially by personal property, however, omission of personal property from CCP 726 seems of no significance. [¶] The reasons underlying both the affirmative defense and the sanction aspect of CCP 726 remain the same when part of the security is personal property, i.e., prevention of a multiplicity of suits, compelling competitive bidding to test the value of all security for the debt, and forcing the creditor to look to all security as the primary fund for payment of the indebtedness before looking to the debtor.... [¶] [T]he creditor may not first have a judicial action to foreclose on any security [either real or personal] without losing the balance of his security, thereby precluding any future nonjudicial sales." (Hetland, op. cit. supra, § 6.18 at pp. 260-261.)
*736 Plaintiff and defendant Bank agree upon the basic purposes underlying not only sections 726 and 580a relating to fair market value but also section 580d relating to deficiency judgments. (4) These sections were intended to prevent multiplicity of actions, to compel exhaustion of all security before entry of a deficiency judgment and to require the debtor to be credited with the fair market value of the secured property before being subjected to personal liability. But the parties before us disagree as to the extent these purposes come into play in the instant case.
The Bank points out, and plaintiff concedes, that it could have properly resorted to the real property security first by a private sale and then judicially foreclosed the chattel mortgage pursuant to section 9501, subdivision (4) of the Commercial Code. (5) Such a procedure is of course entirely permissible since a private sale under the power contained in the trust deed is not a judicial foreclosure within section 726; the subsequent judicial foreclosure of the chattel mortgage, being solely on personal property and being the initial judicial action, would not have offended section 726 (which since Jan. 1, 1965 no longer covers personal property) but would fall clearly within subdivision (4) of section 9501 of the Commercial Code. The Bank argues that in the instant case it must therefore be able to reverse the order of resorting to its security without violating the purposes underlying sections 726, 580a and 580d.
However, a creditor who resorts to his real property security by exercising the power of sale contained in a deed of trust may not obtain a deficiency judgment. (§ 580d.) Accordingly, if the Bank had chosen to first exhaust the real property security by private sale, it could not have obtained a deficiency judgment and would have had to be content thereafter with merely foreclosing the personal property security. (Freedland v. Greco (1955) 45 Cal.2d 462 [289 P.2d 463].) In the instant case, however, by first judicially foreclosing the chattel mortgage, it did obtain a deficiency judgment before exhausting all its security.
If the Bank's position were approved, a creditor could foreclose solely on the personal property security under the Commercial Code and obtain a deficiency judgment against the debtor without first exhausting all the security, namely the additional real property security. This flies directly in the face of the clear purpose of section 726 of requiring a secured creditor to exhaust all security first. If this could be done a creditor accepting substantial real property security for an obligation, by merely requiring an insignificant amount of personal property as additional security, could proceed to a judicial foreclosure of the latter security only, obtain a deficiency judgment in such action and thereafter proceed to a nonjudicial foreclosure *737 of the real property security, thereby circumventing both the statutory requirements of judicial foreclosure and the statutory bar against deficiency judgments. To allow this procedure would be to sanction the result severely condemned in Freedland v. Greco, supra, 45 Cal.2d 462, namely both a private sale under deed of trust and a deficiency judgment on the same debt.
Illustrative of this restrictive rule is James v. P.C.S. Ginning Co., supra, 276 Cal. App.2d 19. There the Jameses, having obtained a loan from the defendant gin to carry on their farming operations, gave the latter two promissory notes secured by a crop mortgage and a chattel mortgage on their farming equipment. Listed among the equipment was an item denominated "equity in house" which was their residence. Subsequently they filed a declaration of homestead on the residence property.
Upon the Jameses' default, the gin brought an action against them on the promissory notes, sought possession of the personal property and the equity in the house, but failed to allege that the language "equity in house" created an equitable lien. The gin obtained a default judgment against the Jameses for the balance due on the notes, attorney's fees and costs. Significantly, the gin failed to seek foreclosure of the real property security  a valid equitable lien under Coast Bank v. Minderhout (1964) 61 Cal.2d 311, 314 [38 Cal. Rptr. 505, 392 P.2d 265]  and the Jameses, having defaulted, obviously failed to raise section 726 as an affirmative defense so as to compel the gin to exhaust all its security. Although it had not sought to foreclose on the real property in its action on the promissory notes, the defendant nevertheless attempted to reach the "equity" in the house by obtaining a writ of execution to enforce the money judgment. This writ was levied on the Jameses' equity in the house and, at the subsequent execution sale, the defendant gin purchased the Jameses' equity.
Meanwhile, and prior to the execution sale the Jameses had been adjudicated bankrupts and the referee in bankruptcy had set aside their residence property as exempt because of the homestead. The Jameses then brought an action to quiet title to their residence property against the defendant gin's judgment and execution sale on the ground that their declaration of homestead was filed before the entry of judgment against them in the first action brought by the gin. Affirming a judgment upholding validity of the homestead and quieting title to the residence property in the Jameses the Court of Appeal declared: "Since there was a valid, equitable lien, the question narrows to whether the gin [defendant], by electing to file a personal action and reduce the indebtedness to a personal judgment, made an election of remedies that, by operation of law, waived its equitable lien priority over plaintiffs' subsequent declaration of homestead. Code of Civil *738 Procedure section 726 provides that `There can be but one form of action for the recovery of any debt, or the enforcement of any right secured by mortgage upon real property, which action must be in accordance with the provisions of this chapter....' [¶] Since there can be but one form of action, under section 726, the courts have established that where a creditor elects to obtain a personal money judgment rather than enforce his mortgage, the effect of the election is to waive the right to foreclose on his security. [Citations.]" (James v. P.C.S. Ginning Co., supra, 276 Cal. App.2d at p. 22.)
James appears indistinguishable from the case before us. Here, the Bank foreclosed the chattel mortgage, without mentioning, or attempting to foreclose on, the real property security. DEI chose not to assert section 726 as an affirmative defense so as to compel the Bank to exhaust all its security before a deficiency judgment. Instead DEI waived this defense and relied upon the sanction aspect of section 726 to bar subsequent foreclosure of the real property security. James holds that such reliance upon the sanction aspect of section 726, which the court refers to as "an election of remedies" is entirely justified.
The Bank contends, however, that James is distinguishable from the instant case on two grounds: (1) that in James the primary debtors did not waive their rights under section 726 whereas here the primary debtor (DEI) waived its rights at the time of the foreclosure action against the personal property; and (2) that in James the real property security was involved in the suit on the personal property security whereas here it was not mentioned, so that section 726 was never brought into play. Neither proffered basis of distinction has any merit.
We examine the first point of distinction. In James the initial action brought by the defendant gin on the two promissory notes resulted in a default judgment. Obviously the Jameses did not assert section 726 as an affirmative defense and therefore waived that affirmative defense aspect of section 726, namely the right to force the gin to exhaust all its security. In this respect, James is on all fours with the case at bar; in each instance in the initial action involving only the personal property security the primary debtor waived section 726 as an affirmative defense. (6) However, as held in James the failure to assert section 726 as an affirmative defense does not result in a waiver of all protection under section 726 and leaves the debtor free to invoke the sanction aspect of the one-form-of-action rule. In the course of rejecting the ginning company's argument that the Jameses were barred from asserting the superiority of their declaration of homestead over the recorded equitable lien on the residence property because *739 they had failed to file a counterclaim in the original action brought by the gin on the promissory notes, the James court observed: "However, plaintiffs were not required to appear in the original action unless they wished to force defendant to foreclose the lien pursuant to sections 726 and 580a of the Code of Civil Procedure. (Roseleaf Corp v. Chierighino, supra, 59 Cal.2d at p. 40; Salter v. Ulrich, supra, 22 Cal.2d 263.) Where the mortgagors were content to have the mortgagee waive its right to foreclose against the security and proceed to obtain a personal judgment, a counterclaim alleging the homestead would have been premature." (James v. P.C.S. Ginning Co., supra, 276 Cal. App.2d at p. 24.)[4]
To support the second basis of distinction, the Bank points to the following language of subdivision (4) of section 9501 of the Commercial Code: "or he may proceed as to both the real and the personal property in accordance with his rights and remedies in respect of the real property in which case the provisions of this chapter do not apply." On this footing the Bank attempts to construct the argument that James was decided in the way it was because there in the initial action brought by the ginning company on the promissory notes, the "equitable lien" on the real property was mentioned, albeit incorrectly and ineffectively, and that therefore such initial action was actually one including both the real and the personal property security, thereby complying with section 726. By contrast in the case at bench, it is argued, since absolutely no mention was made of the real property security in the initial action to foreclose the chattel mortgage, that action was not both as to real and personal property, but solely personal property, thereby bringing into play subdivision (4) of Commercial Code section 9501 and not Code of Civil Procedure section 726.
*740 James, however, made no mention whatsoever of section 9501 of the Commercial Code although that section was clearly in effect when the gin brought its initial action in 1967. The James court simply applied section 726 to the action and held it applicable and controlling. Nor did the court make any reference to the deletion of personal property from section 726 then also in effect; rather it seems to have followed a line of precedents holding section 726 applicable to the recovery of a single debt secured by both real and personal property.[5] Moreover, as we pointed out earlier since subdivision (4) of Commercial Code section 9501, as explicated in the official comment, specifically leaves "to other state law" (see fn. 2, ante), the effect of foreclosing only on personal property pursuant to the Commercial Code where there is a single debt secured by both real and personal property, the question before us focuses simply upon the applicability of section 726.
The clarity of the issue is perhaps obscured in this case by the fact that DEI waived the affirmative defense aspect of section 726 and did not force the Bank to exhaust all its security before obtaining a deficiency judgment. However, when the Bank failed to include the real property and thereby failed to exhaust all security before obtaining a deficiency judgment, it automatically triggered the sanction aspect of section 726 and thereby lost all security rights in the real property. The sanction thus brought into play takes effect regardless of whether the waived security is owned by the debtor or his successor in interest.
(7) In summary the multiple purposes of sections 726, 580a and 580d are accomplished by investing the debtor with two protections. First, when the creditor sues for the recovery of a single debt secured by more than one parcel of real property or by both real property and personal property, the debtor may compel the creditor to include all of the security in a single judicial foreclosure action by raising section 726 as an affirmative defense. Second, although he fails to raise such an affirmative defense and thus allows the creditor to judicially foreclose on part of the security and to obtain a deficiency judgment, the debtor may nevertheless subsequently invoke the sanction aspect of section 726 and challenge the right of the creditor to thereafter foreclose on the real property security or to sell it *741 under a power of sale, on the basis that he has waived all right to such security.
(8) Accordingly, we hold that where, as here, there is a single debt secured by both real and personal property and the creditor elects to judicially foreclose only on the personal property, he thereby loses his security interest in the real property as against all parties even though the debtor does not raise the one form of action rule (§ 726) as affirmative defense in the judicial foreclosure proceedings.[6]
In view of our disposition of the matter we need not consider plaintiff's remaining contentions.
The judgment is reversed and the cause is remanded to the trial court with directions to enter judgment for plaintiff for the relief prayed for.
Wright, C.J., McComb, J., Tobriner, J., Mosk, J., Burke, J., and Clark, J., concurred.
NOTES
[1]  Code of Civil Procedure section 726, provides in relevant part: "There can be but one form of action for the recovery of any debt, or the enforcement of any right secured by mortgage upon real property, which action must be in accordance with the provisions of this chapter...."

Although the section refers only to "mortgage," it is applicable to a deed of trust. (Bank of Italy v. Bentley (1933) 217 Cal. 644, 653 [20 P.2d 940].)
Hereafter, unless otherwise indicated all section references are to the Code of Civil Procedure.
[2]  Professor Hetland provides the following excellent summary of the rule: "When a creditor has more than one parcel of real property, or a combination of real and personal property, securing a single debt, the debtor may compel the creditor to include all the security he has for that debt in a single judicial foreclosure action by raising CCP 726 as an affirmative defense.... Occasionally, however, either through design or inadvertence, a creditor fails to exhaust all his security in one action, and the debtor fails to compel him to do so by raising his CCP 726 defense. When the creditor tries to recover the balance owing or take the remaining security, the following questions arise: [¶] What effect has his failure to exhaust all security in one action had on his right to realize on the additional security? Can he take a deficiency or personal judgment on the balance owing? May the creditor bring another action to foreclose on the balance of the security? Can he foreclose the balance by nonjudicial sale? If the creditor foreclosed on none of his security but instead took a personal judgment against the debtor, does he retain his former lien priority when he attempts to execute on the real property that previously was his security? [¶] The answer to each question is `No.'"
[3]  Commercial Code comments: "... 5. The collateral for many corporate security issues consists of both real and personal property. In the interest of simplicity and speed subsection (4) permits, although it does not require, the secured party to proceed as to both real and personal property in accordance with his rights and remedies in respect of the real property. Except for the permission so granted, this Act leaves to other state law all questions of procedure with respect to real property...."
[4]  Defendant Bank also contends that plaintiff has no standing to challenge the lien of the deed of trust since the protection afforded by sections 726 and 580a is limited to the primary debtor and is not available to his successor in interest. In support of this contention it relies upon Salter v. Ulrich, supra, 22 Cal.2d 263, cited in James. The Bank's reliance is misplaced since Salter does not stand for that proposition and indeed supports an opposite conclusion. Salter holds that if the primary debtor fails to raise section 726 as an affirmative defense, such waiver is binding upon his successor in interest. However, as noted in the text, although there is a waiver of the affirmative defense the sanction aspect of the rule is still invocable. Salter specifically recognizes that the successor in interest or indeed one who holds even an adverse interest is protected by the sanction aspect just as much as the primary debtor. The court in Salter as in James refers to the sanction aspect as an election of remedies so that a creditor who sues on a note and fails to foreclose his security thereby waives his security interest. This waiver is binding against parties in addition to the primary debtor. "Defendant, by suing on the note instead of foreclosing, chose to disregard the security given and to rely on the title secured on the execution sale. Defendant thus made an election of remedies [citations], and cannot now pursue the concurrent remedies of foreclosure by action or by trustee's sale." (Salter v. Ulrich, supra, 22 Cal.2d at p. 268.)
[5]  It should be noted that if there were separate debts with separate security, even though arising from one transaction, then section 726 has no application. (Roseleaf Corp. v. Chierighino, supra, 59 Cal.2d 35; Hetland, op. cit. supra, § 6.12 at pp. 245-247.) The transaction involved in this matter could quite conceivably have been interpreted as two separate debts, but the parties stipulated that the instant action involved a single debt with multiple security.
[6]  The Bank may, of course, levy execution upon any of DEI's property in order to satisfy the deficiency judgment. However, since Walker now owns the real property in question, the only interest the Bank had in the property was the security interest, which it has now lost due to the operation of section 726.
