The opinion of the court was delivered by
West, J.:Joseph Bortenlanger contracted with the city of Stafford for the construction of a waterworks system and an electric light plant. Pursuant to the provision requiring him to give bond he furnished one executed by the plaintiff, which bond provided that if the principal should voluntarily abandon the contract the surety should have the right to assume the same and sublet or complete it, “and if said contract shall be assumed by the Surety, then as such contract is duly performed, any reserve, deferred payments and all other monies provided by said contract to be paid to the Principals, shall'be paid to the Surety, at the same times and under the same conditions as by the terms thereof, such monies would have been paid to the Principals had the contract, been duly performed by them.” This was executed January 30, 1911. The same principal and surety on the same date executed a bond to the state conditioned for the payment of all *541indebtedness incurred for the material furnished for making the improvement. Before the execution of these bonds Bortenlanger executed and delivered to the plaintiff an agreement in writing to pay all loss and damage on account of any default or neglect on his part, and providing that in case of any breach or default on his part the company should be subrogated to all his rights in the contract, “and that deferred payments and any and all monies and properties that may be due and payable to me, at the time of such breach or default, or that may thereafter become due and payable to me, on account of said contract, shall be credited upon any claim that may be made upon the Fidelity and Deposit Company of Maryland under the bond above mentioned.” The trial court found that Bortenlanger failed to complete his contract by the first day of July, 1911, and an extension having been granted until September 15, he continued the work, but about that time abandoned the same, and upon the request of the city the defendant assumed the contract and completed the work in accordance therewith; that the work was accepted by the city October, 1911, when it was mutually agreed that the amount due from the city on the contract was $5534.02; that the plaintiff thereupon offered to pay all labor and material bills remaining unpaid, amounting to $5888.62, and demanded that the city pay the $5534.02, which the city refused to do; that in completing the contract the plaintiff paid labor and material bills amounting to $1000, and had also paid the $5888.62, amounting to $6888.62 in all; that about April 15, 1911, the contractor borrowed of the defendant bank $2000, and without knowledge and consent of the plaintiff executed and delivered to the bank an order or assignment in the sum of $2000 drawn against the city and directed it to pay the bank such sum out of any funds due or becoming due to him from the city on his contract; that about November 4, 1911, over the protest and objection of the plaintiff, the city paid the bank $2000 out of the *542$5534.02 remaining unpaid on the contract. It was stipulated that the money was borrowed as follows:
“The bank was to give Bortenlanger credit for said $2000.00, and it was to be drawn out on the checks of said Bortenlanger for material and labor in the fulfillment of his contract with the city, to which check was to be attached the bill of such labor and material for which said check was issued, properly signed by the materialman or laborer so paid; that no part of said $2000.00 was to be drawn in any other manner, and none of it was in fact drawn or used by said Bortenlanger in any other manner than as agreed; that said agreement and said credit was given on the above terms and conditions prior to any of such money being drawn out of said bank; that the said money was loaned by the bank to Bortenlanger for the payment of labor and .material thereafter to go into the work.”
The company recovered and the city and the bank appeal, the sole point presented being the effect of the arrangement made with the bank.
It is manifest that under the contract already referred to the surety company, on completing the work after the contractor’s default, was entitled to step into his shoes and receive such payments from the city as otherwise he could have been entitled to. Also, that the bank was not the contractor’s creditor by virtue of an ordinary loan of money to him to use as he pleased, but because of having furnished $2000 to pay that amount of the" labor and material claims as they accrued in the progress of the work; and of course by paying them they were taken out of the category of possible demands, lienable or otherwise, to be considered in the final settlement. It is also clear that while this transaction was had by consent of the contractor, the bank and the city, the plaintiff surety company was not assenting thereto and does not appear to have had notice thereof, and yet under one of the contracts said by the trial court to have been on file with the city clerk the plaintiff, upon completing the work, was entitled to look to the city for all sums due or to become due on the contract. The plaintiff’s position is that *543upon the contractor’s default all sums due or to become due for the work became a trust fund in the hands of the city upon which the plaintiff acquired a lien when it paid the remainder of such sums, and that this lien related back to the date of the original contract, January 31, 1911; that the bank was a mere volunteer and did not acquire the right of subrogation or an equitable lien, but only the right to whatever funds might be left after the surety company should be paid its losses sustained by Bortenlanger’s default. The defendant bank’s position is that it in reality paid certain labor and material claims, receiving receipted bills therefor, and thereby became the equitable assignee of such claims; that it not only took an order on the city, but it paid nothing to the contractor, simply taking up certain claims for labor and material which went into the building; that had not such labor and materialmen assigned such claims to the bank they could have participated in the fund provided for the erection of the plant, and that by this arrangement the city was protected from liens which otherwise might have been filed for these claims. The exact situation is this: The surety company had a contract on file with the city clerk entitling it upon completion of the contract to all the moneys due or to become due Bortenlanger. This sum was $5534.02, but of this $2000 worth of claims had been paid with the money borrowed of the bank, hence he would have been entitled to the balance only, or $3534.02, had he completed the contract himself, and had the $2000 order on the city in favor of the bank been honored. On this basis, the surety company, having paid out $6888.62 in order to complete the contract, would, by the recovery of the $3534.02, lose $3354.60, and if paid the entire sum of $5534.02 it would still be loser in the sum of $1354.60. Bortenlanger is out of the deal now. The city has lost nothing, and it remains to determine whether the bank or the bonding company must suffer.
A brief review of the cases relied on by the plaintiff *544seems proper. In Ætna Life Ins. Co. v. Middleport, 124 U. S. 534, 8 Sup. Ct. Rep. 625, 31 L. Ed. 537, a town voted an appropriation to a railroad company to be raised by a tax, and issued bonds for a sum sufficient to include interest and discount, which bonds were accepted by the company and sold to plaintiff. In a suit between the plaintiff and the town the bonds were held void, and it was decided that the plaintiff was not entitled to subrogation to the right of the company, if any, to enforce the collection of the appropriation. Mr. Justice Miller, in the opinion, said that the plaintiff founded his claim upon the position that by the purchase of the bonds he paid the debt of the town, and should therefore be subrogated to the right of the company, but that the purpose of the purchase was not payment of a debt, but the sale and ti’ansfer of a debt of the town from one party to another, and that the underlying principle of subrogation in equity is that the person seeking it must have paid the debt under some necessity to save himself from loss which might accrue to him by the enforcement of the debt in the hands of the original creditor. Touching the volunteer character of the transaction on the part of the plaintiff, it was said:
“It had no interest at hazard which required it to pay this debt. . . . There was no obligation on account of which, or reason why, the complainant should have connected itself in any way with this transaction, or have paid this money, except the ordinary desire to make a profit in the purchase of bonds.” (p. 548.)
And it was held that subrogation is not for the stranger or volunteer, but for one who was already bound and could not but choose to abide the penalty. The case of Prairie State Bank v. United States, 164 U. S. 227, 17 Sup. Ct. Rep. 142, 41 L. Ed. 412, is a leading one. There the real points decided were that a claim against the government was not transferable, and that an order on the United States to repay the bank certain advancements, the surety having without *545the knowledge of such advancement completed the contract, and the rights of the bank in the fund reserved for the erection of the building were subordinate to the rights of the surety. The latter had disbursed a large amount in excess of certain payments from the government, and it was argued that as the bank had advanced money to complete the building, thus enabling the contractors to perform their obligation, the bank had an equitable lien upon the per cent retained by the government paramount to any lien by the surety, whose lien it was contended only arose from the date of his advancements made to execute the contract upon the principal’s default. It was held, however, that the rights of the surety related back to the date of the original contract. In the opinion it was said (p. 232) that the surety in making the payments discharged an obligation due to the contractor for which the surety was bound.
“The bank on the contrary, was a mere volunteer, who lent money to Sundberg on the faith of a presumed agreement and of supposed rights acquired thereunder.” (p. 232.)
And it was finally said (p. 240) that the contractors could not transfer to the bank any greater right in the funds than they themselves possessed, and that such rights were subordinate to those of the United States and the sureties. In the case of Henningsen v. U. S. Fidelity & Guaranty Co., 208 U. S. 404, 28 Sup. Ct. Rep. 389, 52 L. Ed. 547, a similar ruling was made touching a condition very much like the one last referred to. The surety on the bond of the contractor who had undertaken the construction of certain government buildings was held to have a claim to the sums due from the government superior to the claims of a bank under an assignment from the contractor to secure payment of money loaned to him. There the loan, however, was not confined to the payment of labor and material claims but was to be used as the *546borrower saw fit. The case of Prairie State Bank v. United States, supra, was approved and followed. In Hardaway v. National Surety Co., 211 U. S. 552, the bond obligated the surety to see that the contractors made full payment to all those supplying labor and material on the work. After the work was begun the contractors agreed that one Coyne should make all future purchases in his own name, and receive all profits from the contract. Afterwards, Coyne made a contract with Hardaway and Prowell by which the latter undertook to complete the work, and to take over the sums due to the government for the lock and dam contracted for. It was held that Hardaway and Prowell were not subcontractors; that they were simply under an agreement to be paid by the assignment of the funds due from the government, and that the rights of the surety were superior to theirs. In United States v. Rundle, 107 Fed. 227, 46 C. C. A. 450, 52 L. R. A. 505, it was held that sureties on a contractor’s bond were not liable to a bank which, under an agreement to supply the contractor with funds, had paid at certain times checks and orders given materialmen, which were indorsed as evidences of payment, but not assigned. It appeared that the bank agreed to furnish the contractor certain money to pay for labor and material, for which it was to receive an assignment of the total amount due upon the contract so that the money might be paid to the bank and not pass through the contractor’s hands. The court' said that the latter transaction amounted to an agreement by the bank to loan money to the contractor to carry out his contract and permit him to check out the amounts as required to be paid to the laborers. In First Nat. Bank v. City Trust, Safe Deposit & Surety Co., 114 Fed. 529, 52 C. C. A. 313, it was held that a surety who completes the work after its abandonment by the principal is subrogated, so far as necessary to protect him from loss, to all rights which the city might have enforced against the contractor *547had it completed the work itself. Prior to the abandonment the contractor had borrowed money from a bank and assigned to it all sums to become due from the city during certain months, of which assignment the city had notice. It was held that the surety’s rights were superior in law and equity to those of the bank, which took no greater rights than those of the contractors against the city or surety. The case of Reid v. Pauly, 121 Fed. 652, does not throw any particular light upon this controversy. Union Stone Co. v. Freeholders of Hudson County, 71 N. J. Eq. 657, 65 Atl. 466, is to the effect that the surety upon completing the contract is subrogated to the owner of the building against the contractor and against personal-claim liens for material, but only to such extent as will reimburse the surety for its necessary outlay, and it was expressly said that this right related back to the making of the contract for which the contract of the suretyship was given. In Stehle v. United Surety Co., 107 Md. 470, 68 Atl. 600, the position of the surety bond was practically like that of the plaintiff here. The surety, upon abandonment by the principal, completed the contract. A creditor of the contractor attached the funds and the surety intervened. It was held that the money was payable to the surety, and not liable to attachment by the creditor although the latter had, as subcontractor, done part of the work. It was said that the contractor, after having abandoned the contract, could assert no title to the fund, because, by the express terms of the bond and his agreement, the surety was subrogated to all his rights, and that the subcontractor could not be placed in a better position than the contractor himself, and the surety’s right was that of subrogation and also that of an assignment, which right related back to the date of the principal’s default. Richards Brick Co. v. Rothwell, 18 App. Cas. D. C. 516, was a case in which the sureties on a contractor’s bond were held to have rights superior to those of the general creditors of *548the contractors. It was further held that a provision in the contract with the municipality by which the latter retained a sum sufficient in its discretion to pay all claims for work and material did not constitute such municipality a trustee for materialmen, or give them preference over other creditors in the distribution of the contract price of the work. In the opinion it was said:
“As held by all the authorities, it is only in cases where the person advancing the money to pay the debt of a third party stands in the situation of a surety, or is compelled to pay it to protect his own rights, that a court of equity will substitute him in place of the creditor, as matter of course, without any agreement to that effect.” (p. 541.)
Labbee v. Bernard, 196 Mass. 551, 82 N. E. 688, 14 L. R. A. 457, holds that one of several sureties on a contractor’s bond who, upon default, finishes the work can not compel contribution without permitting his cosureties to share in the proceeds. In First Nat. Bank of Madison v. School District, 77 Neb. 570, 110 N. W. 349, it was held under a clause almost like the one in the bond under consideration that the surety completing the contract does not stand in the position of assignee in reference to money in the hands of the owner and other moneys due or to become due, but as an original party to the trilateral contract. There the contractor borrowed $2000 from a bank to pay for labor and material required in the erection of the school building, which was used for that purpose, giving his note therefor, and giving to the bank an assignment of sufficient funds to pay such note, authorizing their payment. These orders were presented to the district and certain payments thereon made. Afterwards the contractor gave another bank an- order on the surety company for certain money as indemnity against loss, and later still an order for the remaining amount due from the school district. The court said (p. 575) that at the time of the two assignments there *549was a valid and existing contract between the contractor and the school district and that his rights thereunder were.assigned. It was held that the decree giving the surety company a first charge against the fund in controversy was right, and that the contract between the contractor and the school district and the surety bond became binding and effective at the same time, and the surety company’s relation to the fund was that of an original party and not that of an assigneei Lewis’ Admr. v. U. S. Fidelity & Guaranty Co., 144 Ky. 425, 138 S. W. 305, reaffirms, the familiar doctrine that a surety upon a distiller’s bond, upon payment to the United States, is subrogated to the rights of the government and is entitled to be subject to the property in lien to the government • to the satisfaction of his claim. The last case called to our attention is In re Scofield Co., 215 Fed. 45. There the surety on a government contractor’s • bond, who, after the contractor became bankrupt, settled certain labor and material claims remaining unpaid, and was thereby required to expend more than the amount retained by the government, was held entitled to such amount so retained in preference to the contractor’s general creditors. It was said that the surety company paid claims which it was the duty of the contracting company to pay and for which the surety company was bound under its suretyship; that when it assumed this obligation its equity at once began along with its liabilities. After citing the Prairie State Bank case and the Henningsen case it was said:
“These cases show that the equity of the surety who pays the debts arising under the contract will take precedence of any assignment of funds due from the government made by the contractor.” (p. 50.)
This case, however, must be determined by rules applicable to its own facts. The bank, in effect, paid and took over $2000 worth of labor and material claims, and the formality of giving Bortenlanger credit and *550taking his note is negligible. The contract price of the work, while not expressly alleged or shown, seems from the sum named in the bond to have been $27,500. The completion of the work cost $1354.60 more, or $28,854.60. Had these labor and material men retained their claims they would have been entitled to look to the city for their pro rata share of the contract price, but the city could not be held liable for more for it did not agree to pay more than the contract price. The excess is $1354.60, and it would not be fair or equitable for the bank to lose its entire claim or for the plaintiff to collect the full amount of its claim. The city, without authority and over the protest of the surety, paid the bank’s claim in full, and the surety company may rightfully look to it and to the bank for the difference between the $2000 and the pro rata portion thereof which would have been enforceable against the city by the original holders of the claims paid by the bank had they retained them. This amount can be ascertained if not readily agreed upon by the parties.
We have reached this conclusion after carefully considering the authorities referred to — being disposed to differ from those which might lead to a different result. The right of the plaintiff to step into the shoes of the contractor is fully recognized. Neither is it to be understood that he had authority to dispose of this right or to impair it by his assignment or order to the bank. But claims which the bank paid were not to be impaired or destroyed because of the surety’s relation to the work and to the fund provided by the city to pay therefor. Whoever furnishes labor or material must take his chances on the sufficiency of such fund or else be content to look to the contractor alone for payment. As to the city the bank took its chances, as the surety company took its chances with the contractor when it guaranteed his completion "of the contract. But as between the bank, the city and the surety, the natural promptings of fairness as well as the rules *551of equity dictate that neither should profit to the disadvantage of either of the others.
Subrogation is said to be the substitution of another person in the place of a creditor to whose rights such person succeeds.
“The doctrine is one of equity and benevolence, and like contribution and other similar equitable rights was adopted from the civil law, and its basis is the doing of complete, essential, and perfect justice between all the parties without regard to form, and its object is the prevention of injustice.” (37 Cyc. 363.)
“But the right of subrogation or of equitable assignment is not founded upon contract alone, nor upon the absence of contract, but is founded upon the facts and circumstances of the particular case and upon principles of natural justice; and generally, where it is equitable that a person furnishing money to pay a debt should be substituted for the creditor or in the place of the creditor, such person will be so substituted.” (Crippen v. Chappel, 35 Kan. 495, 499, 11 Pac. 453.)
(See, also, Safe Deposit Co. v. Thomas, 59 Kan. 470, 53 Pac. 472.)
The case is remanded with directions to modify the judgment in accordance herewith.