OPINION OF THE COURT
Harvey, J. This action was commenced against Catherine Van Keuren (hereinafter decedent) and defendant to foreclose a mortgage in the original sum of $100,000 given to secure a loan for the purchase of real property located in the Towns of Andes and Middletown, Delaware County. Prior to the entry of the judgment of foreclosure and sale, a separate, unrelated action between plaintiff and defendant was settled by a stipulation. The stipulation principally provided that decedent and defendant would withdraw their answer and counterclaim in this action and that decedent would execute a confession of judgment in the amount of $100,074.10 in exchange for plaintiffs agreeing to withdraw a pending motion for summary judgment in its action against defendant. Plaintiff agreed to seek collection of the confession of judgment solely from the surplus moneys, if any, generated in the foreclosure sale in this action. Following the filing of the confession of judgment, a *94judgment of foreclosure and sale was entered and a Referee was appointed.*
A public auction was thereafter held on September 10, 1990, at which the Referee read aloud the terms of the sale. These terms apparently included the following provision: "6th: The biddings will be kept open after the property is struck down; and in case any purchaser shall fail to comply with any of the above conditions of sale, the premises so struck down to him will be again put up for sale under the direction of the Referee under these same terms of sale, without application to the Court, unless the plaintiff’s attorney(s) shall elect to make such application; and such purchaser will be held liable for any deficiency there may be between the sum for which said premises shall be struck down upon the sale, and that for which they may be purchased on the resale, and also for any costs or expenses [occurring] on such re-sale.” Following the submission of bids, a bid from Peter Piaquadio and Maria Piaquadio for $336,000 was accepted. This sale, however, did not go through. In his affidavit in support of plaintiff’s ex parte application for a resale, plaintiff’s counsel averred that, although the terms of the sale specifically stated that the 10% down payment expected by a successful bidder was to be paid by cash or certified check, the Piaquadios apparently thought a personal check would suffice. Additionally, the Piaquadios indicated they were unwilling to execute a memorandum of sale unless plaintiff assured them that it would lend them a substantial portion of the purchase price. When plaintiff’s representative refused to give such an assurance, the Piaquadios refused to go forward with the sale. Plaintiff’s counsel goes on to state that, at that point, although some bidders were still milling around, a lot of other bidders had already left. Accordingly, he deemed it prudent at that point to seek a resale. Supreme Court apparently agreed and ordered a resale. At the second public auction held on November 20, 1990, a bid for $274,000 from D.R.S. Enterprises was accepted.
A Referee’s report was subsequently completed and plaintiff and other creditors submitted claims. Plaintiff moved to confirm the Referee’s report but defendant made several objections. An objection relating to the payment of school taxes was sustained and plaintiff’s motion to confirm was denied. Following the submission of an amended Referee’s report, *95plaintiff moved to confirm the amended report. Defendant again objected on various grounds and cross-moved for certain relief. Supreme Court, in granting the motion to confirm, found, inter alia, that because plaintiff allegedly had the option of compelling the Piaquadios, the initial successful bidders, to perform and failed to do so, the decrease in the surplus should not equitably fall on defendant. Consequently, the difference between the two bids, $62,000, was subtracted from plaintiff’s claim of $101,074.10, leaving plaintiff with a recovery of $39,074.10. Plaintiff now appeals from so much of the order as reduced its recovery to this amount.
We cannot adopt the reasoning of Supreme Court in reducing plaintiff’s recovery by the difference between the final amounts in the two public auctions on the foreclosed property. Accordingly, the order must be reversed to that extent. We cannot agree with the court’s holding that it was solely in plaintiff’s power to apply for and obtain a resale in this matter and that, by choosing this course rather than attempting to compel the Piaquadios to perform or trying to reopen the bidding on September 10, 1990, plaintiff somehow acted inequitably and must bear the consequence of this action.
There can be little dispute that it is the court, not the parties, who is in absolute control of the workings of a judicial foreclosure (see, 73 NY Jur 2d, Judicial Sales, § 1, at 517). The appointed Referee is an officer of the court and must perform Ms duties impartially without regard to the interests of any particular person in the proceeding (Riggs v Pursell, 66 NY 193, 198; Goldberg v Feltman’s of Coney Is., 205 Misc 858, 864; 73 NY Jur 2d, Judicial Sales, § 5, at 519-520). A court has broad discretion in setting aside a foreclosure sale and ordering a resale (79 NY Jur 2d, Mortgages, § 706, at 64) and, significantly, almost any individual, even a nonparty, who has a legitimate interest in the outcome can move to set it aside (79 NY Jur 2d, Mortgages, § 707, at 65-66). In tMs case, the terms of sale provided that plaintiff, through its attorney, could seek a resale if the initial bidder defaulted; such a request, however, had to be approved by Supreme Court. Plaintiff’s counsel gave a legitimate reason for seeking resale which was obviously accepted by the court and that fact should not be used against plaintiff later. We note that although it seems from the tone of Supreme Court’s decision and defendant’s arguments that plaintiff is now being faulted for choosing to seek a resale, there is no evidence on the *96record whatsoever that plaintiff made this request in order to somehow deprive defendant of any surplusage. Although the second bid did raise enough to pay plaintiff’s debt, there was no guarantee this would occur. Obviously, if the second bid was higher than the first one defendant would have benefited accordingly with no extra gain to plaintiff.
With respect to Supreme Court’s apparent holding that plaintiff’s award would be reduced because plaintiff could allegedly seek reimbursement from the Piaquadios in another action, we are in similar disagreement. It is settled law that an initial successful bidder at a foreclosure sale may be compelled to complete the purchase or to pay compensation for the difference between the initial bid and the later selling price (see, Goodwin v Simonson, 74 NY 133, 136; State Bank v Wilchinsky, 128 App Div 485, 489-491; Rowley v Feldman, 74 App Div 492, 494-496, affd 173 NY 607; 15 Carmody-Wait 2d, Mortgage Foreclosure § 92:354, at 302; 79 NY Jur 2d, Mortgages, § 718, at 77-78). Significantly, the initial purchaser must be compelled to purchase within the confines of the foreclosure action, however, and a separate action, insular from the foreclosure action, will not stand (see, State Bank v Wilchinsky, supra, at 490). While plaintiff’s rights as mortgagee conferred upon it the right to see that its debt is paid as a result of the sale (see, Goldberg v Feltman’s of Coney Is., 205 Misc 858, 864, supra; see also, Rowley v Feldman, supra, at 494), it appears that the creditor only has a right to pursue the initial bidder for a difference in bids if the amount upon resale was insufficient to satisfy the lien (see, Rowley v Feldman, supra; see also, Hamilton v Hittleman, 224 App Div 390, 391). Such a result seems logical because if the proceeds of the sale were sufficient to pay a debt, it would be difficult to identify any legitimate interest a creditor would have in pursuing the initial purchaser. Such pursual would more reasonably be left to unsatisfied creditors or the judgment debtor if there was to be a surplus.
Following this line of reasoning, it would appear to be in defendant’s interest to instigate a pursuit of the Piaquadios for a surplus. Along these lines we note that, even though it appears from the record that defendant did have notice of plaintiff’s motion for a resale and did not oppose it (see, Hamilton v Hittleman, supra, at 390-391; 15 Carmody-Wait 2d, Mortgage Foreclosure § 92:355, at 302-303; 79 NY Jur 2d, Mortgages, § 719, at 78), it would be unfair to bind him to that failure in light of the fact that the motion was ex parte. *97Instead, we point out that the power to compel the Piaquadios to complete the sale or malee up the difference rests in the equity powers of Supreme Court to bind any individual who submitted himself or herself to the jurisdiction of the court by bidding and transacting business with the court (see, Archer v Archer, 155 NY 415, 417; 15 Carmody-Wait 2d, Mortgage Foreclosure § 92:292, at 211). As a result, Supreme Court may "compel the purchaser to do what is proper towards protecting the parties to the action and preventing them from sustaining loss in consequence of the wrongful act of the purchaser in refusing to complete [the] purchase88 (State Bank v Wilchinsky, supra, at 491). There is little question that the Piaquadios were aware by the very terms of the initial sale that they could be held responsible for any difference between their bid and the price obtained on resale.
All these competing interests lead no to conclude that the matter must be remitted to Supreme Court for an investigation into the possibility of compelling the Piaquadios to pay the difference between the two bids as opposed to plaintiff. Supreme Court has the power to compel such an event so as to avoid injury to the parties (see, State Bank v Wilchinsky, supra).
Mieoll, J. P., Yesawich Jr., Levine and Mercuke, JJ., concur.
Ordered that the order is modified, on the law, without costs, by reversing so much thereof as partially granted plaintiff’s motion for the distribution of surplus proceeds pursuant to a judgment of foreclosure and sale; matter remitted to the Supreme Court for further proceedings not inconsistent with this Court’s decision; and, as so modified, affirmed.
Decedent thereafter died in the summer of 1990. Defendant, as administrator of decedent’s estate, was substituted for decedent.