This case comes to us upon an agreed statement of facts which we shall epitomize. Respondent H. S. Martin was a contractor engaged in building houses. He and his wife, Ellen Martin, were the owners of property described as lots 1, & and 3, block 57, Salmon ,Bay Park addition to the city of Seattle. The property had been mortgaged to respondent Conrad Johnson. Thereafter Martin entered into a contract to build a dwelling house for the appellant J. S. Elliott in consideration of the sum of $7,800, and agreed to pay for the labor and material and to deliver the premises free and clear of all liens and claims of whatsoever nature arising or growing out of his contract. Martin gave Elliott a bond in the penal sum of $4,000, “conditioned that the said H. S. Martin would erect the said building for the said J. S. Elliott, according to the plans and specifications, and fully perform his contract in all respects.” This bond was signed by the appellant The United Surety Company, as surety. To secure the surety company against any loss or damage it might suffer on account of the Elliott bond or on account of any other bond that it might thereafter enter into as surety, Martin and his wife executed a trust deed, the recitals and conditions of the deed being as follows:
“To have and to hold the same unto said grantee as joint tenants, with the right of survivorship, their successors and assigns in trust to secure The United Surety Company, a Maryland corporation, against any and all damages or loss (including a reasonable attorney’s fee), which the said United Surety Company may sustain by reason of having executed or executing in the future at the request or for the benefit of Hans S. Martin any undertaking or contracts of suretyship. . . . Any and all loss or damage which the United Surety Company may suffer by reason of the undertakings or contracts of suretyship executed by it for the benefit or at the request of Hans S. Martin shall immediately become due and payable to the said company without demand, and the amount of such loss or damage shall become fixed as the amount secured by these presents, to*366gether with a reasonable sum as attorney’s fees. But if all indebtedness due to United Surety Company on account of loss or damage suffered by it on account of such undertakings or contracts of suretyship shall be paid by the parties primarily responsible therefor, without demand, and said trustees or the survivor of them, their successors and assigns shall reconvey all the premises and estate derived hereunder unto the said grantors, their heirs and assigns at their request and cost. But if default be made in the payment of any of said indebtedness when due and payable or in the performance of any of the covenants herein, then, upon request of said United Surety Company or its assigns, said trustee or the survivor of them, their successors and assigns, are hereby empowered to sell for United States gold coin, the granted premises and estate or such part or parts or part at one time and part at another, and so on as in his or their discretion shall be deemed best in the manner following.”
Martin entered into the performance of his contract, but defaulted, and Elliott was compelled to pay lien claims aggregating $2,034.34. Elliott also obtained a judgment against Martin for $403.63, for failure to complete the building according to the plans and specifications. In defending the lien claims in the superior and in the supreme court, Elliott expended by way of court costs, the sum of $245.65, and paid attorney’s fees aggregating $750. Johnson, the mortgagee, thereafter began suit to foreclose his mortgage. The Elliotts and the receiver of the surety company, which had become insolvent, were brought in as parties, and the present controversy is waged between them and the Martins.
It is the contention of the appellants that Elliott and wife are entitled to a substitution and to be subrogated to the security held by the surety company and to the benefits of its contract as evidenced by the deed of trust.
The contention of respondent may be briefly stated. It is, that the contract between Martin and the surety com*367pany is personal to the parties; that the condition of their contract as evidenced by the trust deed is that the property should stand in satisfaction only of “any loss or damage” suffered by the surety company on account of its undértaking; that it has suffered no “loss or damage” as distinguished from a liability; that it is now insolvent and unable to meet the penalty of the bond, and therefore no cause of action has been stated or can be stated by the Elliotts, under the rule announced in Puget Sound Imp. Co. v. Frankfort etc. Ins. Co., 52 Wash. 124, 100 Pac. 190; Sheard v. United States Fidelity & Guaranty Co., 58 Wash. 29, 107 Pac. 1024, 109 Pac. 276; Ford v. Aetna Life Ins. Co., 70 Wash. 29, 126 Pac. 69.
These cases were all actions at law brought against an indemnitor and were correctly decided upon the theory that there was no privity, and hence could be no recovery under a strict interpretation of the obligation assumed. The indemnitor was the party defendant. No loss or damage had been suffered, or the company had terminated its contract. The suit was on the bond alone. Here the surety or its receiver is not contesting. It could not raise that issue. Its bond is conditioned for the “faithful performance of the building contract.” It is not an indemnity bond. It says nothing about “loss or damage.” This suit is not primarily a suit upon the trust deed. It is against Martin and the surety upon his bond, which is an undertaking on the part of Martin and the surety company to pay in any event.
The question, then, is whether a contract collateral to a direct promise to pay will inure to the benefit of the principal creditor, he having suffered a loss growing out of a breach of the original contract — a contract to build a house free of lien and according to plans and specifications. The question whether the surety company might successfully defend an action on the ground that it was insolvent and could *368not suffer a “loss or damage” is not involved. We are to inquire whether equity will permit Martin to defeat his contract by resorting to a technical defense reserved by his surety, not against the Elliotts, but against him, for its own benefit, or whether it will take the parties as they were at the outset and do what they intended to do. Martin intended to build a house according to the plans and specifications and free of lien. If he did not he expected and'intended that his trustee should pay the loss out of his own property. The only thing standing in the way of the due execution of the contract is a competent trustee. It is a primary rule that equity will not permit a trust to fail for the want of a trustee.
The features which distinguish the cases cited from the case at bar may be illustrated by reference to the Ford case. It is typical of the three cases and of the authorities cited in the several opinions. A recovery was denied upon the theory that there was no privity between the indemnitor and the party plaintiff. The contract did not extend either in law or in equity to a tort or contract creditor of the insured party. The indemnifying company was a stranger to the plaintiff in each and every case; while here there is a tie of privity between the surety company and the principal creditors, the Elliotts, in virtue of the bond and the trust deed which was given to sustain the liability assumed by the company and but for which we may assume it would not have signed the bond to answer for the default of Martin. We may further assume that the Elliotts would not have entered into a contract with the Martins if Martin had not executed the bond, and we may assume that the surety would not have engaged as a bondsman if it had not been secured. With these assumptions before us, equity will not allow the Martins to say their obligation is not good when resort to the substance of the whole transaction is necessary to keep it whole. There is nothing in the cases demanding it, nor would we, in the absence of controlling principles of law or *369equity, extend the doctrine of the cases relied on to the extent of destroying a security given by the Martins to secure their unqualified promise.
Under well settled authority, a principal creditor may subject any security held by a surety upon the principal obligation to the payment of his debt. The earliest expression of the rule which we have noted is found in Maure v. Harrison, cited in 1 Eq. Cas. Abr. (Eng.) 93:
“A bond creditor shall, in this court, have the benefit of all counterbond's or collateral security given by the principal to the surety; as if A owes B money, and he and C are bound for it, and A gives C a mortgage or bond to indemnify him, B shall have the benefit of it to recover his debt.”
The more modern doctrine is well stated by the court of errors and appeals of New Jersey in the case of Demott v. Stockton Paper Ware Mfg. Co., 32 N. J. Eq. 124, where it is said:
“As a general rule, where a surety or a person standing in the situation of a surety for the payment of a debt, receives security for his indemnity and to discharge such indebtedness, the principal creditor is in equity entitled to the full benefit of that security; and it makes no difference that such principal creditor did not act upon the credit of such security in the first instance. And the right of the creditor is the same when the security is a mortgage, of other lien given to the surety by the principal after the principal and surety have both become bound, even though there may have been no previous agreement that indemnity should be given; and to entitle the creditor to enforce this right in equity, it is not necessary that he should have exhausted his remedies at law or have reduced his debt to judgment.”
See, also, Brandt, Suretyship (3d ed.), § 1419; Vail v. Foster, 4 N. Y. 312.
In Hampton v. Phipps, 108 U. S. 260, the court found a state of facts which fell within an exception to the rule, which it states as follows:
“Many sufficient maxims of the law conspire to justify the rule. To avoid circuity and multiplicity of actions; to *370prevent the exercise of one’s right from interfering with the rights of others; to treat that as done which ought to be done; to require that the burden shall be borne by him for whose advantage it has been assumed; and to secure equality among those equally obliged and benefited, are perhaps not all the familiar adages which may legitimately be assigned in support of it. It is, in fact, a natural and necessary equity which flows from the relation of the parties, and though not the result of a contract, is nevertheless the execution of their intentions. For, when a debtor, who has given personal guaranties for the performance of his obligation, has further secured it by a pledge in the hands of his creditor, or an indemnity in those of his surety, it is conformable to the presumed intent of all the parties to the arrangement, that the fund so appropriated shall be administered as a trust for all the purposes, which a payment of the debt will accomplish; and a court of equity accordingly will give to it this effect. All this, it is to be observed, as the rule verbally requires, presupposes that the fund specifically pledged and sought to be primarily applied, is the property of the debtor, primarily liable for the payment of the debt; and it is because it is so, that equity impresses upon it the trust, which requires that it shall be appropriated to the satisfaction of the creditor, the exoneration of the surety, and the discharge of the debtor. The implication is, that a pledge made expressly to one is in trust for. another, because the relation between the parties is such that that construction of the transaction best effectuates the express purpose for which it was made.”
The same doctrine is announced in the case of Swift & Co. v. Kortrecht, 112 Fed. 709. In the case of Meeker v. Waldron, 62 Neb. 689, 87 N. W. 539, the same defense was made as here, that a mortgage executed in favor of a surety was given to indemnify the surety personally and until he had suffered some loss or damage, no right of action could accrue and in no event could the creditors of defendant maintain an action when no payment had been made or loss suffered by the surety to whom the mortgage had been given as an indemnity. Both the principal and the surety had become insolvent. The court said:
*371“Under well settled and recognized principles of equity it seems quite clear that the lien of the mortgage on this property is ultimately for the benefit of the holders of the original indebtedness, who, in a proper case, should be adjudged entitled to subrogation to the rights of the surety. When the surety is insolvent, as in this case, or for failure otherwise to discharge the legal obligation he had assumed, it would seem the equitable principle of subrogation could be invoked. The object and purpose of the chattel mortgage to be finally accomplished was to secure payment of the principal indebtedness by the mortgagor, who was primarily liable therefor. It was his obligation, and to secure its satisfaction out of his own means as the one on whom the obligation first rested, he entered into the contract with his surety whereby the mortgage was executed so that in case he did not satisfy the debt and the surety was compelled to, recourse could be had to the collateral security. The payment by the surety of the debt would not cancel it as to the principal debtor, who yet would remain liable for its satisfaction out of his own property. Had the principal creditors possessed collateral security and the personal surety had paid the indebtedness it would hardly be doubted that he would be entitled to be subrogated to the rights of the creditors to such collateral security; and on a parity of reasoning, we can see no difference in principle as to the right of the principal creditors to be subrogated to the rights of the surety upon his inability or failure to respond to his obligation.”
This case was followed in Harlan, County v. Whitney, 65 Neb. 105, 90 N. W. 993, 101 Am. St. 610, where the court said:
“Ezra S. Whitney, as treasurer of the county of Harlan, had given the required bond, with several sureties, for due performance of the duties of his office. Toward the end of his term a suspicion arose that he. was short in his accounts. Thereupon, in order to indemnify said sureties, he and his wife executed a deed conveying the lands in controversy to one Roberts as trustee, reciting expressly that he was trustee for the sureties on said Whitney’s official bond. A shortage having occurred as anticipated, the successor of the trustee conveyed said property to the county, which brought this suit, alleging that the deed was intended as a mortgage to *372secure said sureties and the county against loss, and praying foreclosure. A decree was rendered accordingly, from which this appeal has been taken.
“It is argued that there is no evidence to sustain the decree because the proof shows clearly that said conveyance was intended to secure the sureties only, and that there is no evidence in support of the allegation that it was intended for security of the county as well, nor is it shown that the sureties have paid the amount due on the bond. But it is elementary that a creditor is entitled to enforce for his own benefit any securities which the principal debtor has given his surety by way of indemnity. In equity, such securities are considered as held by the surety in trust for payment of the principal obligation. In a sense they belong to the creditor, and proof that they were given to indemnify the surety would be sufficient to support the allegation that they were given for further security of the creditor, if such an allegation were necessary. Blair State Bank v. Stewart, 57 Nebr. 58, 63; Longfellow v. Barnard, 58 Nebr. 612, 617. In the latter case it was held that a mortgage given to indemnify a surety or guarantor is in legal effect a security to the owner of the debt, even though he did not originally rely on it or know of its existence. It follows that when the sureties, through their trustee, assigned the security to the county by conveyance of the land, the county could enforce it, although the sureties might not have done so themselves without first discharging the obligation. The security is regarded as given for discharge of that obligation, and must be applied thereon, either directly, or by satisfying those who have discharged it. Equity does not insist upon the circuitous procedure of payment by the sureties and enforcement by them. It looks to the substance, and will permit or even require an application upon the debt directly at suit of the creditor. ...
“We are unable to see any reason why, after default in the conditions of such bond, the county may not take advantage of securities given by the treasurer to the sureties thereon, whether by way of suit for subrogation or by procuring an assignment from the sureties, as any other creditor might do.”
See, also, Whitehead v. Henderson, 67 Ark. 200, 56 S. W. 1065.
*373The real controversy being between Martin and the Elliotts, their rights are to be determined by reference to the building contract and bond which is a promise to pay in any event. The stipulations in the trust deed are for the benefit of the surety ,and it is not resisting the execution of the trust.
In Brown & Haywood Co. v. Ligon, 92 Fed. 851, the defense was “that the bond sued on is one of mere indemnity, and that the obligees in the bond are not shown to have been actually damnified.” The court had resort to and construed the primary obligation, which was a building bond, and found that the surety had become a surety for the performance of all the “covenants and conditions of the building contract.” It was held:
“That the bond sued on is, in effect, an agreement that Long shall carry out the terms of his contract with Pierce county, including the payment of subcontractors for all materials furnished by them, and used in the construction of the court house and jail in question. It is also an agreement to save Addison, and the others who were sureties on Long’s bond, harmless from the obligation and liability which they had assumed as sureties on that bond, and, in addition thereto, is an agreement to save Addison and others harmless from actions, cost, and damages. Such being the condition of the bond, it is more than a bond for indemnity, and the actual payment of the judgments obtained by the Brown & Haywood Company and others against Addison and others is not a necessary prerequisite to liability of defendants in this action. Johnson v. Risk, 137 U. S. 300, 11 Sup. Ct. 111; Bank v. Leyser, 116 Mo. 51, 22 S. W. 504; Locke v. Homer, 131 Mass. 93; Farnsworth v. Boardman, Id. 115; Shattuck v. Adams, 136 Mass. 34; Conner v. Reeves, 103 N. Y. 527, 9 N. E. 439; Jones v. Childs, 8 Nev. 121. . . . If the complainants Addison and others could have recovered, the case clearly falls within the principle entitling the complainant the Brown & Haywood Company to be subrogated to the rights of Addison and others. The defendants’ underwriting bond is a security taken by the Brown & Haywood Company’s debtors, Addison and others, *374which, by reason of their insolvency, the Brown & Haywood Company is entitled to resort to, as an equitable asset, to satisfy its demands against its principal debtor.”
In so holding, the court did no more than to apply the maxim that equity will do that which ought to be done. This case being between the principal debtor and the creditor on the contract and the bond, it can make no difference whether the surety has discharged its obligation (suffered loss or damage) or not, for equity will treat it as discharged in virtue of the insolvency of the surety and. will make all assets in its hands available for the discharge of the principal debt. Nor does it make any difference whether the principal creditor knew of the contract of indemnity between the principal debtor and the surety. Keller v. Ashford, 133 U. S. 610; Curtis v. Tyler & Allen, 9 Paige Ch. 431.
To state the proposition in another way, if the surety company were solvent and able to respond, the Elliotts would have a right of action against the surety company on its bond, and could compel the company to use the trust property to satisfy the bond. Under the present state of facts, the Elliotts being creditors of the surety company, are entitled to take the assets in its hands and apply them to the discharge of the specific obligations which it assumed when it signed the bond and which it would be called upon to pay but for its insolvency. To hold otherwise would be to say that a surety who held property in trust to meet a debtor’s obligation to another could discharge its obligation of suretyship by becoming insolvent. It would seem to be reasoning in a circle to say that, because the surety company became insolvent and unable to pay its obligation and has neglected to perform its contract, the creditor cannot assume directly and at once the same legal position that he might have taken if the surety company were solvent and contesting his claim. The sum of the authorities may be stated thus: Equity will seize upon and execute a trust when derelict between a principal debtor and his creditor, *375when the subject-matter of the trust has been pledged by the debtor to meet a specific obligation that the debtor is primarily obligated to pay and but for which the trust would not have been created,
“upon the ground that the surety, being the creditor’s debtor, and in fact occupying the relation of surety to another person, has received from that person an obligation or security for the payment of the debt, which a court of equity will therefore compel to be applied to that purpose at the suit of the creditor.” Keller v. Ashford, supra.
But it is said that there can be no subrogation for the reason that subrogation, although it does not rest upon contract, always grows out of contract, and that contracts will not be distorted so as to admit subrogation in the absence of a clear expression of intention; that there is no privity of contract between the Elliotts and the Martins of which the property now sought to be charged is the subject-matter. We have already shown by reference to the authorities that equity charges the property upon the theory that there is a privity, and, where this is so, the contract of the surety ought to be performed; that equity has done or will do what the surety has engaged itself to do, which in this case was to apply the property held by it to the satisfaction of any loss that might occur to the Elliotts by reason of their contract with Martin.
The supreme court of this state has taken its stand with those courts which have declared that the right of subrogation will be allowed when the equities of the case demand it. Murray v. O’Brien, 56 Wash. 361, 105 Pac. 840, 28 L. R. A. (N. S.) 998. Martin executed a bond with surety as a condition precedent to the building contract. His obligation in equity is no more or less than his contract obligation to save the other contracting party harmless. The ultimate object and purpose of the Martins’ trust deed was to save the Elliotts as well as the surety company harmless; to pay their debt, if any, out of their own property. They pledged it for *376that purpose, and equity, having jurisdiction of the parties and the subject-matter, will reach out and apply the trust fund to the ultimate purposes of the trust.
There is some suggestion that Martin entered into another contract which may have fallen under the protection of the trust deed. Whatever the fact may be, we are of opinion that the rights of the Elliotts would not be entirely defeated. They might be subjected to a marshaling of the assets in the event that a claim is made upon the receiver, but with that contingency neither this court nor the respondent Martin have anything to do at the present time.
The judgment of the lower court is reversed, with directions to enter such decree as will protect the interest of the appellants Elliott and the receiver in the trust property, subject, however, to the lien of the Johnson mortgage.
Crow, C. J., Parker, Gose, and Morris, JJ., concur.