
78 Wn. App. 384 (1995)
896 P.2d 1309
C-C BOTTLERS, LTD., Respondent,
v.
J.M. LEASING, INC., Appellant.
No. 13722-8-III.
The Court of Appeals of Washington, Division Three.
June 29, 1995.
*386 Stephen F. Faust, Paine, Hamblen, Coffin, Brooke & Miller, for appellant.
Timothy J. Giesa, Reed & Giesa, for respondent.
SWEENEY, A.C.J.
C-C Bottlers, Ltd. (CCB), sued J.M. Leasing, Inc. (JML), to collect two delinquent promissory notes. Both notes included a garden variety attorney fees clause which provided for recovery of the costs and expenses of collection, including suit.[1] JML answered and counterclaimed alleging, among other things, securities fraud. The court granted CCB's motion for summary judgment on the notes but delayed entry of the judgment until JML's counterclaims could be tried. The court entered a final judgment in favor of CCB on the notes and dismissed the counterclaims following a bench trial. It also awarded attorney fees and costs for the entire litigation based on the attorney fees provision in the notes. JML appeals.
*387 The question presented is whether the court properly awarded CCB that portion of the attorney fees attributable to its defense of JML's counterclaims. We conclude that it did not and reverse and remand.
[1, 2] A number of well settled legal principles apply to this controversy. Attorney fees may be awarded only when authorized by contract, statute or recognized ground in equity. Rorvig v. Douglas, 123 Wn.2d 854, 861, 873 P.2d 492 (1994); Gerken v. Mutual of Enumclaw Ins. Co., 74 Wn. App. 220, 229, 872 P.2d 1108, review denied, 125 Wn.2d 1005 (1994). The prevailing party in an action to enforce a contract is entitled to attorney fees and costs if the contract so provides. RCW 4.84.330; Seattle-First Nat'l Bank, N.A. v. Siebol, 64 Wn. App. 401, 409, 824 P.2d 1252, review denied, 119 Wn.2d 1010 (1992).
[3, 4] The trial court found that JML's counterclaims were "substantially interwoven and inseparable" from CCB's actions to obtain judgment on the notes. This finding is the basis for its award of fees. The issue presented, however, is not a factual one. It turns on the pleadings rather than the factual basis for those pleadings or the way in which this case was tried. Review therefore is de novo. Hilltop Terrace Homeowner's Ass'n v. Island County, 126 Wn.2d 22, 29, 891 P.2d 29 (1995). Also, whether a contract authorizes an award of attorney fees is a question of law, not an exercise of judicial discretion. Tradewell Group, Inc. v. Mavis, 71 Wn. App. 120, 126-27, 857 P.2d 1053 (1993).
CCB argues that the attorney fees clause in these notes reflects the intent of these parties to include claims (in this case counterclaims) which, while not directly related to recovery of the notes, must necessarily be defended in order to recover on the notes. The trial court agreed. It found that although JML designated its securities fraud claims as counterclaims, they were actually tried as affirmative defenses, which CCB had to overcome to obtain judgment on the promissory notes. We disagree. These counterclaims do not affect, nor are they affected by, the outcome of the promissory notes claims.
*388 [5, 6] JML's securities fraud claims are permissive counterclaims. Their objective was the equitable remedy of setoff, in the event CCB recovered on the notes. They did not avoid the obligation represented by the notes and therefore are not defenses; they are independent and unrelated claims asserted permissively. See CR 8(c), 13(b).[2] An affirmative defense cannot be adjudicated separately from the claims to which it applies; a counterclaim can. Reiter v. Cooper, 507 U.S. 258, 122 L.Ed.2d 604, 615, 113 S.Ct. 1213 (1993). Permissive counterclaims provide complete relief to the parties, conserve judicial resources and avoid multiple lawsuits. Warren, Little & Lund, Inc. v. Max J. Kuney Co., 115 Wn.2d 211, 216, 796 P.2d 1263 (1990).
[7] CCB urges that the counterclaims were filed as part of a litigation strategy, based on an assumption accepted by most litigators that the best defense is a good offense. The motive for filing the counterclaims, however, is not and should not be dispositive. If the counterclaims are frivolous, or brought in bad faith, fees are recoverable. CR 11; Bryant v. Joseph Tree, Inc., 57 Wn. App. 107, 114-15, 791 P.2d 537 (1990), aff'd, 119 Wn.2d 210 (1992). The practical effect of prevailing on the counterclaims may be the same as prevailing on an affirmative defense  JML does not have to pay the notes  but the legal distinctions between the two, as we have noted, are well settled.
CCB argues that the tactical use of the counterclaims here is demonstrated by JML's request to delay entry of summary judgment on the notes. JML argued that tender of *389 the shares (shares which are the subject matter of the counterclaims) to CCB in payment of the notes should have cut off interest and discharged certain guarantors of the notes. But this affirmative defense to payment of the notes (tender of the shares) was abandoned before trial. JML also raised tender of the shares as a defense to CCB's motion for summary judgment on the notes. But again the effort was successfully rebuffed by CCB. JML's pleadings and trial brief both assert the securities fraud counterclaims strictly as a setoff against any judgment on the notes.
[8] The costs and fees provision of the notes also limits recovery of costs and fees to collection of the notes. By its language, it extends to suits brought "herein", when attorneys are hired to compel payment of "this Note" or any indebtedness shown "hereby", "or to compel curing of any default hereunder". (Italics ours). In Tradewell, the court interpreted similar language as establishing only a right to attorney fees and costs for claims arising under the contract. Tradewell, at 129-30 (language authorizing fees for "any litigation" involving rights under the contract establishes only a right to fees incurred in litigation of contract-related claims). An action is on a contract if it arises out of the contract and the contract is central to the dispute. Tradewell, at 130.
[9] "[T]he prevailing party should be awarded attorney fees only for the legal work completed on the portion of the claim permitting such an award", because while collateral claims may well be related to the contract claim and therefore conveniently tried together, they need not be resolved in order to decide the primary claim. See King County. v. Squire Inv. Co., 59 Wn. App. 888, 897, 801 P.2d 1022 (1990), review denied, 116 Wn.2d 1021 (1991). Allowing recovery of fees for actions which do not authorize attorney fees would also give the prevailing party an unfair and unbargained for benefit. See Boeing Co. v. Sierracin Corp., 108 Wn.2d 38, 66, 738 P.2d 665 (1987). CCB's claims here arise from the promissory notes. The attorney fees *390 provision authorized recovery only for all legal expenses incurred in compelling payment of those notes. Tradewell, at 129.
CCB argues that the transcript of the trial, which JML failed to provide, might well support its argument that JML presented its counterclaims as affirmative defenses. We disagree. As we have noted, at issue are the causes of action spelled out in the pleadings, not the factual basis for those pleadings.
JML conceded its obligation on the notes. Its securities fraud claims could have been brought as separate actions. By requesting a delay in final judgment on the notes, JML simply preserved its right of setoff and in so doing conserved judicial resources. While CCB was forced to defend against the counterclaims before obtaining final judgment on the notes, the legal theories raised and defended in the counterclaim action were different from those presented in the action on the notes. Boeing Co., at 66.
The trial court erred in awarding fees to CCB for the total litigation. We remand with instructions to segregate those fees and costs incurred prosecuting the promissory notes claims, including fees and costs incurred responding to the affirmative defense, from those incurred in defending the securities fraud counterclaims. Boeing Co., at 66.
Neither party is entitled to attorney fees and costs on appeal.
MUNSON and SCHULTHEIS, JJ., concur.
NOTES
[1]  "9. Collection Costs and Expenses. In the event that suit is brought herein, or Holder employs an attorney or incurs expenses to compel payment of this Note or any portion of the indebtedness evidenced hereby or to compel the curing of any default hereunder, including expenses incurred by Holder incident to the bankruptcy or insolvency of Maker or any guarantor, Maker promises to pay all attorneys' fees, costs and expenses incurred by Holder".
[2]  "In pleading to a preceding pleading, a party shall set forth affirmatively accord and satisfaction, arbitration and award, assumption of risk, contributory negligence, discharge in bankruptcy, duress, estoppel, failure of consideration, fault of a nonparty, fraud, illegality, injury by fellow servant, laches, license, payment, release, res judicata, statute of frauds, statute of limitation, waiver, and any other matter constituting an avoidance or affirmative defense. When a party has mistakenly designated a defense as a counterclaim or a counterclaim as a defense, the court on terms, if justice so requires, shall treat the pleading as if there had been a proper designation". CR 8(c).

"A pleading may state as a counterclaim any claim against an opposing party not arising out of the transaction or occurrence that is the subject matter of the opposing party's claim". CR 13(b).
