
128 P.3d 913 (2005)
142 Idaho 376
OLDCASTLE PRECAST, INC., d/b/a Amcor Precast, Plaintiff-Counterdefendant-Appellant,
v.
PARKTOWNE CONSTRUCTION, INC., Defendant-Counterclaimant-Respondent, and
Developers Surety and Indemnity Company, Defendant-Respondent.
No. 30549.
Supreme Court of Idaho, Boise, December 2005 Term.
December 22, 2005.
Rehearing Denied February 8, 2006.
*914 Glenn M. Harsh, Boise, for appellant.
Meuleman Mollerup LLP, Boise, for respondent Developers Surety and Indemnity Company. Arnold L. Wagner argued.
EISMANN, Justice.
This is an appeal from a decision of the district court denying a request for an award of attorney fees under Idaho Code § 54-1929. We affirm the district court.

I. FACTS AND PROCEDURAL HISTORY
In the fall of 2000, the Ada County Highway District awarded Park Towne Construction, Inc., (Park Towne) a contract to replace three small bridges in Ada County. Park Towne subcontracted with Oldcastle Precast, Inc., (Oldcastle) to provide precast concrete box culverts to be used in the construction project. After Oldcastle had completed its obligations under the subcontract, Park Towne refused to pay the balance owing. Prior to being awarded the contract, Park Towne had obtained a payment bond from Developers Surety and Indemnity Company, (Developers Surety) as required by Idaho Code § 54-1926. On September 7, 2001, Oldcastle filed a lawsuit against Park Towne and Developers Surety to recover the amount, plus interest, still unpaid under its subcontract. The Defendants answered denying liability, and Park Towne filed a counterclaim seeking damages against Oldcastle for breach of the subcontract.
The case was set for a court trial to commence on April 17, 2003. On the morning of the first day of the trial, Developers Surety paid Oldcastle the principal and interest owing under the subcontract. Oldcastle's counsel admitted it no longer had a cause of action against Developers Surety, and the trial then proceeded on Park Towne's counterclaim, with only Park Towne and Oldcastle participating. The district court found in favor of Oldcastle on the counterclaim.
The district court awarded Oldcastle attorney fees against Developers Surety and Park Towne up to the date of trial pursuant to Idaho Code § 54-1929. It refused to award Oldcastle attorney fees under that statute for successfully defending against Park Towne's counterclaim. Oldcastle then appealed.

II. ANALYSIS
Idaho Code § 54-1929 provides, "In any action brought upon either of the bonds provided herein, or against the public body failing to obtain the delivery of the payment bond, the prevailing party, upon each separate cause of action, shall recover a reasonable attorney's fee to be taxed as costs." The issue is whether, once Oldcastle had been paid all sums owing under the subcontract, this continued to be an action brought upon the bond. We hold that it did not.
Idaho Code § 54-1926 requires public works contractors to furnish a performance bond and a payment bond. The performance bond is "solely for the protection of the public body awarding the contract." I.C. § 54-1926(1). The payment bond is "solely for the protection of persons supplying labor or materials, or renting, leasing or otherwise supplying equipment to the contractor or subcontractors in the prosecution of the work provided for in such contract." I.C. § 54-1926(2). If a person who provided labor or material or supplied equipment is not paid within the time specified in Idaho Code § 54-1927, such person may sue on the payment bond "for the amount, or the balance thereof, unpaid at the time of institution of such suit." I.C. § 54-1927.
In this case, Oldcastle filed a lawsuit seeking to recover the amounts owing under the subcontract, and Park Towne filed a counterclaim for breach of contract. On April 17, 2003, Developers Surety paid Oldcastle the unpaid balance owing to Oldcastle under its subcontract with Park Towne, plus interest. Once that sum was paid, there was no further liability under the payment bond. A payment bond does not protect against all *915 disputes between a contractor and subcontractor. Beco Constr. Co., Inc. v. City of Idaho Falls, 124 Idaho 859, 865 P.2d 950 (1993) (a payment bond does not protect against the time and expense of attempting to correct or seek a remedy for defective work). The payment bond required by Idaho Code § 54-1926(2) only protected Oldcastle against nonpayment of sums due under its subcontract.
Once Developers Surety had paid all sums owing under the subcontract, this ceased to be an action brought upon the bond because Developers Surety had no further liability under the bond. It became solely an action on Park Towne's counterclaim for breach of contract. Oldcastle's counsel admitted that, once payment had been made, Oldcastle no longer had a cause of action against Developers Surety, and Developers Surety did not participate in the trial on Park Towne's counterclaim.
Idaho Code § 54-1929 creates a statutory duty to pay attorney fees to the prevailing party in actions brought under either the performance bond or the payment bond. The district court properly awarded Oldcastle attorney fees incurred by it up to the date it was paid all sums due under the bond. The attorney fees incurred by Oldcastle after it had been paid in full were not incurred in an action under the performance bond. Therefore, the district court correctly held that Oldcastle was not entitled to attorney fees under Idaho Code § 54-1929 for successfully defending against Park Towne's counterclaim for breach of contract. Oldcastle would have been entitled to an award of attorney fees under Idaho Code § 12-120(3) for successfully defending against the counterclaim, Iron Eagle Development, LLC v. Quality Design Systems, Inc., 138 Idaho 487, 65 P.3d 509 (2003); Ervin Constr. Co. v. Van Orden, 125 Idaho 695, 874 P.2d 506 (1993), but it did not request attorney fees under that statute.
The dissent relies upon the reasoning in First General Services v. Perkins, 918 P.2d 480 (Utah Ct.App.1996), to argue that Idaho Code § 54-1929 should be construed in this case to provide for the awarding of attorney fees to Oldcastle for successfully defending against Park Towne's counterclaim. There is a significant difference between this case and that one. In this case, prior to the trial Developers Surety paid Oldcastle in full all sums due under the payment bond and did not participate in the trial. At that point, this ceased to be an action upon the bond. Oldcastle's counsel conceded to the district court that Oldcastle no longer had a claim against Developers Surety. In the Utah case, the lien claimants were not paid in full, and the landowner whose property was subject to the mechanics' liens participated throughout the trial in an unsuccessful attempt to keep the lien claimants from being paid. Had Oldcastle not been paid in full prior to the trial, then the entire litigation would have been an action on the bond because it would have been required to prevail on the counterclaim in order to receive payment under the bond. That is not what happened in this case, however.
Because Developers Surety had already paid Oldcastle in full, the only issue tried in this case was whether Park Towne was entitled to recover damages against Oldcastle for breach of contract. That would be an action on the payment bond only if either party were attempting to recover sums that Developers Surety was obligated to pay under its payment bond. Neither party was. Developers Surety had no obligation to pay either party further sums under the payment bond regardless of who prevailed on the counterclaim. Idaho Code § 54-1927 provides that a person furnishing labor or material under a public works construction contract "shall have the right to sue on such payment bond for the amount, or the balance thereof, unpaid at the time of institution of such suit." Prior to trial, Developers Surety paid Oldcastle all sums "unpaid at the time of institution of such suit," plus interest. Therefore, the litigation on the counterclaim was not an action on the payment bond, nor was it an action seeking to keep Developers Surety from having to pay any sums due under the payment bond.
In support of its position, the dissent states, "Developers Surety was in a better position than Oldcastle to discourage Park Towne from pursuing its counterclaim, which *916 turned out to be without merit." There is absolutely nothing in the record supporting this factual finding, nor does the dissent explain how Developers Surety could have prevented Park Towne from pursuing its counterclaim. The dissent also states that the defense against Park Towne's counterclaim, "if successful, would reduce Oldcastle's recovery for its work and inure to the benefit of the surety." Again, there is nothing in the record to support that assertion. Developers Surety had already unconditionally paid Oldcastle in full, so the outcome of Park Towne's counterclaim could not lessen the amount of money that Developers Surety was required to pay Oldcastle under the payment bond. Developers Surety had not asserted any claim against Oldcastle, and so it could not recover any money back from Oldcastle. If Park Towne recovered damages from Oldcastle, that would only benefit Park Towne.
Both parties also request an award of attorney fees on appeal. Oldcastle requests attorney fees under Idaho Code § 54-1929. Because Oldcastle is not the prevailing party and this is not an appeal from a judgment upon the payment bond, Oldcastle is not entitled to an award of attorney fees under that statute.
Developers Surety seeks an award of attorney fees pursuant to Idaho Code § 12-121. Attorney fees could be awarded against Oldcastle under that statute only if it brought or pursued the appeal frivolously, unreasonably, or without foundation. BHA Invs., Inc. v. City of Boise, 141 Idaho 168, 108 P.3d 315 (2004). The legal issue raised by Oldcastle was a matter of first impression, and it therefore did not bring or pursue this appeal frivolously, unreasonably, or without foundation. KMST, LLC v. County of Ada, 138 Idaho 577, 67 P.3d 56 (2003).

III. CONCLUSION
The judgment of the district court is affirmed. We award costs on appeal, but not attorney fees, to Developers Surety.
Justices TROUT and BURDICK concur.
Justice JONES, dissenting.
Because the counterclaim Park Towne unsuccessfully pursued against Oldcastle was related directly to the subcontract work that Oldcastle was seeking to recover for when this suit was initiated, I believe that Idaho Code § 54-1929 must be construed to allow attorney fees for successfully defeating the counterclaim. To hold otherwise would impair the rights afforded to mechanics, laborers, and materialmen under the laws of Idaho.
Idaho has a strong tradition of supporting the right of laborers and materialmen to obtain payment for their work and materials. Indeed, the Idaho Constitution provides that, "The legislature shall provide by proper legislation for giving to mechanics, laborers, and material men an adequate lien on the subject matter of their labor." § 6, Art. XIII, Idaho Constitution. In compliance with this provision, the Legislature enacted legislation in 1893 providing for a lien in favor of mechanics, laborers, and materialmen against the property for which they furnished their labor or materials in order to secure payment for the same. 1893 Session Laws, pp. 49-54. Section 2 of the enactment provided that subcontractors, laborers, and other persons could lien the public works of any county, city, town or school district. Section 12 of the enactment contained an attorney fee provision, which is identical to the current such provision in the mechanics' lien law. Idaho Code § 45-513. In 1909, the Legislature enacted a public works bonding provision, which is the predecessor of Idaho Code §§ 54-1925, et seq. That provision subsequently became Idaho Code § 45-502, which was repealed in 1965 concurrent with the enactment of the current public works bonding scheme. 1965 Session Laws, ch. 28. The 1909 bonding provision "was taken almost bodily from the [Miller] act [40 U.S.C. § 270] ..." People v. Storm, 49 Idaho 246, 253, 287 P. 689, 691 (1930).
This Court declared a rewrite of Section 2 of the 1893 enactment to be unconstitutional in 1928, holding the liening of public buildings to be violative of the debt limitation provisions in Sections 3 and 4 of Art. VIII of the Idaho Constitution. Boise-Payette Co. *917 v. School Dist. No. 1, 46 Idaho 403, 268 P. 26 (1928). Thereafter, the only statutory protection for laborers and materialmen for labor and materials furnished for the construction of public works was the bonding provision contained in subsequent versions of the 1909 enactment. People v. Storm, 49 Idaho at 253, 287 P. at 691.
This brief history is provided to show that the mechanics' lien law and public works bonding law were born of common parentage. Both were enacted shortly after statehood to carry out the constitutional responsibility of the Legislature to provide for the protection of laborers and materialmen. The attorney fee provisions  I.C. § 45-413 and I.C. § 54-1929  should be interpreted and applied in a similar fashion, at least at the trial court level. Indeed, the latter section should probably tilt even more in favor of laborers and materialmen because of its Miller Act history. In City of Weippe v. Yarno, 96 Idaho 319, 321, 528 P.2d 201, 203 (1974), this Court, after noting the parallel between the federal Miller Act and Idaho's public works bonding provisions, stated:
In People v. Storm, 49 Idaho 246, 254, 287 P. 689 (1930), this Court stated:
The Federal statute, from which our is taken, has been held to be highly remedial, and should, therefore, be liberally construed to cover all persons who supply labor or material in a public work, to give all creditors a remedy on the bond of the contractor to be enforced within the time stated, etc., and that the strict letter of the act must `yield to its evident spirit and purpose, when this is necessary to give effect to the intent of Congress.'
See, also, Minidoka County v. Krieger, 88 Idaho 395, 407, 399 P.2d 962, 969 (1965) (laws like former I.C. § 45-502 are highly remedial and are to be construed liberally in favor of labor and materialmen to effectuate their purpose).
Both I.C. § 54-1929 and § 45-513 provide for a mandatory award of attorney fees to a laborer or materialman who prevails on a claim for labor or materials. I.C. § 54-1929 provides:
In any action brought upon either [the performance bond or the payment bond], or against the public body failing to obtain the delivery of the payment bond, the prevailing party, upon each separate cause of action, shall recover a reasonable attorney's fee to be taxed as costs.
The separate cause of action language is likely to cover the situation where multiple actions are involved  an action on the payment bond, and/or an action on the performance bond, and/or an action against a public body that fails to obtain a payment bond.
Idaho Code § 45-513 provides that "[t]he court shall also allow as part of the costs the moneys paid for filing and recording the claim, and reasonable attorney's fees." An award of fees is mandatory upon a successful foreclosure, the rationale being that fees are incidental to the foreclosure of the lien and are merged with and become part of the principal debt on which foreclosure is sought. Electrical Wholesale Supply Co. v. Nielson, 136 Idaho 814, 823-24, 41 P.3d 242, 251-52 (citing Smith v. Faris-Kesl Constr. Co., Ltd., 27 Idaho 407, 423, 150 P. 25, 30 (1915)). Similarly, in "an action on a contractor's bond attorney's fees are merely an incident of the judgment and not a separate cause of action." City of Weippe v. Yarno, 94 Idaho 257, 259, 486 P.2d 268, 270 (1971).
While no Idaho case has discussed whether a party who succeeds in foreclosing on a lien or in suing on a public works contractor's bond may also recover fees for successfully defending a counterclaim, the Utah Court of Appeals has held that a subcontractor may recover fees where the counterclaim is sufficiently tied to the lien. Utah Code Ann. § 38-1-18 provides: "In any action brought to enforce any lien under this chapter the successful party shall be entitled to recover a reasonable attorneys' fee, to be fixed by the court, which shall be taxed as costs in the action." In First Gen. Servs. v. Perkins, 918 P.2d 480 (Utah Ct.App.1996), a subcontractor sued the contractor and landowner for work it had performed, both to foreclose on the lien and for breach of contract. 918 P.2d at 483. The landowner counterclaimed for breach of contract, fraud, negligent misrepresentation, slander of title, conversion, unjust *918 enrichment, and constructive trust. Id. The trial court entered judgment for the plaintiff but refused to award fees under Utah's mechanics' lien attorney fee statute for the successful defense of the counterclaims. Id. On appeal, the landowner urged the court to construe the statute narrowly and limit fees to those incurred in prosecuting or defending the lien claim. Id. at 486. The court declined to do so in light of "the general policy of Utah courts ... to construe the statutes broadly to protect those who enhance the value of property by supplying labor or materials." Id. Rather, the court held that:
the successful defense of counterclaims which would otherwise defeat the principal lien claim, in whole or in part, must necessarily be considered for the purpose of awarding attorney fees under the mechanics' lien statute. Logically, a lien holder must defend against such claims in order to "enforce" the lien. Nevertheless, the principal claim and counterclaims must be sufficiently tied together so that the right to enforce the lien would be defeated or diminished by the counterclaim. Counterclaims completely separate from the lien claim, which merely seek to offset amounts recoverable through enforcement of a mechanics' lien, would not qualify.
Id. Thus, where the counterclaims were "sufficiently tied to enforcement of the lien," fees incurred in defending those counterclaims were allowed. Id. at 487.
The rationale articulated by the Utah Court of Appeals is sound. An important factor in the court's decision was its determination that an action "brought to enforce any lien", within the contemplation of the fee statute, included a counterclaim that would defeat or diminish the claimant's recovery for his work or materials. Id. at 486. Here, rather than being an action brought upon the lien, we have an "action brought upon" the bond. I.C. § 54-1929. All three of the claims asserted in the counterclaim were designed to defeat or diminish Oldcastle's claim for work under the subcontract. They were compulsory counterclaims, arising out of the transaction that was the subject matter of Oldcastle's claim. Idaho R. Civ. P. 13(a). Oldcastle could hardly find comfort in the result obtained in district court  it established its entire claim and defeated the three claims asserted by Park Towne in the counterclaim but ended up worse off financially than if it had just dropped the whole matter in the first place. This result is not in keeping with the intent of Art. XIII, § 6, nor in keeping with the highly remedial intent and spirit of Idaho's version of the Miller Act.
Some scant Idaho precedent does exist to support the result I would adopt.[1] This Court has held that a claim for attorney fees may be denied in a lien foreclosure action where a counterclaim results in a complete setoff of a materialman's claim for materials. Dawson v. Eldredge, 89 Idaho 402, 409, 405 P.2d 754, 758 (1965). Consistent with Dawson, the Idaho Court of Appeals has held that where the lien claimant only partially prevailed, having his recovery reduced by a counterclaim alleging damages as a result of defects in the work, the district court "may, in the exercise of its discretion, fashion the amount of the award to reflect the fact that [the claimant] did not collect the entire amount of the contract and the [property owners] were awarded damages for the defects in the work performed." Olsen v. Rowe, 125 Idaho 686, 689, 873 P.2d 1340, 1343 (Ct.App.1994). Following this same line of logic, a lien claimant should get a larger award of fees where he has not only established his full claim but also defeated counterclaims alleging deficient performance.
Such a rule is not unfair to the surety furnishing the bond. One could anticipate such a result based upon the constitutional and statutory policy in favor of allowing laborers and workmen to obtain payment for their work. In this case, Developers Surety was aware that Oldcastle wished to recover attorney fees on the bond for its defense of the counterclaim. While Oldcastle's counsel noted prior to trial, and after receiving payment of the balance of the subcontract, that it had no remaining cause of action against Developers Surety, he did advise the court that Oldcastle would be seeking attorney fees *919 incurred in defending Park Towne's counterclaim. The trial court recited, "[Oldcastle's] counsel did not object to Developer's being excused from further attendance at trial, so long as [Oldcastle] could still pursue attorney fees and costs, including those fees incurred in trying the case." Developers Surety made a conscious choice to forego attendance at the trial.
Developers Surety was in a better position than Oldcastle to discourage Park Towne from pursuing its counterclaim, which turned out to be without merit. Instead of doing so, Developers Surety withdrew from the litigation, allowing Park Towne to run up Oldcastle's considerable expense for successfully defending against claims designed to take away the money that Developers Surety had paid before trial. Developers Surety claims it should be immunized from liability for Oldcastle's attorney fees incurred in defending against counterclaims which, if successful, would reduce Oldcastle's recovery for its work and inure to the benefit of the surety. This is not the type of result contemplated by the applicable constitutional and statutory protections for those who furnish labor and materials.
I would not only reverse and remand with instructions to the trial court to award fees for Oldcastle's successful defense of the counterclaim but also award fees to Oldcastle on appeal. In this regard, it appears that the Legislature provided for a departure from the manner in which attorney fees on appeal are handled, i.e. denied, in actions under the mechanics' lien law. Up until the 1965 legislative change, public works bonding cases were subject to the same attorney fee provision as that which applied to mechanics' lien cases. The 1965 legislation, which produced I.C. § 54-1929, utilized a different selection of wording, which is significant.
Attorney fees have been consistently denied on appeal to successful lien claimants based upon a quaint 1936 case, Hendrix v. Gold Ridge Mines, Inc., 56 Idaho 326, 54 P.2d 254 (1936). The Hendrix decision has been followed ever since. The rationale of the decision was succinctly described in Weber v. Eastern Idaho Packing Corporation, 94 Idaho 694, 698, 496 P.2d 693 (1972), as follows:
This Court in Hendrix v. Gold Ridge Mines, Inc. ... held that what is now I.C. § 45-513 did not permit recovery of attorney fees on appeal for the lien claimants. The Court reasoned that this particular statute was adopted from the California lien statutes which expressly provided for attorney fees in the supreme court but since that proviso was deleted in the Idaho statute the intent of the legislature was to disallow attorney fees on appeal.
The Weber court further supported the Hendrix rule by determining that "the court", as used in Section 45-513, was "in a context where the meaning is the `trial court.'" If the Weber court had examined the language in I.C. § 12-121  "the judge may award reasonable attorney's fees to the prevailing party"  that provision may well have received a different interpretation as to whether or not fees were permitted on appeal. Nevertheless, when the Legislature enacted I.C. § 54-1929, it did not have the same history as § 45-513, nor was the same or similar wording used. Rather, § 54-1929 provides that "[i]n any action" brought on the bond, the prevailing party shall recover a reasonable attorney's fee. There is no reference to "judge" or "court" so as to limit fees at any stage of the proceeding.
As a matter of fact, this Court has awarded fees on appeal under I.C. § 54-1929 on a number of occasions. City of Weippe v. Yarno, 96 Idaho 319, 528 P.2d 201 (1974); Consolidated Concrete v. Empire West Const., 100 Idaho 234, 596 P.2d 106 (1979); H-K Contractors, Inc. v. City of Firth, 101 Idaho 224, 611 P.2d 1009 (1979). The Idaho Court of Appeals has held otherwise, apparently overlooking this Court's decisions and understandably concluding that since fees are not awarded on appeal under Section 45-513 the Court should decline "[b]y parity of reasoning" to award fees on appeal under Section 54-1929. Eimco Div., Envirotech v. United Pacific, 109 Idaho 762, 765, 710 P.2d 672, 675 (Ct.App.1985). However, the Court of Appeals did not examine the different histories of these two provisions, nor the difference in the language employed by the Legislature. *920 Thus, I would overrule the Court of Appeals' contrary holding in Eimco Div., Envirotech and hold that I.C. § 54-1929 requires an award of attorney fees to the successful party on appeal.
I dissent for the foregoing reasons. I would award attorney fees on appeal to Oldcastle, reverse the district court's denial of fees for defending the counterclaim at trial, and remand for consideration and assessment of an appropriate fee.
Chief Justice SCHROEDER concurs.
NOTES
[1]  Beco Constr. Co., Inc. v. City of Idaho Falls, 124 Idaho 859, 865 P.2d 950 (1993) has no bearing on the attorney fee issue. That case involved a bid dispute.
