FRICK, J.
The plaintiffs made application to this court for an alternative writ of mandate against Hon. Joshua Greenwood, as judge of the district court of Millard County, Utah, to require such judge to enforce a certain order issued by him as hereinafter stated. The defendant filed both a general demurrer and an answer to the application. It must suffice to say that the application is not vulnerable to the general demurrer.
Respective counsel have also filed an agreed statement of facts from which it, in substance, appears that the plaintiffs, in February, 1916, made and delivered to the Delta Land & Water Company, a corporation, hereinafter called mortgagee, a certain chattel mortgage whereby they mortgaged certain live stock to secure the payment of an alleged indebtedness owing by the plaintiffs to said mortgagee. On the 21st of September, 1916, after default had been made by the plaintiffs in paying the debt secured by said mortgage, the said mortgagee took possession of the mortgaged property and attempted to foreclose the mortgage under our statute by advertisement and sale. The plaintiffs before the sale took place filed with the district judge of Millard County the affidavit provided for in Comp. Laws 1907, section 153, which reads as follows:
“When the mortgagee or his assignee has commenced foreclosure by advertisement, and it shall be made to appear, by the affidavit of the mortgagor or his agent or attorney, to the satisfaction of the judge of the district court of the county where the mortgaged property is situated, that the mortgagor has a legal counterclaim or any other valid defense against the collection of the whole or any part of the amount claimed to be due on such mortgage, such judge may, by an order to that effect, enjoin the mortgagee or assignee from foreclosing such mortgage by advertisement, and direct that all further proceedings for the foreclosure be had in the district court properly having jurisdiction of the subject-matter.”
*120Pursuant to said affidavit, said district judge, on the 30th day of September, 1916, and before the sale of the mortgaged property took place, entered an order enjoining said mortgagee from selling said property by advertisement and directed that all proceedings respecting the enforcement of said mortgage be thereafter had in the district court of Millard County, Utah, as contemplated by the section just quoted. After that order had been duly made and served on the mortgagee it came into court and moved the court to require the plaintiffs to execute an indemnity bond, to hold said mortgagee harmless from loss for the reason that said live stock would depreciate in value unless properly fed and cared for, and that the expenses of feeding and keeping the same pending the action would greatly depréciate the mortgagee’s security. The judge made the order asked for by the mortgagee and required the plaintiffs to execute a bond as demanded in the sum of $300. The plaintiffs, under protest, complied with the judge’s- order in that regard and delivered a bond of $300. Thereafter the mortgagee further moved for an additional bond, and the judge mqde a further order requiring the plaintiffs to execute an additional bond of $750. The plaintiffs declined to give the last bond, and the judge then attempted to vacate his order requiring the proceedings respecting the enforcement of the indebtedness aforesaid to be had in the district court as provided in section 153, supra. The mortgagee thereupon foreclosed the mortgage by advertisement and sale of the mortgaged property, and the plaintiffs presented their application to this court for an alternative writ of mandate requiring the judge to reinstate and re-enforce the order of September 30, 1916, or to show cause why he did not do so.
1 The only question for determination is whether a writ of mandate should issue as prayed. It will be observed that the provisions of section 153, supra, are purely remedial and are highly equitable. While it, no doubt, is the purpose of our chattel mortgage statute to give the mortgagee a speedy and adequate remedy to foreclose his mortgage under the statute by advertisement and sale, yet the statute also contemplates that in ease a mortgagor has any de*121fense or counter-claim to any part or all of the debt secured •by the mortgage, all that is required of him is to make that fact evident to the district judge of the county by filing the affidavit provided for in section 153, supra, and if it is made to appear from said affidavit that the mortgagor has a defense or a counter-claim to the whole or a part of the debt secured by the mortgage, all further proceedings regarding the enforcement of the debt must thenceforth be had in the district-court aforesaid. We can conceive of no proceedings that could be devised that would be more simple and at the same time more just and equitable than the proceedings contemplated by section 153 aforesaid. The purpose of the section is merely to transfer the whole matter to a court of equity where complete justice may be administered in accordance with the legal or equitable rights of both parties to the transaction. Counsel for the defendant do not question the justice or effect of section 153, supra, but they contend that, in view that the district judge had entered a further order whereby he attempted to vacate his prior order to the effect that all proceedings shall be had in the district court, and that the mortgagee, in pursuance of the last order, had advertised and sold the mortgaged property without having been again enjoined from doing so by the plaintiffs, the latter are now estopped from proceeding in the district court under the provisions of section 153, supra. Counsel further contend that, although the district judge should not have vacated the order of September 30, 1916, by which he required all further proceedings respecting the enforcement of the indebtedness be had in the district court of Millard County, yet his act of vacating his first order, at most, constituted error, which cannot be reviewed in this proceeding. We cannot agree with counsel’s contentions or conclusions. The provisions of section 153, supra, are plain and simple. Their object or purpose is equally plain. When the mortgagor, therefore, files his affidavit under section 153, and the judge is satisfied, as he evidently was in this case, that the mortgagor has a defense or counterclaim either to the whole or only to a part of the debt secured by the mortgage, the judge is powerless to impose conditions upon the mortgagor’s right to have the mortgagee come into a *122court of equity, where tbe mortgagor may present Ms defense or counterclaim for adjudication. If the mortgagor is not indebted to the mortgagee, the latter has no right to sell the property, and if it is partly paid, or, by reason of the counterclaim; the amount thereof is reduced, then again the mortgagee may sell only so much as may be necessary to pay off any balance that may be found due to the mortgagee. If the district judge may impose terms and conditions, then he may entirely frustrate or annul the wholesome and most equitable provisions of section 153, and in case of the mortgagee’s insolvency the mortgagor would be wholly remediless. After the district judge had made the order requiring that all further proceedings be had in court, he could not refuse to proceed with the case, and he could not ignore the statute, nor could he permit the mortgagee to do so. The judge’s action in setting aside the order of September 30th, therefore; in legal effect, merely amounts to a refusal on Ms part to comply with the provisions of section 153, supra.
2 No one, we tMnk, would question the power of this court to coerce the district judge to comply with that section if the judge had directly refused to do so. Neither the right of the mortgagor to avail Mmself of the provisions of said section nor the power of tMs court to require the judge to proceed can be affected, however, by the character of the refusal; that is, whether it be done directly, or indirectly by methods of circumlocution. By issMng the writ we are merely requiring the district judge to do now what he should have done without coercion. Moreover, there are no elements of estoppel in this ease. The mortgagee’s legal rights are in no way affected or disregarded by being compelled to present its case in court.
3, 4 It is contended, however, that in view that the mortgaged property has been sold and the mortgage has therefore been foreclosed, so far as that can be done by advertisement and sale, there is nothing further to act upon by the district court, and for that reason, if for no other, the writ should be denied. Here again, in our judgment, counsel overlook the real purpose of section 153. The principal or controlling purpose of that section is to afford the mortgagor *123an opportunity to present any defense or counterclaim be may have to tbe debt secured by tbe mortgage. Tbe sale of the property is merely of secondary importance, and is not tbe controlling thing. As already pointed out, the provisions of section 153 are purely remedial as well as highly equitable,' and, although it may not be expressed in the section, yet the district judge or the district court has full power to enforce the spirit as well as the letter of that section, and to that end may invoke any suitable remedy that may be just and equitable. Such power is clearly conferred, if the court lacks inherent power, to do that by Comp. Laws 1907, Section 720, which reads:
“When jurisdiction is, by statute, conferred on a court or judicial officer, all the means necessary to carry it into effect are also given; and in the exercise of the jurisdiction, if the course of proceeding be not specifically pointed out by statute, any suitable process or mode of proceeding may be adopted which may appear most conformable to the spirit of the statute or of the Codes of Procedure. ’ ’
When, therefore, the mortgagor, makes his application to have all further proceedings relating to the enforcement of the mortgage conducted in a court of equity, and it should be made to appear that the mortgaged property is either inherently perishable, or that it is live stock and the costs of feeding and keeping it pending the action would be great, or that there might be a loss by decline in the market price, etc., the court may call upon /the mortgagor to consent to the sale of the mortgaged property forthwith, and, in case of his refusal, or in case he should desire to have possession of the property pending the action, the court may require him to execute an indemnity bond to hold the mortgagee harmless against loss for the reasons just stated. If the mortgagee refuses either to consent to a sale forthwith or to give an indemnity bond, the court may, nevertheless, order the property sold and the proceeds brought into court to await the event of the suit. The court no doubt, in case it ordered a sale, could also require the mortgagee to bring the proceeds into court, or, in lieu thereof, to enter into a good and sufficient undertaking to keep the mortgagor harmless in case he should prevail in his *124defense or counterclaim. Indeed, it would seem to require no great ingenuity to hold matters in status quo and so conduct the proceedings under section 153, that no injustice will result to either party. The court may, however not require the bonds aforesaid, or indemnity, from the mortgagor as a condition precedent to his right to present his defense or counterclaim for adjudication. The doors of the courts must unconditionally remain open to all.
In our opinion, the right on* the part of plaintiffs to have-the judge reinstate and re-enforce the order of September 30, 1916, is clear, and the duty on his part to proceed to enforce said order and to require all further proceedings relating to the enforcement of the debt secured by the mortgage and the defense and counterclaim of the plaintiffs hereto be had in the district court of Millard Cdunty is equally clear. We-remark that, in view that the mortgaged property has been sold, the mortgagee, in his complaint, may allege the facts in that regard the same as though the property had been ordered sold by the court as hereinbefore suggested, and, instead of praying for the sale of the mortgaged property, it may merely pray for the proceeds or so much thereof as' may be necessary to be applied to the payment of its claim. Upon the other-hand, the court may enter such judgment upon the plaintiffs ’’ defense and counterclaim as they may prove themselves to be-entitled to under the law. '
It is therefore ordered that a peremptory writ of mandate issue as prayed. In view that the district judge is the sole party defendant, no costs will be awarded to the plaintiffs.
STRAUP, C. J., and McCARTY, J., concur.