Full Opinion

STATE OF MINNESOTA IN SUPREME COURT A24-1548 Court of Appeals Gaïtas, J. Sustainable 9, LLC d/b/a Sustainable 9 Design + Build, Respondent, vs. Filed: August 5, 2026 Office of Appellate Courts Jacqueline Coleman, Appellant, Riverland Bank, Defendant, John Doe, et al., Defendants. ________________________ Courtney J. Ernston, North Star Law Group PLLC, Saint Paul, Minnesota, for respondent. Carl E. Christensen, William J. Rogers, Christensen Sampsel PLLC, Minneapolis, Minnesota, for appellant. ________________________ 1 SYLLABUS When the amount of damage caused by a contractor’s negligent construction of a home exceeds the amount of that contractor’s mechanic’s lien for the home, the homeowner’s defense of recoupment eliminates the lien, and the lien cannot serve as the basis for an award of attorney fees and costs to the contractor under Minnesota Statutes section 514.14 in a mechanic’s lien enforcement action. Reversed and remanded. OPINION GAÏTAS, Justice. This case concerns a contractor’s entitlement to attorney fees and costs in a mechanic’s lien foreclosure action arising from the construction of a new home. In 2019, appellant Jacqueline Coleman hired respondent Sustainable 9, LLC (the contractor) as a general contractor to build her home in Medina. Near the end of the construction project, Coleman alleged unresolved issues with the construction and began withholding payments to the contractor. The contractor then initiated a lawsuit, seeking to enforce its mechanic’s lien on Coleman’s property and asserting a breach of contract claim against Coleman. Coleman counterclaimed for breach of contract and negligence. A jury awarded damages to Coleman on her negligence claim and to the contractor on its breach of contract claim. After the jury verdicts, the district court considered the mechanic’s lien foreclosure action. Coleman asserted the common law doctrine of recoupment as a defense to the mechanic’s lien. She argued that the amount of the lien should be reduced by the amount 2 of damage caused by the contractor’s negligent construction, as represented by the jury’s damages award for her negligence claim. The district court rejected the recoupment defense and found that the contractor had a valid mechanic’s lien in the amount of the jury’s damages award for the contractor’s breach of contract claim. But the district court determined that the value of the mechanic’s lien was fully offset by the jury’s damages award for Coleman’s negligence claim. Notwithstanding this determination, the district court awarded the contractor attorney fees and costs under Minnesota Statutes section 514.14—which provides for attorney fees to the prevailing party in a mechanic’s lien proceeding—because it determined that the offset of the award did not void the lien. Coleman appealed to the court of appeals, and the court of appeals affirmed. Before this court, Coleman argues that the district court erred by awarding attorney fees and costs to the contractor to enforce its mechanic’s lien. She asserts that both the district court and the court of appeals erred by rejecting her affirmative defense of recoupment, which she argues extinguished the mechanic’s lien. We therefore examine if, and how, the common law doctrine of recoupment applies when a contractor’s negligence causes damage that exceeds the amount of the mechanic’s lien on the property. We conclude that, under these circumstances, recoupment operates as a complete defense and eliminates the mechanic’s lien. Thus, we reverse and remand, holding that the court of appeals erred by affirming the district court’s ruling on the validity of the mechanic’s lien and the award of associated attorney fees and costs to the contractor. 3 FACTS In October 2019, Coleman contracted with Sustainable 9, LLC, to build a home in Medina. Per the contract, Coleman paid for the construction with installment payments. When the project was nearly complete, Coleman raised several concerns with the contractor regarding the construction. These concerns included gaps in the fascia (the long, straight board that runs along the lower edge of the roof), the appearance of the basement floor, and damage to the stairs. In January 2020, Coleman informed the contractor that she would withhold future installment payments if these concerns were not resolved. Discussions between Coleman and the contractor soon broke down, and Coleman began withholding payments. In February 2021, the contractor filed a mechanic’s lien statement against Coleman’s property. The contractor then initiated this lawsuit in March 2021, seeking to enforce the mechanic’s lien and bringing a separate breach of contract claim against Coleman. Coleman counterclaimed for breach of contract and negligence. Additionally, Coleman asserted several affirmative defenses, including: “Plaintiff’s claims are barred by its unlawful conduct and breach of duties owed to Coleman” and “Plaintiff’s alleged damages are offset by its own breach of the applicable agreements, contracts and/or correspondence.” The district court held a jury trial on both parties’ breach of contract claims and Coleman’s negligence claim. At the jury trial, the parties disputed whether there were construction defects and the amount it would cost to repair any defects. The contractor also argued that Coleman had impeded it from completing repairs on the claimed defects, 4 which would excuse its performance under the contract. The jury found that Coleman breached the contract and awarded the contractor $94,951.89 in damages. The jury also found that the contractor breached the contract but did not award Coleman damages on that claim. Finally, the jury found that the contractor was negligent in its work on Coleman’s property and awarded Coleman $278,622 in damages for the negligence. Coleman filed post-trial motions, arguing that the jury’s award of damages on her negligence claim was inconsistent with its decision not to award damages on her contract claim. The district court denied Coleman’s post-trial motions, reasoning that the jury’s findings were not inconsistent, in part because the jury could have found that the obligations under the contract were not identical to the duties underlying the negligence claim.1 Following the jury trial, the district court held a hearing on the contractor’s action to enforce the mechanic’s lien. Coleman argued that the contractor should not recover anything on its lien because the amount of damage to her home—represented by the jury’s finding of negligence damages—exceeded the amount of the claimed lien. She contended that, under the doctrine of recoupment, the lien was extinguished because the 1 The district court reasoned that the jury could have found that Coleman impeded the contractor from returning to her home to make the repairs. The district court stated that “[t]here is a duty to mitigate in contract, there is not a duty to mitigate in negligence.” Thus, the jury could have concluded that Coleman failed to mitigate her damages under the contract claim and still awarded damages under the negligence claim. The court of appeals later concluded that this statement by the district court was legal error. Sustainable 9, LLC v. Coleman, No. A24-1548, 2025 WL 2389072, at *5 (Minn. App. Aug. 18, 2025). Before this court, the parties do not challenge the jury’s verdicts or the district court’s findings regarding the verdicts. 5 value of the lien was less than the amount the jury determined was necessary for repairs to the home. On the other hand, the contractor argued that the doctrine of recoupment could not be used to reduce the lien amount because the jury did not award any damages on Coleman’s breach of contract claim. The parties also disputed whether the contractor was entitled to attorney fees and costs on the lien claim. The district court rejected Coleman’s recoupment theory. It concluded that the contractor had a mechanic’s lien for $94,951.89—the amount the jury awarded the contractor on its breach of contract claim. However, the district court observed that the contractor was not entitled to collect on this lien “because the amount owing to [the contractor] has been offset by the amount [the contractor] owes to Coleman on the negligence claim.” Nonetheless, the district court concluded that the contractor was entitled to attorney fees and costs in enforcing the mechanic’s lien under Minnesota Statutes section 514.14. The district court reasoned that, while a “negligence claim can offset the award under the mechanic’s lien,” it does not “void the lien and therefore does not void the attorney fee claim.” The district court ultimately awarded attorney fees of $46,000 and costs of $16,500 to the contractor for enforcing the mechanic’s lien. Following the offset, the district court determined that the contractor owed Coleman a total of $121,170.2 The district court also concluded that Coleman was entitled to costs and disbursements, totaling $12,962.33, as the prevailing party in the overall litigation. 2 To calculate this number, the district court took the $278,622 in negligence damages awarded by the jury to Coleman and subtracted the damages she owed to the contractor on its contract claim ($94,951.89) and the attorney fees and costs she owed to the contractor on the mechanic’s lien claim ($62,500). 6 Coleman appealed to the court of appeals, which affirmed the district court’s decision. Sustainable 9, LLC v. Coleman, No. A24-1548, 2025 WL 2389072 (Minn. App. Aug. 18, 2025). On the issue of recoupment, the court of appeals concluded that “Coleman’s negligence claim does not support a recoupment defense” because the contractor’s duty of care under tort law was independent of the construction contract. Id. at *11. Thus, the court of appeals concluded, Coleman’s damages award arising from her negligence claim could not be recouped against the mechanic’s lien award. Id. The court of appeals further held that the district court did not abuse its discretion by awarding attorney fees to the contractor in the mechanic’s lien proceeding. Id. at *13. We granted Coleman’s petition for review. ANALYSIS The central question here is whether the contractor is entitled to attorney fees and costs for seeking to enforce its mechanic’s lien against Coleman’s property. Under the mechanic’s lien statutes and our case law, a lienholder’s entitlement to attorney fees under Minnesota Statutes section 514.14 is directly connected to the success of its mechanic’s lien foreclosure action. See T.A. Schifsky & Sons, Inc. v. Bahr Constr. Co., 773 N.W.2d 783, 788 (Minn. 2009). Thus, to answer the question before us, we must determine whether the contractor prevailed in its mechanic’s lien foreclosure action. This inquiry, in turn, depends on whether Coleman may assert the affirmative defense of recoupment to defeat the mechanic’s lien. Coleman argues that the contractor was not entitled to a mechanic’s lien. She asserts that, by operation of her affirmative defense of recoupment, the value of the lien 7 should have been reduced to zero due to the damage to her home resulting from the contractor’s negligence. And because the lien had no value, she contends that the contractor did not succeed in enforcing its mechanic’s lien. The contractor argues that the affirmative defense of recoupment does not apply under the circumstances of this case. It contends that the district court correctly offset the damages, rather than applying the defense of recoupment to extinguish the mechanic’s lien. The contractor further argues that it successfully enforced its mechanic’s lien and is therefore entitled to attorney fees and costs. To resolve the questions presented, we first examine the common law defense of recoupment and how it operates in mechanic’s lien foreclosure actions. Then, we turn to the question of whether Coleman may assert the defense of recoupment here. Finally, we consider whether recoupment extinguishes the contractor’s mechanic’s lien in this case, which would correspondingly extinguish any right to attorney fees and costs. The availability and application of recoupment as an affirmative defense are questions of law that we review de novo. See Household Fin. Corp. v. Pugh, 288 N.W.2d 701, 703–05 (Minn. 1980) (analyzing whether the recoupment defense applied without deference to the district court); Soderberg v. Anderson, 922 N.W.2d 200, 203 (Minn. 2019) (stating that the application of Minnesota’s common law is a question of law that is reviewed de novo). We review a district court’s award of attorney fees and costs for an abuse of discretion. See Becker v. Alloy Hardfacing & Eng’g Co., 401 N.W.2d 655, 661 (Minn. 1987); Obraske v. Woody, 199 N.W.2d 429, 432 (Minn. 1972) (holding that the district court has discretion to award reasonable attorney fees in a mechanic’s lien 8 foreclosure action). A district court abuses its discretion when it makes findings unsupported by the evidence or when it improperly applies the law. Madison Equities, Inc. v. Off. of Att’y Gen., 967 N.W.2d 667, 672 (Minn. 2021). A. We begin by identifying the applicable law. We first consider the affirmative defense of recoupment. Then, we address Minnesota’s mechanic’s lien statutes. 1. Recoupment is a common law doctrine that can be traced back to some of our earliest cases. See Mason v. Heyward, 3 Minn. 182 (1859). In recent years, however, we have not had many opportunities to address this doctrine. Recoupment is based on the equitable principle that when multiple claims arise out of the same transaction, one claim should compensate for the other. Townshend v. Minneapolis Cold-Storage & Freezer Co., 48 N.W. 682, 683 (Minn. 1891). Recoupment is “purely defensive.” Imperial Elevator Co. v. Hartford Accident & Indem. Co., 204 N.W. 531, 532 (Minn. 1925). A recoupment defense “must arise out of the same transaction that is the subject matter of the plaintiff’s action and it can only be utilized to reduce or avoid the plaintiff’s recovery.” Pugh, 288 N.W.2d at 704. Our decision in Townshend illustrates our application of recoupment. The plaintiff in that case, the owner of 1,400 barrels of apples, sought to recover possession of the apples and damages for the retention of the apples in a warehouse. 48 N.W. at 682. The defendant’s answer claimed “a lien on the apples as warehouseman.” Id. In response, the owner of the apples alleged “incompetency and negligence on the part of defendant in the 9 storing and keeping of the apples,” which caused damages that exceeded the amount of the claimed lien. Id. We determined that recoupment was an available “defense against the claim for a lien.” Id. at 682–83. This meant that any damages caused by the defendant’s negligence could be deducted from the claimed lien. Id. at 683. Because the claimed negligence damages exceeded the claimed lien, we explained that “there was nothing due defendant on the contract for storage, and consequently there could be no lien for storage.” Id. The affirmative defense of recoupment is distinct from a setoff and a counterclaim. Unlike recoupment, setoffs and counterclaims are not defensive, but offensive claims. Imperial Elevator Co., 204 N.W. at 532. While recoupment requires the competing claims to arise from the same transaction, a court may set off damages from separate claims that arise from unrelated transactions. Pugh, 288 N.W.2d at 704 & n.5. Similarly, a counterclaim may, but need not, arise from the same transaction as the opposing party’s claim. Parties may assert a compulsory counterclaim, which arises from the same transaction as the subject matter of the opposing party’s claim, see Minn. R. Civ. P. 13.01, or a permissive counterclaim, which does not arise out of the same transaction, see Minn. R. Civ. P. 13.02. Unlike recoupment, a counterclaim “allows for recovery in excess of that sought by the plaintiff.” Pugh, 288 N.W.2d at 704 n.5. As we stated in Townshend, the party asserting a counterclaim may “go beyond abating or barring the plaintiff’s claim, and [may] recover an affirmative judgment for the difference in his favor.” 48 N.W. at 683; see also Minn. R. Civ. P. 13.03 (“A counterclaim may or may not diminish or defeat the 10 recovery sought by the opposing party. It may claim relief exceeding in amount or different in kind from that sought in the pleading of the opposing party.”).3 For recoupment to apply, the claim and the defense must “aris[e] from the same contract or transaction.” Townshend, 48 N.W. at 683. For example, a defendant may assert the defense of recoupment to reduce or eliminate the balance owed under a contract as the result of the plaintiff’s defective performance under that contract. See id. (stating that “a defendant may abate or bar the plaintiff’s claim, by proof of damages sustained by him by plaintiff’s non-performance of the agreement”); 37 Dunnell Minn. Digest, Pleading § 8.07[b] (6th ed. 2020) (citing cases). We have broadly interpreted the “same contract” requirement. In Pugh, we considered whether, under the recoupment doctrine, a plaintiff/creditor’s violation of the Federal Truth in Lending Act (TILA) could be used to reduce its recovery against the defendant/borrower in a breach of contract action. Pugh, 288 N.W.2d at 703–05. In answering this question, we rejected a narrow interpretation of the recoupment doctrine, adopted by some courts, which requires a recoupment claim to “arise directly from an obligation or covenant of the contract itself.” Id. at 705. Instead, we stated that recoupment is available under Minnesota law “where there is an action 3 Here, for example, although the district court declined to apply a recoupment defense, it applied the doctrine of setoff when it calculated the final amounts owed to each party. The district court found that the contractor was entitled to a $94,951.89 mechanic’s lien, that Coleman was entitled to a $278,622 negligence award, and it set off these awards so that Coleman collected the balance. The district court determined that the setoff did not affect the ultimate result of these competing claims, finding that the contractor prevailed on its mechanic’s lien claim, entitling it to reasonable attorney fees and costs on that claim and awarding the contractor $62,500 in attorney fees and costs. 11 upon a contract,” and there has been either (1) “a breach of the contract”; (2) a breach of “some divisible part” of the contract; or (3) a breach of an “obligation connected with” the contract. Id. (quoting C. Aultman & Co. v. Torrey, 57 N.W. 211, 211 (Minn. 1893)). Because we determined that the plaintiff/creditor’s responsibilities under TILA were an “obligation connected with” the contract, we concluded that recoupment was an available defense. Id. The recoupment defense is not limited to breach of contract claims. See Bull v. United States, 295 U.S. 247, 263 (1935) (permitting recoupment in a tax case brought by the federal government). We have repeatedly explained that, for recoupment to apply, the opposing claims must arise from the same contract or transaction. See Townshend, 48 N.W. at 683; Imperial Elevator Co., 204 N.W. at 532. In Pugh, we observed that recoupment can be defined as a defense “arising out of [s]ome feature of the transaction upon which the plaintiff’s action is grounded.” 288 N.W.2d at 705 (emphasis added) (quoting Bull, 295 U.S. at 262). And we have recognized a range of non-contract claims that can serve as the basis for a recoupment defense. See, e.g., Townshend, 48 N.W. at 682 (applying recoupment defense based on “allegations of incompetency and negligence” in connection with a storage warehouse lien); C. Aultman & Co., 57 N.W. at 211 (acknowledging “breach of warranty” as a basis for recoupment defense to a breach of contract claim); Pugh, 288 N.W.2d at 705 (holding that the violation of a federal statute could be the basis of a recoupment defense). 12 2. Here, Coleman asserted recoupment as a defense to the contractor’s mechanic’s lien foreclosure claim. She contends that the district court erred in failing to apply recoupment to extinguish the contractor’s mechanic’s lien. Before considering this argument, we briefly address mechanic’s liens. “A mechanic’s lien is a statutory remedy available to those who furnish labor or materials in the improvement of real property.” Ryan Contracting Co. v. O’Neill & Murphy, LLP, 883 N.W.2d 236, 243 (Minn. 2016); see also Minn. Stat. §§ 514.01–.16 (addressing liens against property). Under Minnesota’s mechanic’s lien statutes, “[w]hoever … contributes to the improvement of real estate,” Minn. Stat. § 514.01, has “a non-consensual lien or security interest in the improved property,” S.M. Hentges & Sons, Inc. v. Mensing, 777 N.W.2d 228, 230 (Minn. 2010). A lienholder may file a complaint and bring an action in district court to enforce, or foreclose, the lien. Minn. Stat. § 514.10.4 The district court then issues judgment “in favor of each lienholder for the amount demanded and proved.” Minn. Stat. § 514.14. Where, as here, the parties did not contract for a set price, the lien value is “for the reasonable value of the work done, and of the skill, material, and machinery furnished.” Minn. Stat. § 514.03, subd. 1(b). 4 To establish the right to a mechanic’s lien, the lienholder must show “that the real estate has been improved, that he supplied labor or materials, and that the labor or materials were supplied for one of the purposes stated in the statute.” Anderson v. Breezy Point Ests., 168 N.W.2d 693, 696 (Minn. 1969). The lienholder must also follow the procedural steps outlined in the statutes, which include giving notice to the property owner and filing a lien statement. Minn. Stat. §§ 514.011, 514.08. The parties do not dispute that the contractor met these requirements for a mechanic’s lien. 13 Section 514.14 provides that “[j]udgment shall be given in favor of each lienholder for the amount demanded and proved, with costs and disbursements to be fixed by the court at the trial.” We have interpreted this provision to permit the district court to award reasonable attorney fees to a lienholder. See, e.g., Klingelhutz v. Grover, 236 N.W.2d 610, 612 (Minn. 1975); Obraske, 199 N.W.2d at 431–32. The purpose of the mechanic’s lien statute is to protect “the rights of contractors to get paid.” Moore v. Robinson Env’t, 954 N.W.2d 277, 282 n.5 (Minn. 2021). A mechanic’s lien protects the rights of contractors by providing a mechanism for ensuring that those “whose property is enhanced in value by the labor and toil of others should be made to respond in some way by payment and full satisfaction” for the benefit received. Emery v. Hertig, 61 N.W. 830, 831 (Minn. 1895); see also Dolder v. Griffin, 323 N.W.2d 773, 779– 80 (Minn. 1982) (noting that mechanic’s lien statutes should be liberally construed “to effectuate their purpose of protecting the rights of workmen and materialmen who furnish labor and material for the improvement of real estate” (citation omitted) (internal quotation marks omitted)). B. We now turn to the question of whether Coleman may assert the defense of recoupment here. At the heart of the parties’ dispute regarding the applicability of the recoupment defense is the question we considered in Pugh—whether the claims arose from the “same transaction.” 288 N.W.2d at 704. If the contractor’s mechanic’s lien claim and Coleman’s negligence claim arose from the same transaction, recoupment is available 14 to Coleman. Conversely, if the claims did not arise from the same transaction, recoupment is not available. Both parties ask us to focus on the construction contract as the relevant transaction here. While the parties agree that the mechanic’s lien arose from the construction contract, they disagree as to whether the negligence claim arose from that contract. Coleman argues that, under our case law, recoupment is a broad and flexible doctrine that encompasses non-contract claims, such as negligence. She asserts that, as in Pugh, the contractor breached an “obligation connected with” the construction contract because every contractor owes a duty of care in connection with a construction contract in Minnesota. See Pac. Fire Ins. Co. v. Kenny Boiler & Mfg. Co., 277 N.W. 226, 228 (Minn. 1937) (“Where one person owes another a contractual duty to act, the law imposes upon the person owing that duty the further duty of acting with due care in the performance of his contract so as not to injure the contractee’s person or property.”). Thus, Coleman contends, because the jury’s negligence verdict against the contractor necessarily included a finding that the contractor breached its duty of care under the construction contract, the negligence claim “arose” from the contract. Accordingly, recoupment is an available defense because the negligence claim and the mechanic’s lien both arose from the construction contract. The contractor argues for a narrower application of the recoupment defense in this context. Citing our decision in C. Aultman, the contractor argues that our case law has “tethered” recoupment to “an action upon a contract.” C. Aultman, 57 N.W. at 211. According to the contractor, only construction defects “that negate the contract price for 15 the same improvement” qualify for recoupment. And conversely, “awards that are not paired to specific contracted-for items” remain separate judgments that can be handled by a setoff, as the district court did here. Accordingly, it asserts that recoupment is not an available defense here because the duties underlying Coleman’s negligence claim are distinct from the duties imposed by specific provisions in the construction contract. We conclude that recoupment applies here because the mechanic’s lien claim and the negligence claim both arose from the same transaction. In reaching this conclusion, however, we need not inquire whether both claims arise from the construction contract. Our approach is more straightforward. Because the claims arose from the construction project—specifically, the construction of Coleman’s home, separate from the existence of an enforceable contract—we conclude that the claims arose from the same transaction. Indeed, both a mechanic’s lien claim and a negligence claim may exist separate from a contract. Because mechanic’s liens are purely creatures of statute, “[n]o direct contractual relation with the owner is necessary” to create a mechanic’s lien. See Karl Krahl Excavating Co. v. Goldman, 208 N.W.2d 719, 721 (Minn. 1973); Minn. Stat. § 514.01. All that is necessary is “that the improvement be made with the consent of the owner, either express or implied.” Karl Krahl Excavating Co., 208 N.W.2d at 721. Likewise, as the contractor correctly observes, a negligence claim is based on tort law duties of care that may be independent of any provisions in a contract. See Pac. Fire Ins. Co., 277 N.W. at 228. Thus, rather than taking the circuitous route proposed by both parties—threading each claim through the construction contract—we determine that the construction project 16 itself is the relevant transaction in this case, and both claims arose out of that transaction. We reach that conclusion based on the particular circumstances of this case, which we outline below. In this case, both claims arose from the same transaction—the construction project. In other words, as we stated in Pugh, Coleman’s negligence claim arose out of “some feature of the transaction upon which” the contractor’s mechanic’s lien claim is grounded. Pugh, 288 N.W.2d at 705. The contractor’s mechanic’s lien claim arose from the construction project. See Minn. Stat. § 514.01 (stating that a lien is created when a party “contributes to the improvement of real estate by performing labor,” or by “furnishing skill, material or machinery”); see also Minn. Stat. § 514.05, subd. 1 (stating that a mechanic’s lien attaches “from the time the first item of material or labor is furnished upon the premises for the beginning of the improvement”). And Coleman’s negligence claim, which alleged that the contractor’s negligent work on the construction project damaged the property, also arose from the construction project. Because both claims arose from the same transaction, Coleman was entitled to assert the affirmative defense of recoupment and reduce the amount of the mechanic’s lien by the amount of damage caused by the contractor’s negligence. Negligence has long been accepted as a basis for a recoupment defense. See Thomas W. Waterman, A Treatise on the Law of Set-Off, Recoupment, and Counter Claim § 535 (2d ed. 1872) (“Damages incurred by the defendant through the negligence of the plaintiff may be interposed by way of recoupment.”). After all, a recoupment defense based on a party’s negligence serves a fundamental equitable principle underlying the 17 recoupment doctrine: a defendant may, by “meet[ing] the plaintiff on his own allegation,” “prove that [the plaintiff] did badly what he ought to have done well.” Waterman, supra, § 471.5 For example, in Townshend, we held that “incompetency and negligence on the part of defendant in the storing and keeping” of property may be recouped against a lien on that property. 48 N.W. at 682–83. We also have permitted the defense of recoupment in a mechanic’s lien foreclosure action. Knutson v. Lasher, 18 N.W.2d 688 (Minn. 1945). In Knutson, a building contractor brought a mechanic’s lien claim against multiple landowners. Id. at 690. We held that the landowners were “entitled to assert, by way of recoupment, a right to deductions for the damages resulting from plaintiff’s faulty performance.” Id. at 694. Similarly, in asserting a negligence defense to the mechanic’s lien claim here, Coleman alleged that, in building her home, the contractor did badly what it ought to have done well. Coleman was thus permitted to defend against the 5 This 1872 treatise on recoupment describes how the doctrine works in terms of a plaintiff’s negligence. It states: If the plaintiff’s demand be compounded of skill and materials, and he has greatly misconducted himself—as where an apothecary, giving medicines on his own judgment, and not under the direction of a physician, appears to have been grossly negligent, this fact furnishes a defense. Upon the same principle, if a physician sues me for services, I may give evidence that he has treated me unskillfully. Or, if a carpenter brings suit for work done for me, I may show that it was badly done. So, whatever be the nature of the services for which the plaintiff demands compensation, I may show that those services were ill performed. For, by such evidence, I do no more than meet the plaintiff on his own allegation. I prove that he did badly what he ought to have done well[.] Waterman, supra, § 471 (footnote omitted). 18 mechanic’s lien claim by seeking to eliminate the lien due to the contractor’s faulty performance. Finally, we clarify that, even in a breach of contract action, a recoupment defense need not arise from specific terms in the contract. We have never required a recoupment claim to directly track “defects that negate the contract price for the same improvement” or damages that can be “paired to specific contracted-for items,” as the contractor argues here. Nor does the reliance upon different sets of obligations itself—for example, a tort law duty versus a contract duty—preclude two claims from arising from the same transaction. In fact, in Pugh, we expressly rejected the requirement that a recoupment claim must “arise directly from an obligation or covenant of the contract itself.” 288 N.W.2d at 705. Instead, we stated that recoupment is available when there has been a breach of an “obligation connected with” the contract. Id. We thus reiterate the rule we set forth in Pugh: that recoupment is available in contract actions where there has been either: (1) a breach of the contract, (2) a breach of some divisible part of the contract, or (3) a breach of an obligation connected with the contract. Id. In actions not based in contract, recoupment may also be available when the defense “aris[es] out of [s]ome feature of the transaction upon which the plaintiff’s action is grounded.” Id. (quoting Bull, 295 U.S. at 262). In sum, because the contractor’s mechanic’s lien claim and Coleman’s negligence claim arose from the same transaction—namely, the construction project—Coleman may assert recoupment as a defense to the mechanic’s lien claim. 19 C. Finally, we consider whether recoupment extinguishes the contractor’s mechanic’s lien here. The district court determined that, even if recoupment was an available defense, it would merely reduce the amount of the contractor’s mechanic’s lien and would not “negate the initial lien or the right to attorney’s fees.” Coleman, on the other hand, argues that recoupment extinguishes the entire lien. She notes that the jury found that the contractor breached its duty of care and awarded Coleman $278,622 in damages. Thus, she asserts that the contractor’s mechanic’s lien on the property, which the district court valued at $94,951.89, should be reduced to zero by the negligence damages. She further argues that, because a mechanic’s lien operates to secure a debt, the contractor is not entitled to a mechanic’s lien because there was no debt to secure. And because there was no debt to secure, Coleman maintains that the district court abused its discretion by awarding attorney fees and costs for the enforcement of a nonexistent lien. Coleman asserts that the district court’s decision leads to the inequitable result of requiring Coleman to pay for the contractor’s attorney fees and costs incurred in attempting to secure a mechanic’s lien for a debt that Coleman did not owe. The contractor maintains that the district court correctly found that the lien amount was merely “satisfied” by the setoff against the jury’s negligence award and that the lien was not voided. It argues that, in effect, the district court applied recoupment when it adjusted the parties’ damages against one another in its order for judgment. The contractor further asserts that the entitlement to attorney fees for a mechanic’s lien is claim-specific—that being the “all-around winner” after other claims are factored in does 20 not matter. The contractor argues that it prevailed on the mechanic’s lien claim and thus should be entitled to the associated attorney fees, even if the amount of the lien was ultimately set off or recouped in the end. But the contractor’s argument misapprehends the role of recoupment as an affirmative defense. Unlike the doctrines of setoff and counterclaim, which concern how separate competing claims are handled at the end of litigation, recoupment is an affirmative defense. See Imperial Elevator Co., 204 N.W. at 532. As such, it affects the outcome of the mechanic’s lien claim to which the affirmative defense was asserted. See Rothensies v. Elec. Storage Battery Co., 329 U.S. 296, 299 (1946) (stating that recoupment “permit[s] a transaction which is made subject of suit by a plaintiff to be examined in all its aspects, and judgment to be rendered that does justice in view of the one transaction as a whole” (emphasis added)). Because recoupment and setoff are distinct doctrines, the district court did not, as the contractor argues, essentially apply recoupment when it set off the opposing claims. Accordingly, we now apply recoupment to determine whether the contractor is entitled to a mechanic’s lien valued at $94,951.89. We conclude that the contractor is not entitled to a mechanic’s lien because application of the doctrine of recoupment eliminated the lien. Satisfaction of a debt secured by a lien is a complete defense to a mechanic’s lien foreclosure action. See 53 Am. Jur. 2d Mechanics’ Liens § 307 (2026) (“Since an indebtedness in favor of the claimant must exist before a valid lien claim may be made, if the debt is discharged by payment, the lien is discharged.”). This principle goes to the very nature of a mechanic’s lien—the lien gives the claimant a security interest in the improved property. Mensing, 21 777 N.W.2d at 230. And because a security interest acts as security for a debt, when the debt is satisfied, the lien is extinguished as well. We applied this principle in Townshend and C. Aultman & Co. In Townshend, the defendant claimed that it had a warehouseman’s lien on the plaintiff’s property. 48 N.W. at 682. The plaintiff responded that negligence in the storage of that property had resulted in damages exceeding the lien amount. Id. at 682. Applying recoupment, we concluded that “there was nothing due defendant on the contract for storage, and consequently there could be no lien for storage.” Id. at 683. We stated that recoupment “was therefore a defense to the claim for lien, just as payment would have been.” Id. Similarly, in C. Aultman & Co., the damages caused by the plaintiff’s breach of warranty were equal to the amount owed to the plaintiff. 57 N.W. at 211. In such cases, we noted the recoupment defense is a “complete bar to plaintiff’s action.” Id. Likewise here, because the damages caused to Coleman’s property due to the contractor’s negligence exceeded the