*312OPINION
Before HUFSTEDLER and TRASK, Circuit Judges, and HILL,* District Judge. TRASK, Circuit Judge:The trustee in bankruptcy appeals from the district court’s order granting the Stewards’ petition for reclamation, which sought rights to $7,000 in proceeds from certain collateral security.
In July 1968, Bide Steward, Winnie Steward, Fern S. Wescott, Gilbert Fauls-tich and Winola Faulstich (Stewards) sold George Forester land in California and Nevada called the Z-Bar Ranch. Forester borrowed $140,000 from the Federal Land Bank of Berkeley to finance the purchase, giving the bank in return a first deed of trust on the ranch property. Forester gave the Stewards the $140,000 and two notes totaling $125,000 in payment for the land. These notes were secured by a second deed of trust on the ranch in favor of the Stewards.
At the same time and as part of the borrowing transaction, Forester gave additional security to the bank to secure his obligation to it. As was required by 12 U.S.C. §§ 721, 733 (since repealed but in force on the date of this transaction), Forester upon his own credit caused $7,000 in Federal Land Bank stock to be pledged to the bank to secure the loan.1
In early 1970 he deeded his ranch to Great Western Ranches, Inc. (Great Western) as part of a tax free reorganization but retained his interest in the stock of the Federal Land Bank Association of Alturas, since no arrangement was made to convey it to Great Western. On April 16, 1970, the bank threatened foreclosure because no payments had been made on its loan to Forester.2 On July 1, 1970, Great Western filed a Chapter X petition in bankruptcy. The reorganization court subsequently restrained all creditors from foreclosing on any properties owned by Great Western. On June 25, 1971, Forester was adjudicated a bankrupt.
On July 6, 1971, the Stewards obtained a modification of the reorganization court’s order protecting Great Western’s property. Under the modified order the Stewards were permitted to sell the property under their power of sale in their second deed of trust and to bid it in. They were required by the court, however, to sell the property thereafter and to pay one-half the net proceeds, but in any event not less than $5,000, to the reorganization court trustee. On January 20, 1972, the Stewards completed the bidding-in process, but the debt owed them by Forester was not satisfied.
In late 1971 the bank was given authority by the reorganization court to foreclose its first deed of trust, pursuant to notices of default thereunder filed on May 18, 1970. The foreclosure sale could not be held until April 30, 1972.
*313The Stewards, meanwhile, having acquired the property subject to the bank’s first deed of trust, proceeded to finalize arrangements to sell the property. They duly made demands upon the bank that it apply the $7,000 in stock to reduce Forester’s obligation under the first deed of trust in order to ensure a greater return to the Stewards on the Forester-Steward debt under the second deed of trust. Acting upon the request of the trustee of Forester’s estate, the bank declined to do so and also declined to pay the proceeds of the stock to the Stewards upon retirement of the stock after the Stewards paid off the Forester bank debt.
In order to prevent their private sale from failing the Stewards did not wait for a resolution of their dispute with the trustee and the bank over the $7,000 stock collateral. Stewards finally agreed to pay the gross amount of the debt to the bank undiminished by the application of the $7,000 credit. Stewards thus completed their sale in April 1972, protesting that the bank should have reduced the Forester balance by $7,000 or should have paid that amount to Stewards if Stewards were required to discharge the bank obligation without such reduction. The Stewards also paid $5,000 to the reorganization court trustee, the minimum they could pay under the court’s order, since there were no net proceeds on the transaction. They retained the rest in cash or notes from the buyers to reduce their loss on the overall affair.
The bank retired the bank stock in its possession and returned $7,000 to the association. The association then paid the $7,000 to Forester’s trustee and retired the $7,000 in association stock it retained.
The Stewards filed an application to reclaim the $7,000 in bank stock proceeds with the bankruptcy court. The referee in bankruptcy found for the trustee, holding that the Stewards were volunteers when they paid off the bank loan and had no subrogation rights and that the bankrupt’s estate was not unjustly enriched by an award of the proceeds.
“The Referee in Bankruptcy holds, and the trustee contends, however, that subrogation is inappropriate because petitioners [the Stewards] were acting as volunteers when they paid off the Bank loan. This contention is not persuasive. Although no Bank foreclosure occurred in this matter, a call for foreclosure had taken place. Since petitioners possessed a Second Deed of Trust which was subordinate to the Bank’s First Deed of Trust, payment of the bankrupt’s loan was necessary to protect their interest in the real property.” C.T. at 213.
Upon review, the district court reversed and ordered the trustee to turn the $7,000 over to the Stewards. The court found that the Stewards were sub-rogated to the bank’s rights to apply the collateral security to reduce the amount they had to pay to pay off the Forester bank loan.3 The court further found that a constructive trust should be implied so that the bankrupt estate was not unjustly enriched at the expense of the Stewards.
We affirm the district court’s judgment. The Stewards were entitled to subrogation to the bank’s security position and to marshaling of the bank’s collateral security interest in the stock.
I. Subrogation
Section 2904 of the California Civil Code provides:
“Rights of Inferior Lienor. One who has a lien inferior to another, upon the same property, has a right:
“1. To redeem the property in the same manner as its owner might, from the superior lien; and,
“2. To be subrogated to all the benefits of the superior lien, when necessary for the protection of his interest, upon satisfying the claim secured thereby.”
The series of steps that the Stewards took with respect to the ranch were, in effect, a redemption by a junior lienor of a superior lien. In April 1970, prior to any action by the Stewards in this case, the bank threatened to foreclose its first *314deed of trust. A few months later the Great Western reorganization court restrained the bank, the Stewards, and all other creditors from foreclosing on any Great Western property. The Stewards eventually received approval to foreclose on their second deed of trust on the condition that they then sell the property at the highest price possible and pay one-half the net proceeds to the Great Western trustee, but in any event no less than $5,000. The bank also received permission to foreclose on its first deed of trust after April 29, 1972. The Stewards bid on and acquired ownership of the ranch in January 1972. The sale to third parties was completed in April of the same year; as part of the sale transaction the Stewards paid off the bank loan to Forester.
All of these steps by the Stewards were taken to protect their second trust deed interest and to effect their private sale. The ownership of the ranch by foreclosure of the second lien was but a contemporaneous step toward the payment of the bank loan and sale of the property.
At the time that Stewards were attempting to clear the title to the land so that a sale could be effected by them, the bank was the holder of the first deed of trust and the security interest in the stock. It had declared the debt which was secured by the lien, in default, and announced that it would foreclose. The reorganization court had given to the bank its authority to foreclose the first deed of trust although directing that the actual sale be deferred. This meant that Stewards in order to effect their private sale had to pay the bank’s debt, refinance it or otherwise dispose of it in order to be able to sell the property and provide title free and clear of the first deed of trust. They first attempted to get the bank to apply the stock interest to the debt to reduce the amount of cash Stewards would have to supply. The bank was adamant in its refusal. Stewards then paid to the bank the entire debt principal and interest.4 When they did so they became legally entitled to be subrogated to the bank’s position. They could continue the foreclosure proceedings against Forester or dismiss them and release the first deed of trust. In any event, it was the Stewards and not the bank who had the right to determine whether to apply the stock to the debt. The Stewards were then the creditor in the bank’s position with all the bank’s lien rights and all of the bank’s security rights including the right to apply the $7,000 stock collateral. The bank at that time had no right to release and turn over its security interest in the land and hold back its security interest in the shares of stock (which were part of the same security transaction) and deliver it to the debtor’s trustee. When the bank was paid it lost its control over either the lien of the first deed of trust or the security right to the stock or its proceeds.
Sections 2903, defining subrogation rights generally,5 and 2904 of the California Civil Code would apply to give the Stewards subrogation rights to the collateral security in the stock since they paid off the senior lien to protect their junior lien interest. The fact that the Stewards acquired a temporary ownership interest for the purpose of effecting the sale does not deprive them of the protection of sections 2903 and 2904.
This approach is supported by general equitable notions. It appears that subro-gation is a doctrine broader in its reach *315than that prescribed in the Civil Code. As the court in Employers Mutual Liability Ins. Co. v. Pacific Ind. Co., 167 Cal.App.2d 369, 334 P.2d 658, 662 (1959), states:
“Subrogation is an equitable doctrine, recognized also at law and not depending upon contractual relationships, which is administered so as to secure justice without regard to form. It applies in all cases in which one party, not a volunteer, pays a debt for which another is primarily liable, which in equity and good conscience should have been paid by the latter party.” (Citation omitted).
The court went on to enumerate five prerequisites of subrogation:
“ ‘(1) Payment must have been made by the subrogee to protect his own interest. (2) The subrogee must not have acted as a volunteer. (3) The debt paid must be one for which the subrogee was not primarily liable. (4) The entire debt must have been paid. (5) Subrogation must not work any injustice to the rights of others.’ ” 334 P.2d at 662, quoting Grant v. De Otte, 122 Cal.App.2d 724, 728, 265 P.2d 952, 955 (1954).
Requirements (3) and (4) are clearly met. Because the Stewards were acting under the direction of the reorganization court’s order and with the aim of protecting their own interests they cannot be considered volunteers within the meaning of requirement (2). Fleming v. Kagan, 189 Cal.App.2d 791, 11 Cal.Rptr. 737, 742 (1961); In re Kemmerrer, 114 Cal.App.2d 810, 251 P.2d 345 (1952); Stein v. Simpson, 37 Cal.2d 79, 230 P.2d 816 (1951); Fritz v. Mills, 170 Cal. 449, 150 P. 375, 376-77 (1915). Restatement of Restitution, § 162, Comment b at 654-55, Comment e at 657.
Requirement (5) is also met. There would be no injustice to others since Forester did not have a justifiable expectation that his collateral security would return to him after he defaulted on his loans; the trustee and through him the general creditors merely stand in Forester’s shoes.
Finally, the Stewards also meet requirement (1). They acted in the reasonable belief that they were protecting their own interests. They acted to forestall the bank from foreclosing under its ^eed of trust; a judicial sale may not have brought the price the land com-landed in the privately arranged sale, The California courts liberally construe the “interest” requirement even to the extent of subrogating a person who discharges a lien on property he mistakenly believed to be his own. Employers Mutual Liability Ins. Co. v. Pacific Ind. Co., 167 Cal.App.2d 369, 334 P.2d at 663. Therefore, under the liberal rules of equity the Stewards should be permitted to be subrogated to the bank’s right to take the collateral security.
II. Marshaling
Marshaling of liens is governed by California Civil Code sections 2899 and 3433:
Ҥ 2899. Marshaling liens
“Order of Resort to Different Funds. Where one has a lien upon several things, and other persons have subordinate liens upon, or interests in, some but not all of the same things, the person having the prior lien, if he can do so without risk of loss to himself, or of injustice to other persons, must resort to the property in the following order, on the demand of any party interested:
“1. To the things upon which he has an exclusive lien;
“2. To the things which are subject to the fewest subordinate liens;
“3. In like manner inversely to the number of subordinate liens upon the same thing; and,
“4. When several things are within one of the foregoing classes, and subject to the same number of liens, resort must be had—
“(1) To the things which have not been transferred since the prior lien was created;
“(2) To the things which have been so transferred without a valuable consideration; and,
*316“(3) To the things which have been so transferred for a valuable consideration in the inverse order of the transfer.”
Ҥ 3433. Marshaling assets
“Relative Rights of Different Creditors. Where a creditor is entitled to resort to each of several funds for the satisfaction of his claim, and another person has an interest in, or is entitled as a creditor to resort to some, but not all of them, the latter may require the former to seek satisfaction from those funds to which the latter has no such claim, so far as it can be done without impairing the right of the former to complete satisfaction, and without doing injustice to third persons.”
When the Stewards received their deeds of trust they had a “subordinate lien” under section 2899 and could require the bank to marshal its liens by proceeding first against the stock (upon which it had an “exclusive lien”) before proceeding against the land. As owners they had an “interest in” the ranch under sections 2899 and 3433. The fact that Forester no longer had an interest in the land (other than as an asset covering his debt to the bank) does not, as appellant urges, render marshaling inapplicable. Mack v. Shafer, 135 Cal. 113, 67 P. 40 (1901).
Prior to the completion of the sale from the Stewards to third parties, the Stewards demanded that the land bank marshal its liens and proceed against the stock. At this point the Stewards’ right to marshaling became vested. See Harrington v. Taylor, 176 Cal. 802, 169 P. 690 (1917). The subsequent payment in full of the first deed of trust debt under protest and sale to the third parties cannot be considered a voluntary relinquishment of marshaling rights. Therefore, the doctrine of marshaling would still apply and the stewards would be entitled to the proceeds of the stock.
The trustee argues that the California Antideficiency Act, Civil Procedure Code § 580b (West 1955), as amended, prevents recovery by the Stewards. Section 580b provides in pertinent part:
“No deficiency judgment shall lie in any event after any sale of real property for failure of the purchaser to complete his contract of sale, or under a deed of trust, or mortgage, given to secure payment of the balance of the purchase price of real property.”
This section prevents a foreclosing mortgagee from proceeding personally against the mortgagor to recover a deficiency after the security is exhausted. But the exercise of the power of sale under the deed of trust does not discharge the obligation. Neither does it affect the outstanding first deed of trust which had been declared in default and was ready for foreclosure. A mortgagee may pursue additional security given by the mortgagor if the primary security is insufficient to satisfy the obligation. Freedland v. Greco, 45 Cal.2d 462, 289 P.2d 463 (1955). The use by one lien-holder of additional rights possessed by another lienholder is permitted if the junior lienholder pays off the debt owed the senior lienholder. Cal.Civil Code § 2904. Forester’s rights under Civil Procedure Code section 580b were not violated. No deficiency judgment was sought or obtained.
Appellants urge that under section 70 of the Bankruptcy Act, 11 U.S.C. § 110, they have become entitled to the collateral security because the debt has been paid. It is true of course that the trustee of the estate of a bankrupt becomes vested by operation of law with the title of the bankrupt as of the date of the filing of the petition. It is also true that the Act does not vest the trustee with any better right or title to the bankrupt’s property than belonged to the bankrupt at the moment of bankruptcy (subject to exceptions not applicable here). 4A Collier on Bankruptcy 55 (14 ed. 1975). The collateral security in question at the date of bankruptcy had been pledged to the bank to secure repayment of a loan by the bank to the bankrupt made several years before. No *317question is raised as to the validity of the loan and the pledge to secure it. Had Forester paid the debt he would have been entitled to a release of the collateral given to secure its payment. But he did not repay it. The Stewards paid this debt to protect their interests in the property and they, not Forester, become entitled to the collateral. To give it to Forester (or his trustee) would unjustly enrich him by releasing to him the security for a debt incurred by him which he did not pay.
The judgment of the district court is affirmed.
. The source of the $7,000 was as follows:
Forester joined the Federal Land Bank Association of Alturas by purchasing $7,000 in association stock representing 5 percent of the amount that the bank loaned to Forester. The association in turn purchased $7,000 in stock in the Federal Land Bank of Berkeley and pledged that stock with the bank to secure Forester’s payment under his first deed of trust. Forester pledged his stock in the association with the association to hold it harmless in its pledge of the bank stock. The district court held that the bank had a perfected security interest in the stock as of July 1968. Had Forester fully paid his obligation under the first deed of trust, the bank would have redeemed the bank stock and paid $7,000 to the association. The association in turn would have redeemed its stock and paid $7,000 to Forester. Upon Forester’s default the bank would have the right to apply the bank stock to the obligation before completing foreclosure of the land under the first deed of trust.
. Forester had likewise made no payments to the Stewards on the second deed of trust and the Stewards paid several thousands of dollars in taxes and expenses applicable to the property to protect it. C.T. at 58.
. The district court held:
. Although the payment was pursuant to an instruction to the escrow agent for distribution of funds, the legal consequences are not thereby altered.
. Ҥ 2903. Right of redemption; subrogation
“Every person, having an interest in property subject to a lien, has a right to redeem it from the lien, at any time after the claim is due, and before his right of redemption is foreclosed, and, by such redemption, becomes subrogated to all the benefits of the lien, as against all owners of other interests in the property, except in so far as he was bound to make such redemption for their benefit.”