712 P.2d 691

#### D. Kayle HOBBS and M. Marlene Hobbs, husband and wife, and George Nicholas Hobbs and Leata B. Hobbs, husband and wife, Plaintiffs-Appellants, v. FIRST INTERSTATE BANK OF IDAHO, N.A., a national banking association, Defendant-Respondent, and James R. Hollister and Karen L. Hollister, husband and wife, Defendants.

No. 15432.

Court of Appeals of Idaho.

Dec. 20, 1985.

*991Jim C. Harris, Harris & Sutton, Boise, for plaintiffs-appellants.

Christopher M. Bieter and Louie L. Uranga, Uranga & Uranga, Boise, for defendant-respondent.

WALTERS, Chief Judge.

We are asked to review a summary judgment granted to First Interstate Bank of Idaho, N.A., on its counterclaim for rent due under a lease agreement with the plaintiffs-appellants. The sole issue is whether the plaintiffs were barred from asserting, as an affirmative setoff to the counterclaim, the value of improvements they made to the property. These improvements also were mentioned in a complaint that had been dismissed with prejudice. We vacate the judgment on the counterclaim and remand this case for further proceedings.

The plaintiffs were the lessees with an option to purchase under an agreement with the defendants, Hollisters. During the term of the lease, the Hollisters conveyed the demised premises and assigned their rights under the lease to the bank. The plaintiffs filed suit against the Hollisters and the bank for breach of the option to purchase. They sought recovery of improvements they had made to the property. In addition, they stopped paying rent on the lease. The bank counterclaimed for the nonpayment of rent.

The plaintiffs’ complaint was dismissed under I.R.C.P. 11(b)(3) because the plaintiffs failed to obtain new counsel or, alternatively, to personally appear within twenty days after their original attorney withdrew. After dismissal of the plaintiffs’ complaint, new counsel appeared for the plaintiffs and filed a reply to the bank’s counterclaim. As an affirmative defense the plaintiffs essentially asserted the bank was unjustly enriched by the value of improvements made to the leased premises by the plaintiffs and that any award of rent should be offset against the value of those improvements. The bank then moved for summary judgment on its counterclaim against the plaintiffs. The bank asserted that the plaintiffs’ affirmative defense was barred by res judicata because the plaintiffs had sought recovery for the value of those same improvements in their complaint which had been dismissed earlier by the district court. The district court granted summary judgment to the bank on equitable grounds without reaching the res judicata issue. The district court held that “one who seeks equity must be willing to do equity” and that the plaintiffs were not in a position to receive equitable relief. The court stated four reasons for its decision. The court said:

> In summary, I observe (1) that [the plaintiffs] initiated this suit, forcing the defendants to come forward to defend; (2) that their complaint was dismissed in effect because of their own lack of diligence in pursuing the case, which lack was demonstrated by their first attorney withdrawing because of their failure to make decisions essential to prosecution of the action and their failure to pay the rent admittedly owing in spite of their attorney’s advice and admonition to do so, and second by their failure to make timely arrangements to secure a new attorney; (3) that they were well aware of the provision in the lease mandating that improvements to the premises were to be made solely at their expense; and (4) that certainly they must have been aware that withholding the rent would subject them to legal consequences against which their alleged improvements would not necessarily shield them.

> *992Against this backdrop I would find it very inequitable to the bank to allow the claimed offset.

While the court ostensibly applied the maxim of “he who seeks equity must do equity,” we believe in reality the court used the “clean hands” doctrine. Under that doctrine a party who seeks equity must enter the court with “clean hands.” More specifically, a litigant may be denied relief by a court of equity on the ground that his conduct has been inequitable, unfair and dishonest, or fraudulent and deceitful as to the controversy in issue. *Dursteler v. Dursteler,*108 Idaho 230, 697 P.2d 1244 (Ct.App.1985), *citing Gilbert v. Nampa School District No. 131,*104 Idaho 137, 657 P.2d 1 (1983). In applying the clean hands doctrine, a court has discretion to evaluate the relative conduct of both parties and to determine whether the conduct of the party seeking an equitable remedy should, in the light of all the circumstances, preclude such relief. *Id.*

In this case we believe the district court erred in determining that the plaintiffs’ equitable defense to the bank’s counterclaim would not be allowed. We note that although the plaintiffs’ complaint was dismissed for failure to comply with the court’s order to appear through new counsel within twenty days after their original attorney withdrew, no default was sought by, or granted to, the bank on its pending counterclaim. I.R.C.P. 11(b)(3). The plaintiffs did thereafter obtain new counsel, who filed a reply to the counterclaim. If, as the district court determined, the plaintiffs were not diligent in pursuing their case by timely obtaining new counsel, the appropriate sanction for their tardiness would have been to enter default judgment on the bank’s counterclaim, under Rule 11(b)(3). That was not done.1

Applying an equitable doctrine as a bar to disposition of the issues framed by the reply to the bank’s counterclaim seems to us to be unduly harsh. Although the district court found it would be inequitable to allow the offset, the court did not specifically find that the plaintiffs had engaged, in any “unfair, dishonest, fraudulent, deceitful or inequitable *conduct." Dursteler,*108 Idaho at 235, 697 P.2d at 1249 (emphasis added). Further, although it is true the plaintiffs refused to pay rent to the bank during the pendency of their dispute, we are not persuaded that a tenant who refuses to pay rent to a landlord, while a dispute over their contract rights exists, automatically forfeits all opportunity to obtain an offset against the amount ultimately found owing to the landlord. Because we hold the court erred in granting the summary judgment to the bank based on equitable grounds, the case must be remanded.

The bank argues that the judgment of the district court can be upheld on an alternative theory of res judicata. The bank submits that dismissal of the plaintiffs’ complaint precluded the plaintiffs from raising, as an affirmative defense to the bank’s counterclaim, any issue upon which they had sought affirmative relief in their complaint. We disagree. The doctrine of res judicata precludes relitigation of a matter previously adjudicated in a suit *993between the parties. *See, e.g., Aldape v. Akins,*105 Idaho 254, 668 P.2d 130 (Ct.App.1983). Here there was no previous suit; the issues raised by the complaint and counterclaim occurred in the same, pending action. In this circumstance, res judicata simply does not apply.

The summary judgment entered below is vacated and the case is remanded for further proceedings. No attorney fees on appeal; costs to appellants.

BURNETT and SWANSTROM, JJ., concur.

1

. The record shows the following chronology. Plaintiffs’ complaint was filed on December 21, 1982. The bank filed an answer and counterclaim on March 11, 1983. Plaintiffs’ counsel was allowed to withdraw, by court order dated April 13, 1983, and plaintiffs were notified to either appear in person or through new counsel within twenty days from that date. The notice stated that failure to appear "shall be sufficient ground for dismissal of the action of such parties, with prejudice *and*entry of default of the counterclaim against such parties and without further notice." (Emphasis added). On May 13, 1983, the court dismissed the plaintiffs’ complaint for failure to comply with the April 13 order. New counsel appeared for the plaintiffs on May 24, 1983 and a reply to the bank's counterclaim was filed on June 6, 1983. On September 27, 1983 the bank moved for summary judgment. The motion was granted by written order dated December 30, 1983 and filed January 12, 1984. The parties have agreed that there were no disputed facts but argued the appropriate application of substantive law. Whether the bank is entitled to summary judgment on grounds other than those discussed today must be determined on remand.