*368Opinion op the Court by
Judge Miller— Reversing.
In April, 1914, Harold A. Keith contracted with the Board of Drainage Commissioners of Henderson county to construct a ditch known as the Double Dam System. Keith was to be paid thirteen cents per cubic yard for earth removed, and the work was to be completed on or , before January 1, 1915. The contract further provided that Keith was to be paid in monthly installments of eighty per cent, of the contract price of the work done, as certified by the engineer -in charge, the first estimate to be made thirty days after work had begun. The remaining twenty per cent, of the contract price was to be paid when the work was completed and accepted by the engineer.
To insure the performance of his contract, Keith executed his bond to the board on April 13, 1914, in the sum of $9,234.00, with the appellant, the Illinois Surety Company, as surety thereon for the faithful performance of the contract.
One of the conditions of the bond, and the one material in the consideration of this case, reads as follows:
“If the said Principal shall fail to comply with any of the conditions of said contract to such an extent that the same shall be forfeited, or so declared by those authorized so to do, then said Surety shall have the right and privilege to assume the performance of said contract and to sublet or complete same, whichever said Surety may elect to do, and in any such event or events, said Surety shall be subrogated to all the rights and properties of said Principal arising out of said contract, and to any and all moneys and properties at that time due and payable, including deferred payments, and to all payments that may thereafter become due and payable to the said Principal under and by virtue of said contract.”
Keith began the work under his contract and continued it until March 6, 1915, when he abandoned the work and left the ■ state. On the same day — March 6, 1915 — the Illinois Surety Company took charge of the work and has since completed it. The Board of Drainage Commissioners paid Keith eighty per cent, of the contract price of the work he had performed, and retained twenty per cent, thereof, as provided by the contract. The retained twenty per cent, amounted to $1,903.25.
*369In March, 1915, the appellee, Mitchell, and six other creditors filed suits against Keith, and caused attachments to issue and be served upon the Board of Drainage Commissioners, as garnishee, upon the ground that Keith was a non-resident of Kentucky.
In completing the contract the Illinois Surety Company expended the sum of .$13,582.96; and, at the time of the trial in the circuit court it had paid out $12,714.14, the difference between these two sums being the retained percentage due certain sub-contractors which will be paid to them by the Illinois Surety Company on its final settlement with the Board of Drainage Commissioners. The net loss to the Illinois Surety Company, after charging it with the $1,903.25 retained percentage due Keith, will be $2,959.68; and if it does not receive that sum its net loss will be $4,862.93.
The several attachment suits having been ordered heard together, the Illinois Surety Company intervened and claimed the $1,903.25 retained percentage due upon the work completed by Keith before his departure, under the second clause of the contract, above quoted. The circuit court sustained a demurrer to the company’s intervening petition; and, that company having declined to further plead, the court adjudged that the Illinois Surety Company was entitled to no part of the $1,903.25 remaining in the hands of the Board of Drainage Commissioners, and dismissed its intervening petition. The judgment further sustained the grounds of attachment in the several suits by the creditors and subjected the $1,903.25 retained percentage to the satisfaction of their judgments. The Illinois Surety Company appeals.
It will be observed that this is a contest between Keith’s surety on the one hand and his attaching creditors on the other, who are claiming the same fund. Furthermore, it is not to be overlooked that Mitchell and the other attaching creditors, who are now appellees, did not proceed as sub-contractors to enforce liens under the statute, but sued as general creditors and obtained whatever liens they may now have by virtue of their attachments which are subsequent in time to the rights of the surety company. In their relation, therefore, to each other with respect to their conflicting claims upon the retained percentage, the surety company find Mitchell stand as contending assignees; and the question is, which has the superior claim?
*370That the contract constituted a valid equitable as..signment of the retained percentage, for the protection of the surety, and superior to the claims of the subsequent attaching creditors, there can be no doubt. Maize v. Bowman, 93 Ky. 205; Holt v. Thurman, 111 Ky. 84; Thompson’s Exr. v. Stiltz, 29 Ky. L. R. 1076, 96 S. W. 884; Lexington Brewing Co. v. Hamon, 155 Ky. 711; Moulder-Holcomb Co. v. Glasgow Cooperage Co., 173 Ky. 519.
While the precise question as to the superiority of these contending claims has never been before this court, many cases directly in point have been decided in other jurisdictions; and in every instance to which our attention has been called, with a possible single exception, the claim of the surety has prevailed. These decisions rest upon the equitable doctrine of subrogation, which is derived, and the term itself borrowed, from the Roman civil law. It is the substitution of a new for an old creditor, or, in its more general sense, the act of putting by a transfer, one person in the place of another/ or a thing in the place of another thing. By the transfer the substituted or new creditor is subrogated to all the rights of the original creditor.
The right of subrogation rests not upon contract, but upon the principles of natural justice. In Gadsden v. Brown, Speer’s Eq. 37, Chancellor Johnson said “the doctrine of subrogation is a pure, unmixed equity having its .foundation in the principles of natural justice”; and this remark has been at least twice cited with approval by the Supreme Court of the United States. Aetna Life Ins. Co. v. Middleport, 124 U. S. 547; Prairie State National Bank v. United States, 164 U. S. 231. This statement of the doctrine was substantially adopted by this court in Ft. Jefferson Improvement Co. v. Dupoyster, 112 Ky. 801.
There are, however, two definite limitations to the doctrine as above broadly stated: First, a surety is not entitled to subrogation until he has paid the debt; and, secondly, a volunteer is not so entitled.
A comprehensive classification of the cases in which the doctrine of subrogation may be applied is difficult; but in Wilkins v. Gibson, 113 Ga. 31, it was said that a subrogation will arise only in cases, (1) where the party claiming it has advanced money to pay a debt, which in the event of default by the debtor he would be bound to pay; or (2) where he had some interest to protect; *371or (3) where he advanced money under an agreement, expressed or implied, made either with the debtor or the creditor that he should be subrogated to the rights and remedies of the creditor.
In the case of In re Fowble, 213 Fed. 680, it was further said that a materialman cannot claim by subrogation because he has not paid a debt due to a third person. He must claim under the statute if he wishes to preserve his lien; otherwise he is a general creditor.
In Stehle v. United Surety Company, 107 Md. 470, the United Surety Company became surety for Jones, who had contracted to build a railroad for the Maryland Electric Railways Company. Stehle, a sub-contractor under Jones, caused an attachment to be served upon the Maryland Electric Railways Company, as' garnishee. In the Stehle case, as in this case, the contractor’s bond provided that in case the contractor abandoned the work, his surety should have the right to .complete it and receive the deferred payments; and all other money payable under the contract to the contractor should be paid to the surety in the same manner as they would have been paid to the principal if he had duly performed the contract.
Jones abandoned the work, leaving the sum of $439.57 owing to him from the Maryland Railways Company. The surety completed the work according to Jones’ contract at a loss, and claimed the $439.57 retained .in the hands of the railways company.
In the Stehle case, Jones’ written application for the bond contained this provision:
“And I do further agree in the event of any breach or default on my part of the provisions of the contract herein above mentioned, that the United Surety Company, as surety upon the aforesaid bond, shall be subrogated to all my rights and properties as principal in said contract, and that deferred payments, and any or all moneys and properties that may be clue 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 United Surety Company, under the bond above mentioned.”
Stehle instituted his attachment suit on August 16, 1906; and about a week after Jones had abandoned the work the surety company assumed the contract and took charge of the work in September of that year. So, the *372contest there, as here, was between the surety who had completed the work and an attaching creditor. It will thus be observed that in all material respects the Stehle • case is identical with the case at bar.
In giving the surety’s claim superiority over Stehle’s attachment claim the Court of Appeals of Maryland said:
“It is obvious then that the fund here in dispute is claimed on the one hand by the attaching creditor, the plaintiff below, as the sub-contractor of the defendant, Jones, and on the other by the claimant, the appellee company, who as surety on the defendant’s bond completed the original contract between the defendant and the railway company.
“The solution of the question, it seems to us, will be found in the contract itself, as evidenced by the provisions of the bond, agreed upon by the parties themselves. The bond stipulates that if the principal shall voluntarily abandon the contract, as was confessedly done in this case, then the surety shall have the right in its option to assume the contract and to sublet or complete the same, and if said contract shall be assumed by the surety, then as such contract is duly performed, any reserve, deferred payments and all other moneys provided by the contract to be paid to the principal shall be paid to the surety at the same time and under the same conditions as by the terms thereof such moneys would have been paid to the principal, had the contract been duly performed by him.
“Now, according to the uneontradicted testimony the fund in question was due and payable at the time the contract was abandoned, and it is clear that upon the assumption by the appellee company of the contract and the completion of the work, all of the property and credits of the defendant under the contract passed to the surety company by express assignment to the appellee under the terms of the bond herein set out.
“Manifestly, the defendant, Jones, who abandoned the contract, could assert no title to the fund in dispute, because by the express terms of the bond, and aecording to the provisions of the agreement executed by him at the time of his application, he stipulated that upon his default the appellee company should be subrogated to all his rights and properties, as principal in the contract. It is difficult to see upon what legal or equitable principle the plaintiff as sub-contractor under Jones, *373could be placed in a better position as to this fund than the defendant himself, under whom he claims. Obviously, Jones, under the admitted facts, could not set up or claim title to" the fund because by the express terms of the contract, upon the default and the assumption of the contract by the appellee, the title to all credits, securities, etc., vested in the appellee.
“The right of the surety in this case is. not only that of subrogation pure and simple, but a right to an assignment by the creditor, under the plain provisions of the contract of suretyship between the parties.
“The principle of subrogation, assignment and substitution, as applied to those standing in the relation of principal debtor and surety, has been fully reviewed by this court, in a number of cases. In Orem, Ex’x v. Wrightson, 51 Md. 34, this court said, so soon as a surety pays the debt of the principal debtor, equity subrogates him to the place of the creditor and gives him every right, lien and security to which the creditor could have resorted for the payment of his debt. As between the principal debtor and the surety, it is in the nature of a purchase, by the surety from the creditor. It operates an assignment in equity of the debt and all legal proceedings upon it, and gives a right in equity to call for an assignment of all securities, and in favor, of the surety, the debt, and all its obligations and incidents are considered as still subsisting. Brandt on Suretyship, etc., vol. 1, p. 611; Stump v. Warfield, 104 Md. 530.
“In the present case, the right of the surety company to the fund relates back to the date of the default by the defendant, and cannot be defeated by the defenses sought to be invoked on behalf of the plaintiff. Nally v. Long, 56 Md. 567. . . .
“We, therefore, hold, according to the express contract of suretyship between the parties in this case, and upon the well settled doctrine of subrogation and substitution, applicable to the case, that the appellee company is entitled to the fund here in question. There was no error in the rejection of the plaintiff’s prayer, and as we approve of the finding of the court below, the judgment will be affirmed.”
The question again, arose in the leading case of Prairie State National Bank v. United States, 164 U. S. 227. In that case Sundberg & Company contracted to build a custom house for the Federal Government at Galveston, Texas, with Hitchcock as surety on their bond for the *374faithful performance of their contract. The contract provided that ninety per cent, of the price of the work executed by Sundberg & Company should be paid to that firm in monthly payments, and, that the remaining ten per cent, should be retained by the United States until the completion of the work.
In consideration of the advances made and to be made to Sundberg & Company by the Prairie State National Bank, Sundberg & Company, on February 3, 1890, gave the bank an order or power of attorney to collect and receive from the United States the ten per cent, retained by it, as above stated. In May, 1890, Sundberg & Company defaulted, and Hitchcock, as surety, completed the work under Sundberg & Company’s contract. There was, however, no formal assignment or contract giving Hitchcock the retained percentage in case of Sundberg & Company’s failure and Hitchcock’s completion of the work. The contract was the usual one in which the surety covenanted for the faithful performance of the work by its principal, and Hitchcock claimed under the principle of subrogation, unaided by any assignment from his principal. The bank asserted a lien which it claimed originated in February, 1890, and for that reason was superior to Hitchcock’s lien, which, it was asserted, subsequently arose at the date of his payments in the completion of the road. On the other hand, Hitchcock claimed that his equity arose at the time he entered into the contract of suretyship, and, therefore, that his right to the fund was prior in date and paramount in character to the assignment of the bank.
In sustaining Hitchcock’s contention the court, through Mr. Justice White, said:
“That Hitchcock, as surety on the original contract, was entitled to assert the equitable doctrine of subrogation is elementary. That doctrine is derived from the civil law, and its requirements are, as stated in Aetna Life Insurance Company v. Middleport, 124 U. S. 534: ‘1, that the person seeking its benefits must have paid a debt due to a third party 'before he can be substituted to that party’s rights; and, 2, that in doing this he must not act as a mere volunteer, but on compulsion, to save himself from loss by reason of a superior lien or claim on the part of the person to whom he pays the debt, as in cases of sureties, prior mortgages, etc. The right is never accorded in equity to one who is a mere volunteer in paying a debt of one person to another. ’ . . . Un*375der the principles thus governing subrogation, it is clear whilst Hitchcock was entitled to subrogation, the bank was not. The former in making his payments discharged an obligation due by Sundberg for the performance of-which he, Hitchcock, was bound under the obligation of his suretyship. 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. The sole question, therefore, is whether the equitable lien, which the bank claims it has, without reference to the question of its subrogation, is paramount to the right of subrogation which unquestionably exists in favor of Hitchcock. In other words, the rights of the parties depend upon whether Hitchcock’s subrogation must be considered as arising from and relating back to the date of the original contract, or as taking its origin solely from the date of the advance by him.
“A great deal of confusion has arisen in the case by treating Hitchcock as subrogated merely ‘in the rights of Sundberg & Co. ’ in the fund, which, in effect, was saying that he was subrogated to no rights whatever. Hitchcock’s right of subrogation, when it became capable of enforcement, was a right to resort to the securities and remedies which the creditor (the United States) was capable of asserting against its debtor, Sundberg & Company, had the security not satisfied the obligation of the contractors, and one of such remedies was the right based upon the original contract to appropriate the ten per cent, retained in its hands. If the United States had been compelled to complete the work, its right to forfeit the ten per cent, and apply the accumulations in reduction of the damage sustained remained. The right of Hitchcock to subrogation, therefore, would clearly entitle him when, as surety, he fulfilled the obligation of Sundberg & Company to the government, to be substituted to the rights which the United States might have asserted against the fund. It would hardly be claimed that if the sureties had failed to avail themselves of the privilege of completing the work, they would not be entitled to a credit of the ten per cent, reserved in reduction of the excess of cost to the government in completing the work beyond the sum actually paid to the contractor, irrespective of the source from which the contractor had obtained the material and labor which went into the building.”
After an extended review of the authorities the court said:
*376“Applying the principles, which are so clearly settled by the foregoing authorities, to the case at 'bar, it is manifest that if the transaction in February, 1890, by which the Prairie Bank acquired its alleged lien on the fund possessed the effect contended for by the bank, it would necessarily operate to alter and impair rights acquired by the surety under the original contract.
“Sundberg & Company could not transfer to the bank any greater rights in the fund than they themselves possessed; their rights were subordinate to those of the United States and the sureties. Depending, therefore, solely upon rights claimed to have been derived in February, 1890, by express contract with Sundberg & Company, it necessarily results that the equity, if any, acquired by the Prairie Bank in the ten per cent, fund then .in existence and thereafter to arise was subordinate to the equity which had, in May,-1888, arisen in favor of the surety Hitchcock. It follows that the Court of Claims did not err in holding Hitchcock was entitled to the fund, and its judgment is therefore affirmed.”
The question arose, and was discussed at length, in the late case of Fidelity & Deposit Company of Maryland v. City of Stafford, 93 Kan. 539. In that case Bortenlanger contracted with the city of Stafford for the construction of a waterworks system and electric, light plant, with the Fidelity & Deposit Company of Maryland as surety upon his bond. The bond contained the usual provision that if the principal should voluntarily abandon the contract the surety should have the right to complete the work, and in case the surety should complete the work the deferred payments provided by the contract to be paid to the principal, should be paid to the surety.
The bond was executed January 30, 1911; but before that date Bortenlanger executed and delivered to the Deposit Company a writing providing, that in case of his breach or default that company should be subrogated to all of his rights under the contract, and that any deferred payments due him thereunder should be credited upon any claim that might be made against the Fidelity & Deposit Company of Maryland under its bond as surety.,
Bortenlanger abandoned his contract about September 15, 1911, whereupon the Deposit Company assumed the contract and completed the work in October of that year. On April 15, 1911, however, the Farmers National Bank of Stafford had loaned Bortenlanger $2,000.00, and he had then'executed and delivered *to that bank an order *377or assignment for $2,000.00 upon the city and directed it to pay the bank that sum out of any funds due or becoming due to him from the city under his.contract. The city paid the $2,000.00 to the bank on November 4, 1911, over the objection of the Deposit Company. The $2,000:Q0 loaned to Bortenlanger by the bank was used by him'in paying for material and labor in the performance of his contract with the city and was loaned by the bank to Bortenlanger for that purpose alone.
In the circuit court the Deposit Company obtained a judgment for the full amount claimed by it. The city and the bank appealed, the sole point upon the appeal being the effect of the arrangement made by Bortenlanger with the bank insofar as it affected the rights of the Deposit Company.
In modifying the judgment to the extent that it gave the Deposit Company the entire retained percentage instead of only its pro rata share thereof, and recognizing the surety’s right of subrogation, the Supreme Court of Kansas said:
“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 would 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 $2,000.00 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, lien-able 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 court announced the broad doctrine that subrogation is not for the stranger or volunteer, but only for one who is already bound; and, in support of its conclusion the court cited Aetna Life Insurance Company v. Middle-port, 124 U. S. 534.; Prairie State National Bank v. United State, supra; Henningsen v. U. S. Fidelity & *378Guaranty Company, 208 U. S. 404; Hardaway v. National Surety Company, 211 U. S. 552; First National Bank v. City Trust Safe Deposit and Surety Company, 114 Fed. 529, 52 C. C. A. 313; Union Stone Company v. Freeholders of Hudson County, 71 N. J. Eq. 657; Stehle v. United Surety Co., supra; First National Bank of Madison v. School District, 77 Neb. 570; and In re Scofield, 215 Fed. 45. To the same effect see St. Peter’s Catholic Church v. Vannote, 66 N. J. Eq. 78; Labbe v. Barnard, 196 Mass. 553, 14 L. R. A. (N. S.) 459, with note; U. S. Rundle, 107 Fed. 227, 46 C. C. A. 450, 52 L. R. A. 505; Reid v. Pauly, 121 Fed. 652; Title Guaranty & Security Co. v. Dutcher, 203 Fed. 167; In re Fowble, 213 Fed. 680; Fidelity & Deposit Co. v. Merchants & Farmers Bank, 120 Ark. 519; Fulton National Bank v. Fulton County, 144 Ga. 693; Gastonia v. McEntee-Peterson Engr. Co. 131 N. C. 359; First National Bank v. Pesha, 99 Neb. 785.
An examination of these cases shows that wherever a. surety’s claim to a retained percentage came in conflict with the claim óf a mere creditor who was not a lien holder, the claim of the surety prevailed; and, that an attempt by the creditor to obtain a preference by means of an attachment suit could avail him nothing.
Thus, in Henningsen v. U. S. F. & G. Co., supra, the surety of the contractor who had undertaken the construction of a government building was held to have a claim to the sums due the contractor from the government superior to the claims of a bank under an assignment from the contractor to secure the payment of money loaned to him. Likewise, in Hardaway v. National Surety Co., supra, the company, as surety, covenanted that the contractors would make full payment to all those supplying labor and material; and, after the work was begun the contractors agreed with Coyne that he would make all purchases in his own name and receive "all profits from the contract. Coyne made a contract with Hard-away by which the latter undertook to complete the work and take over the sums due from the government for the lock and dam. Under these facts it was held that Hardaway was not a sub-contractor; that he was merely working under the agreement by which he took an assignment, and that his claim was inferior to the rights of the surety.
Again, in First National Bank v. City Trust Safe Deposit & Security Company, supra, it was held that a surety who completed the work after its abandonment by *379the principal, was subrogated, so far as it might be necessary to protect him from loss, to the rights which the city might have had against the contractor, had it completed the work itself, and that the surety’s rights were superior to those of a bank which had loaned the contractor money prior to the abandonment of the contract upon an assignment from the contractor of the money due him from the city.
"While the precise question now under consideration was not there decided, this court in Commissioners of Sewerage of Louisville v. Gates, 159 Ky. 397, fully recognized the rule laid down in Prairie State National Bank v. United States, 164 U. S. 228, and in Henningsen v. U. S. F. & G. Co., 208 U. S. 404, by citing those cases and saying, “as to the amounts retained during the course of construction, there can be no doubt that the surety, by right of subrogation, if nothing more, has a prior equity.” The court held, however, that the rule thus recognized did not apply under the facts of the Gates case.
We have been cited to no authority, directly in point, to the contrary. The only jurisdiction in which a doubt has been cast upon this thoroughly established doctrine is the Supreme Court of the state of Washington, and it has dissented in part only, by making a distinction between money due and money to become due, in such cases. Dowling v. City of Seattle, 22 Wash. 592, 61 Pac. 709, relied on as sustaining the claim of the appellees, does not go that far, and the later cases of that court seem inclined to consider the question still an open one in that jurisdiction. See Puget Sound S. S. B. v. Gallucci, 82 Wash. 445, Ann. Cas. 1916A, 767; Maryland Casualty Co. v. Washington National Bank (Wash.), 159 Pac. 690.
This case presents only an application of the well-established elementary rule, that the surety, in this case under his contract, will be placed in the shoes of his principal whenever he performs the principal’s contract, and that the rights of a general creditor will not be permitted to impair a prior contract between the principal- and his surety, in such a case. If this were not true no surety could make a contract by which he could protect himself. His right to make a contract of'indemnity accompanied the right to make the contract of suretyship.
This contract was made for the protection of Keith as well as for the protection of the Board of Drainage Commissioners, The board had the right to call upon *380the surety company to perform its part of the contract, and, it equally had. the right to require the Board of Drainage Commissioners to perform its part, one provision being that it should pay the retained percentage to the surety in case it performed the contract by completing the work upon Keith’s default. The Board of Drainage Commissioners could hold the surety company to its contract only by strictly complying with, the contract; any deviation from it would have released the appellant from liability. Prairie State National Bank y. United States, supra. The contract was valid; and when the surety performed its contract it had the right to demand a full compliance therewith, by every party to it.
• The judgment of the circuit court is reversed and the action is remanded with instructions to set aside the judgment; to overrule the demurrer to the answer of the Illinois Surety Company, and for further proceedings consistent with this opinion.