delivered the opinion of the court.
This is an appeal by the plaintiff from an order denying an application for a writ of assistance. The facts are that Dennis C. Pillsbury, as administrator of the estate of Catherine A. Coburn, deceased, commenced a suit in the Circuit Court for Multnomah County, Oregon, against Frankie I. McGarry and W. K. McGarry, her husband, to foreclose a mortgage which they , had executed to the deceased of lot 4 in block 60, Irvington, in the City of Portland. Mary L. Farnam, who held a superior mortgage of the same real property which had been executed to her by the defendants, was not made a party to the suit. The summons and a copy of the complaint therein were personally served in that county by the sheriff thereof upon each of the defendants, who failing to appear or answer, their default was entered of record, and a decree thereupon was rendered against them, foreclosing the lien of the subordinate mortgage, and directing a sale of the premises, subject; however, to the statutory right of redemption. The decree did not provide that upon a sale of the real estate the purchaser should he put in possession thereof. Pursuant to the decree and an order of sale based thereon, the sheriff of that county, after having duly advertised the lot, sold it in the manner prescribed by law to the plaintiff, who was the highest and best bidder therefor, and such officer thereupon returned, in term time, the writ, indorsing thereon a statement of the things which he had done in compliance with the commands thereof. More than five days thereafter, and in which, meantime, no objection to the regularity of the proceedings having been made or filed, the sale was, by order of the court, duly confirmed. After such approval of the price was made, the plaintiff moved the court for a writ of assist*263anee to secure possession of the premises which he had purchased, supplementing his application by an affidavit detailing the facts in substance as hereinbefore set forth, and stating that upon the purchase of the lot the sheriff issued a certificate of sale to him, and that he was then the owner thereof; that the defendants were in the exclusive possession of the real property described in the mortgage, but that they have no interest therein, other than a right of redemption prescribed by law; that on the day preceding the application herein the certificate of sale referred to was exhibited to defendants by plaintiff’s agent, who thereupon demanded of them the possession of the lot, but they refused to comply therewith; and that plaintiff is entitled to the writ desired.
A counter-affidavit was also filed, denying that the defendants had no interest in the property, except the statutory right of redemption, asserting in effect that they were entitled to occupy the premises until the superior mortgage was foreclosed, and a sheriff’s deed was executed to the purchaser pursuant to the decree to be rendered in that suit, and that no default had occurred in the mortgage given to Mary A. Famam.
The court, considering these affidavits, denied the application for a writ of assistance, and, in order to review such action, the cause has been transferred to this court. The statute regulating the right of occupancy of real property disposed of by a sheriff pursuant to an exécution or order of sale based on a judgment or a decree reads:
“The purchaser from the day of sale, until a resale, or a redemption, and a redemptioner from the day of his redemption until another redemption, shall be entitled to the possession of the property purchased or redeemed, unless the same be in the possession of a tenant holding under an unexpired lease, and in such case, shall be entitled to receive from such tenant the *264rents or the value of the use and occupation thereof during the same period”: Section 252, L. O. L.
• “If the purchaser of real property sold on execution, or his successor in interest, be evicted therefrom in consequence of the reversal of the judgment, he may recover the price paid, with interest and the costs and disbursements of the suit by which he was evicted, from the plaintiff in the writ of execution”: Section 242, L. O. L.
1. It will be remembered that the decree foreclosing the mortgage executed by the defendants to Catherine A. Coburn was given for want of an answer, and no appeal therefrom could have been taken by the mortgagors : Section 549, L. O. L. This being so, the rule adopted by this court has no application that, where the appeal is from the decree itself, and a proper undertaking has been given, the purchaser of the premises at a sale thereof can take no proceedings to recover possession of the real property sold, since such application for the enforcement of the right given by the statute is stayed by the supersedeas t German Sav. Soc. v. Kern, 42 Or. 532, (70 Pac. 709).
2. Any person having a lien subsequent to the plaintiff upon the same property or any part thereof shall be made a defendant in the suit, and any person having a prior lien may be made a defendant at the option of the plaintiff, or by order of the court when deemed necessary: Section 423, L. O. L. As Mary L. Farnam, who had a prior lien on the premises, was not made a party defendant in the suit to foreclose the mortgage herein, the question to be considered, by reason thereof, is whether or not the plaintiff is precluded from asserting the right thus given by the statute.
In foreclosing a mortgage upon real property, the purpose to be subserved by omitting prior mortgagees and judgment creditors, and including all subsequent lien claimants is to enable the purchaser upon a sale *265of the premises under the decree, if he secure a sheriff’s deed, to be subrogated to the rights of the owners of the land and of such claimants. When the title and liens of such parties have been secured and extinguished, the purchaser steps into their shoes, and, in order to preserve his rights and perfect his title, he must pay off all prior liens. The sheriff’s sale herein conferred upon the plaintiff an equitable interest in the land which is liable to be extinguished if the defendants, as the present owners of the fee, redeem within the time limited therefor by paying the sum of money required for that purpose. If they do not discharge the debt, the plaintiff’s interest will ripen into an estate in fee upon the execution of the shériff’s deed, and, if he would protect such legal title, it will be incumbent upon him to secure a discharge of the superior lien. But whether he does so or not, since he purchased the premises at the sheriff’s sale, and secured a certificate thereof, he is entitled to the possession of the lot until ousted therefrom upon another sale of the real property pursuant to a decree foreclosing the lien of the prior mortgage. The statute expressly confers the right asserted, and the remedy invoked is the proper proceeding for the occasion: Hald v. Bay, 36 Or. 189 (59 Pac. 189); German Sav. Soc. v. Kern, 42 Or. 532 (70 Pac. 709.)
An error having been committed in denying the application, the decree should be reversed and the cause remanded, with directions to issue the required writ, and it is so ordered. Reversed.
Mr. Chief Justice McBride, Mr. Justice Burnett and Mr. Justice Ramsey concur.