It is well settled that a written document purporting to be a discharge of a mortgage may under some circum stances have the effect of an assignment; as, on .the other hand, a conveyance in the form of an assignment may operate as a discharge. This is a matter in which the form of the conveyance is not a decisive test, and a court of equity will go behind the form to reach the substantial merits of the case. And, even without any written assignment, a payment of the entire mortgage debt may give to the party making the payment the rights of an equitable mortgagee, so that in some circumstances he may be subrogated to the position of the mortgagee. Whether a payment of the entire amount due shall operate as a discharge of the debt, or as a purchase and assignment of the mortgage, depends not so much on the form of words used, as upon the relations subsisting between the party advancing the money, and the party executing the release or transfer, and their relative duties. Brown v. Lapham, 3 Cush. 551. Gibson v. Crehore, 3 Pick. 475.
If the amount of the debt in this case had been paid by one who was bound by contract or otherwise to pay it, the effect of his doing so would be to extinguish the mortgage. But the defendant Charles H. Gass stood in no such relation to the *230property. He was not acting for the second mortgagee, and was not holding under the mortgagor by reason of any contract, express or implied, to pay the debt. He made the two payments, which are indorsed upon the note, for the protection and relief of his own title, and not for the purpose of benefiting the plaintiff and giving him a better position than he was in already. He had a right of redemption, and the partial payment was made with a view of ultimately acquiring the control of the mortgage. It has been decided that if one, having a right to redeem mortgaged •premises, pays the debt, the mortgage is to be treated as assigned to him, if it is manifestly for his interest and not inconsistent with the justice of the case, and where no contrary interest is clearly expressed or necessarily implied. Hinds v. Ballou, 44 N. H. 619. Leavitt v. Pratt, 53 Maine, 147. The plaintiff is in no position to say that his rights are injuriously affected, if the previous incumbrances upon the property are not increased or made moré burdensome by the transactions between the mortgagee and the holder of the equity.
The counsel for the plaintiff has cited certain cases to the effect that where a mortgagee has understandingly and inten tionally discharged his mortgage, it cannot be reinstated to the prejudice of subsequent incumbrancers or judgment creditors in States where a judgment is a lien upon the debtor’s real estate. Banta v. Garmo, 1 Sandf. Ch. 383. Frazee v. Inslee, 1 Green Ch. 239. Neidig v. Whiteford, 29 Md. 178. We are not called upon in the present case to decide what would have been,the position of this plaintiff, if he had been an attaching creditor or a bona fide purchaser or incumbrancer without notice, and subsequently to the date of the two payments in question. But that is not his position. He took his title with the knowledge that it was subject to a prior incumbrance of $5000; and that, in order to make his mortgage upon the property available, he would be obliged to pay that amount to the holder of the previous mortgage. That previous mortgage has never been discharged, but is still outstanding and in force in the hands of one of these defendants in trust for the other. The defendant Charles H. Gass was in a position in which, to protect himself against loss, he found it necessary to acquire the rights of the first mortgagee. The money which he paid to the first mortgagee can be treated *231as a part payment towards the purchase of that mortgage, without doing any injustice to the plaintiff, and without impairing the title which he intended to take and understood that he had taken in the original transaction; in fact, without altering in the slightest degree the position in which he placed himself at the outset.
The result therefore is, that the plaintiff can redeem only upon the payment of the original mortgage, with interest.
Decree accordingly.