The opinion of the court was delivered by
Beasley, C. J.This bill was filed to foreclose a certain mortgage given by the respondent to the appellant. There was no dispute with respect to the mortgage or of its being the first lien upon the property, and following this encumbrance were mortgages and judgments, all of which were admitted to be valid.
*647The contested- point was this: The. holder of the second mortgage set up in his answer, and contended, that he had made certain payments on the mortgage of the appellant, who was the complainant in the court of chancery, under a contract by parol with that company that it would release “ as much of the land embraced in its mortgage in proportion to the amount paid or which should thereafter be paid.”
That certain sums of money were paid by the second mortgagee on the first mortgage seems to be clear in the proofs, and the vice-chancellor who heard the case- decided that the contract above staled had been, as a matter of fact, entered into, but further holding that, as it did not specify any particular part or parcel of land to be released, it was not capable of performance by a court of equity. Notwithstanding this conclusion, it has been decreed that the moneys thus paid by the second mortgagee to the appellant should be deducted from the amount that'shall be realized by a sale under the first mortgage. The theory suggested justifying such a course was that this money had been paid under circumstances that would “ make ,it recoverable in an action at law as for money had and received.”
But, in the opinion of this court, the decree thus rendered on the ground mentioned cannot be sustained. A money claim of the kind described has not the least connection with the foreclosure, and, therefore, could not enter into that proceeding. It would be a settlement of an independent money account between two defendants in a foreclosure bill, and could not constitute any lien upon the mortgaged premises. If a demand.of this character had been set up in the answer it would have been struck out on motion, for the reason of its irrelevancy to -the matter in litigation.
It may not affect the result to be reached in this case, but it is proper to say that this court has not been able, as his honor the vice-chancellor has done, to find any evidence proving the existence of the contract which is set up in the answer. It will be remembered that such contract was to the' effect that the appellant would release from the lien of his mortgage a quota of the premises proportionate to the amount of the moneys paid *648to him by the defendant, the holder of the second mortgage. At the trial the effort of the defendant was to show that he had made this contract with the general manager of the appellant. Upon this subject the testimony was conflicting, and this was the ground of the contest, but it seems to have escaped attention that even if such contract had been plainly shown between the parties so negotiating it would have been of no avail, for the reason that the general manager of the corporation had no legal power to enter into it. The board of directors was alone capable to execute that function, and there is nothing to show that the terms of the contract, as claimed by the defendant, were ever communicated to that body.
It seems impracticable, therefore, to rest a decree on the designated grounds.
Nevertheless, it appears to the court that this second mortgagee should have a decree in his favor for the moneys in question. The principle on which such right rests is a familiar one, and its application in the present instance is plain, although it appears heretofore, in the-progress of this suit, to have escaped observation. The moneys in question were paid on the first mortgage by the second mortgagee in order to strengthen his own security. Unless such payments are to be regarded as mere gratuities to the mortgagor, which, conspicuously, was not the intention, they of right should be made to enure to the benefit of him who paid them, and this equitable result can be brought about by a resort to the doctrine of subrogation. This method of redress is so opportune to the enforcement of the undeniable equities of the juncture that the subject needs no explanation or discussion. This measure is to be thus applied: A decree should b.e entered for the first mortgagee for the entire amount of the money due him, without deducting therefrom the sums in question which have been paid by the said second mortgagee, and which decree should be directed to stand as security, in the first place, for the sum due the appellant, minus such payments, and, secondly, as security for the second mortgagee to the extent of said payments made by him. The lien of the appellant will thus have priority, and the lieu of the second mortgagee will be the second one in the premises.
*649The decree appealed from must be reversed, and a substituted one is to be entered in accordance with the view above expressed.
For reversal — The Chief-Justice, Depue, Lippincott, Ludlow, Mague, Van Syckel, Brown, Krueger, Smith, Talman — 10.
For affirmance — None.