By his complaint in this action the plaintiff seeks tbe equitable interference of tbe court to restrain tbe sale of certain real property under a judgment for tbe foreclosure of a mechanic’s lien filed against tbe same by defendant, which judgment plaintiff alleges was fraudulently entered after tbe lien was settled by plaintiff. Upon tbe facts stated plaintiff asks an injunction restraining tbe proceedings, and a threatened sale under tbe judgment, pending the action, and for the dismissal of all proceedings for tbe enforcement of tbe lien, and tbe satisfaction of tbe same. Tbe defendant appeals from tbe order granting an injunction.
*4861. Under 3 878 G-. S. ch. 66, § 200, it is not necessary in all cases in which a temporary injunction is sought to ask for a permanent injunction in the complaint, for other appropriate relief may be asked, substantially equivalent. It is enough that it be made to appear that the defendant is threatening to do some act in violation of plaintiff’s rights in respect to the subject of the action, and tending to render the judgment ineffectual. Such is the case of a suit to set aside or cancel an invalid or satisfied mortgage upon which a foreclosure sale is threatened. And besides, in this case defendant has appeared in the action, and the court is authorized to grant any final relief consistent with the case made by the pleadings. This objection to the complaint, therefore, cannot be sustained.
2. The application for the injunction was- heard upon the complaint and affidavit of the plaintiff and the sworn answer of the defendant. The defendant insists that it was error for the court to allow the writ, because the answer denies all the equities of the complaint.
While it will be conceded that the general rule is as the plaintiff contends, yet it is not inflexible, but it is a matter largely in the sound judicial discretion of the court, whether it will retain or set aside an injunction upon the hearing, depending upon the nature of the case, and the attendant circumstances, especially in cases of this kind, where the delay of the sale until the hearing would work comparatively little injury to the substantial rights of the defendant, as compared with the inconvenience and embarrassment it might cause to the plaintiff. Stees v. Kranz, 32 Minn. 313, (20 N. W. 241;) High, Inj. §§ 1508, 1509; O’Brien v Oswald, 45 Minn. 59, (55 N. W. 140.) We are of the opinion that the discretion of the court was not abused in this instance.
3. Another objection urged is that plaintiff had an adequate legal remedy; that he ought to have applied for relief in the original action for the enforcement of the lien; that he might have procured a stay of proceedings, and moved to set aside the judgment, and been admitted to defend in that action. It is undoubtedly true that, having succeeded to the title of the property in question, he would have had a standing in court to apply for such relief.
But plaintiff was not confined to this remedy. The equitable remedy to restrain by injunction a sale which is unwarranted and *487inequitable, and which would create a cloud upon the title of the plaintiff, is well established, and is clearly contemplated by 1878 G. S. ch. 66, §§ 200, 204; Conkey v. Dike, 17 Minn. 460-465, (Gil. 434.) “The prevention of a cloud upon title is a salutary branch of the jurisdiction of equity recognized by all the authorities, and founded upon the clearest principles of right and justice.” High, Inj. § 372.
In order to form a basis for the relief by injunction sought there must be a suit brought, and the plaintiff must, of course, show that the threatened sale is unlawful and unauthorized. This the complaint in this case shows. It substantially appears thereby that the defendant had erected a house upon the premises for the owner thereof, and at the instance of the plaintiff proceeded to file a claim for a statutory lien for the cost thereof, the amount of which had already been advanced to him by the plaintiff; and brought an action to foreclose the same. The owner made no contest, and shortly afterwards the plaintiff purchased the property, and thereupon, it is alleged, made full settlement with the defendant, including the costs and expenses of the action, in consideration whereof the defendant agreed to satisfy the lien, and dismiss the suit. This, however, the defendant failed to do, but several months thereafter secretly caused judgment to be entered by default, and afterwards caused the premises to be advertised for sale in pursuance thereof. The entry of judgment after the claim was settled was in violation of the rights of the plaintiff, and a fraud upon him. Gates v. Steele, 58 Conn. 316, (20 Atl. 474;) 3 Pom. Eq. Jur. p. 2104. These allegations afford ample justification for the injunction, and the inquiry into the validity of the judgment and lien properly falls within the jurisdiction of the court in the injunction action.
4. But, in addition to the facts already stated, the complaint also shows that the plaintiff had in the first instance paid defendant the cost of the house we have referred to, in pursuance of an agreement between all the parties interested, under which the owner was in consideration thereof to secure plaintiff for the sum so advanced, but which he afterwards refused to do; and the complaint proceeds: “That thereupon plaintiff entered into a certain agreement with defendant, whereby it was understood and agreed by plaintiff and defendant that defendant should file a mechanic’s lien upon said premises for the total cost of said house, and should *488proceed to bave said lien foreclosed, for tlie protection, benefit, security of, and in trust for, plaintiff, to protect said plaintiff for tbe said sum of money so advanced, which said proceedings were to be conducted in the name of defendant; that, in pursuance of said' agreement, defendant caused mechanics’ liens to be filed against the premises” as above stated. And subsequently plaintiff bought the property of the defendants in the lien suit, and entered into the arrangement for the settlement of the lien and dismissal of the proceedings already mentioned. This scheme or device to save the plaintiff’s claim the defendant insists was dishonest, and so affected the whole subsequent transaction between plaintiff and defendant in respect to the settlement of the suit that a court of equity will not interfere to aid either party, but will leave them as it finds them. The facts stated do not, however, bring this case within the class of cases counsel refer to. While the law did not give this plaintiff any such remedy as he was seeking to avail himself of through the defendant’s lien, and would have interfered to protect the owner against it, yet the debt was an honest one, it seems; and the question relates rather to the remedial rights of the parties than to the inherent immorality or unlawfulness of the transaction. But, under the altered circumstances, after plaintiff became the owner, there certainly could be nothing in the subject-matter invalidating the new agreement with the defendant, or requiring the application of the maxim “in pari delicto,” etc. Equity will not interfere or refuse to interfere merely because the subject-matter in respect to which relief is asked may have grown out of a fraudulent or illegal transaction. McBlair v. Gibbes, 17 How. 237; Brooks v. Martin, 2 Wall. 81. On the contrary, it would be highly inequitable to allow the defendant to enforce payment a second time. Equity will interfere, even in the case of illegal contracts, to restrain their active enforcement, upon the same principle that under other circumstances they may be defended against at law, though it would not give to either party any relief or benefit growing out-of the contract. 2 Pom. Eq. Jur. § 940.
(Opinion published 57 N. W. Kep. 208.)This disposes of all the questions in the case which we deem material to be considered. Order affirmed.