—This suit was brought against Louis Boley and others. After Boley’s death his executor was made a party defendant in his stead. The purpose of the suit is to have a mortgage held by Daniel decreed to be a first lien on property upon which Boley has a mortgage prior in time to Daniel’s mortgage, and for incidental relief. From a decree on the pleadings granting the relief, the defendants appealed.
It appears that one Waters mortgaged property described as Lot 4, Block 131 to Leslie E. Brooks to secure the payment of a note for $500.00; Brooks assigned the note and mortgage to a third party; Brooks acquired the property covered bjr the mortgage, and the note being past due Brooks borrowed $500.00 from Lee Daniel for the purpose of paying up the mortgage indebtedness, and executed to Lee Daniel a note for $500.00 with a mortgage on Lot 4 and the south five feet of Lot 5, Block 131. Lee Daniel made the loan and took the mortgage from Brooks “in the belief that there were no other liens on the property, and caused to be satisfied on record the first mortgage” given by Waters to Brooks. Leslie E. Brooks conveyed the property to Bessie B. Brooks, wife of Harry L. Brooks. After the execution of the mortgage from Waters to Leslie E. Brooks, “and while the same was subsisting and outstanding, the defendant Louis Boley, with *123full knowledge of the existence, of the” note and mortgage from Waters to Brooks, acquired a mortgage lien on the property which was duly recorded, but Lee Daniel “had no actual notice or knowledge thereof” when he took his mortgage, “and caused to be satisfied on record the first mortgage” from Waters to Brooks. At the time.Lee Daniel “made the loan aforesaid, it was understood and agreed between him and Brooks that he was to have a first lien on the property covered by said mortgage.” The question to be determined is whether Daniel is entitled to be subrogated to the rights of the first mortgagee whose mortgage was cancelled upon payment with money furnished by Daniel for that purpose.
Subrogation is the substitution of one person in the place of another with reference to a lawful claim or right. Subrogation arises by operation of law where one having a liability or a right or a fiduciary relation in- the premises pays a debt due by another under such circumstances that he is in equity entitled to the security or obligation held by the creditor whom he has paid.. This is called legal subrogation. Conventional subrogation depends upon a lawful contract and occurs where one having no interest in or relation to the matter pays the debt of another, and by agreement is entitled to the securities and rights of the creditor so paid. See Sheldon on Subrogation §§2, 140; Rice v. Winters, 45 Neb. 517, 63 N. W. Rep. 830; Watson v. Wilcox, 39 Wis. 643; Home Savings Bank v. Bierstadt, 168 Ill. 618, 48 N. E. Rep. 161, 61 Am. St. Rep. 146.
As Lee Daniel was under no obligation whatever to pay the note that was secured by the first mortgage 011 the property given by Waters to Brooks, and had no interest in or relation to the property, there can be no legal subrogation of Daniel to the rights of the holder of the first *124note and mortgage. If there can be a subrogation, it must be a conventional subrogation and based on an agreement of the parties that the first mortgage lien shall continue for the benefit of Daniel. An agreement between Daniel “and the mortgagors that he was to have a first lien on the property covered by said mortgage,” is not necessarily an agreement that the first mortgage lien shall remain in force for the benefit of Daniel. It is true the money loaned by Daniel was obtained and used “for the purpose of paying up the mortgage” which was superior to Boley’s mortgage; but as Daniel “had no actual notice or knowledge” of the second or Boley mortgage, he could not have contracted for a continuance of the first mortgage lien as having reference to Boley’s mortgage. The agreement between Boley “and the mortgagors that he was to have a first lien on the property covered by said mortgage,” was consistent with Daniel’s “belief that there were no other liens on the property,” and consistent with Daniel’s ac-. tion, under such belief when he “caused to be satisfied on record the first mortgage.” If Daniel had known of the Boley mortgage the cancellation of the record of the first mortgage would most probably have contained some reference to a reservation as against the Boley mortgage. Besides this the agreement as to “a first lien on the property covered by said mortgage,” relates to all the property in the mortgage, some of which, though a small part, was not in the first mortgage. Daniel had constructive notice by the record of Boley’s mortgage which is binding on Daniel.
The fact that a subsequent mortgagee’s lien will occupy the same relation to the property, if one who has advanced money, secured by a mortgage on the real estate, to pay off the prior mortgage, is subrogated to the rights of the holder of such first mortgage, affords no *125reason why equity should permit the party so advancing the money to be subrogated to the rights of the holder of the first mortgage.
When a first mortgage lien existing against real estate is paid off, the. lien of a second mortgage thereon becomes at once, by operation of law, a first lien on the property; and this first lien, and the right to enforce it as such, are vested rights.
Courts of equity will not apply the doctrine of subrogation where to do so would be to deprive a party of a legal right. Rice v. Winters, 45 Neb. 517, 63 N. W. Rep. 830; Ft. Dodge Bldg. & Loan Ass’n v. Scott, 86 Iowa 431, 53 N. W. Rep. 283; Kitchell v. Mudgett, 37 Mich. 81; Receivers of New Jersey Midland Ry. Co. v. Wortendyke, 27 N. J. Eq. 658; Holt v. Baker, 58 N. H. 276.
Being under no duty, legal or otherwise, to pay the first mortgage debts, Daniel is not entitled to a legal subrogation to the prior right that had existed in favor of the first mortgage holder. And not having shown an agreement that the lien of the first mortgage should be kept alive for his benefit, but it appearing merely that the agreement was for “a first lien on the property covered by” the last mortgage, which included other property besides that covered by the first mortgage, and that Daniel “in the belief that there were no other liens on the property caused to be satisfied on record the first mortgage,” there is no clear showing of a right to a conventional subrogation.
In Home Savings Bank v. Bierstadt, 168 Ill. 618, 48 N. E. Rep. 161, 61 Am. St. Rep. 146, the court said: “It is the agreement that the security shall be kept alive for the benefit of the person making the payment which gives the right of subrogation, because it takes away the character of a mere volunteer.” Here there was no agreement *126that the security of the first mortgage should be kept alive.
In Emmert v. Thompson, 49 Minn, 386, 52 N. W. Rep. 31, the court held under the peculiar facts that justice required the first security to be kept alive.
The conclusion here reached is not inconsistent with the decisions in Powers v. McKnight, — Tex. Civ. App. —, 73 S. W. Rep. 549; Farm Land Mortgage & Debenture Co. v. Elsbree, 55 Kan. 562, 40 Pac. Rep. 906; Banker’s Loan & Investment Co. v. Hornish, 94 Va. 608, 27 S. E. Rep. 459; Thompson v. Connecticut Mut. Life Ins. Co., 139 Ind. 325, 38 N. E. 796.
The decree is reversed.
Taylor, C. J., and Shackleford, Cockrell and Ellis, JJ., concur.