
122 P.3d 1019 (2005)
BOARD OF COUNTY COMMISSIONERS OF the COUNTY OF BOULDER, Plaintiff-Appellant,
v.
KRAFT BUILDING CONTRACTORS, Alfred Gontar, and Stephen Shafroth, Defendants-Appellees.
No. 03CA1795.
Colorado Court of Appeals, Division V.
March 10, 2005.
Rehearing Denied May 5, 2005.
Certiorari Denied November 7, 2005.[*]
*1020 Jean E. Dubofsky, Boulder, Colorado; Paul Snyder, Westcliffe, Colorado, for Plaintiff-Appellant.
The Law Offices of John R. Henderson, P.C., John R. Henderson, Boulder, Colorado, for Defendant-Appellee Kraft Building Contractors.
*1021 Thomas J. Finch, Boulder, Colorado, for Defendants-Appellees Alfred Gontar and Stephen Shafroth.
Opinion by: Judge VOGT.
Plaintiff, the Board of County Commissioners of the County of Boulder (the County), appeals the trial court's order awarding defendants, Kraft Building Contractors, Alfred Gontar, and Stephen Shafroth (collectively, landowners), attorney fees in the amount of $325,000. We vacate the order and remand with directions.
In August 1998, the County filed a complaint in state court against landowners and other parties, alleging that the defendants were engaged in illegal grading activity on a road in the county. The County sought a declaration that the defendants were violating its building and land use codes; injunctive relief requiring that the defendants cease grading and reclaim the illegally graded property; and an award of the County's costs in bringing the action.
In October 1998, the case was removed to federal court upon the motion of one defendant, the federal Bureau of Land Management (BLM). Gontar and Shafroth then answered the complaint and filed counterclaims against the County. They asserted that the County's actions amounted to a taking of their property without due compensation and to inverse condemnation, and they sought actual and punitive damages, along with a declaration that they had the right to use and maintain the road without interference from the County. Kraft filed similar counterclaims and also asserted a claim under 42 U.S.C. § 1983 for deprivation of its property without notice. The County moved for dismissal of the counterclaims.
At a June 1999 hearing in federal court, the County's counsel advised the court that (1) it had named landowners and the BLM as defendants only because it believed they were indispensable parties, (2) its investigation had determined that another defendant was responsible for the grading and thus, potentially, for any court-ordered reclamation, and (3) it would voluntarily dismiss its complaint against landowners. The federal court granted the County's oral motion to dismiss, but noted that landowners' counterclaims against the County were not dismissed. It then remanded the remaining state law claims and counterclaims to state court, and it indefinitely stayed proceedings on the remaining federal counterclaims pending resolution of the state court proceeding.
In July 1999, landowners moved the state court for sanctions against the County, seeking attorney fees pursuant to § 13-17-101, et seq., C.R.S.2004, C.R.C.P. 11, and C.R.C.P. 121 § 1-15(7), based on the County's having brought its action against them without substantial justification and having filed a frivolous motion in federal court to dismiss their meritorious counterclaims.
On the day the first sanctions motion was filed, the County moved to dismiss all the defendants' state law counterclaims. Among other things, the County argued that landowners' inverse condemnation and taking claims were not ripe. The trial court agreed and, in December 1999, entered an order dismissing landowners' taking and inverse condemnation counterclaims pursuant to C.R.C.P. 12(b)(1).
In its dismissal order, the court found that, because landowners had not sought grading permits or a limited impact special review with the County, and because the County had dropped its action against them, there had been no final determination as to how they might use the road; thus, the taking and inverse condemnation claims were not ripe. Further, because the claims were not ripe at the time they were filed, they were not compulsory counterclaims, as Gontar and Shafroth had argued.
Although it dismissed the counterclaims, the trial court ruled that it would still consider landowners' motions for sanctions and attorney fees.
Evidentiary hearings on the motions for sanctions were held on seven days between April 2000 and July 2001. In July 2002, the trial court entered a forty-eight-page order finding the County liable for sanctions pursuant to C.R.C.P. 11, C.R.C.P. 121 § 1-15(7), and § 13-17-101, et seq. In a second order entered in August 2003, the court awarded landowners fees and costs totaling $325,000. *1022 The August 2003 order stated that the award included fees incurred while the case was pending in federal court, fees related to landowners' federal counterclaims, fees incurred in prosecuting the unsuccessful state law counterclaims, and fees incurred in litigating landowners' motions for sanctions and fees.
On appeal, the County does not challenge the trial court's determination that it was liable for sanctions for filing its complaint against landowners, and it does not challenge the reasonableness of the hourly rates charged by landowners' counsel. Rather, the County contends that the trial court erred in including in its award fees to which landowners were not entitled as a matter of law.
Although we generally review awards of attorney fees for abuse of discretion, we may review de novo the legal analysis relied on by the trial court in reaching its decision. See A. Tenenbaum & Co. v. Colantuno, 3 P.3d 456 (Colo.App.1999), aff'd, 23 P.3d 708 (Colo.2001); Fail v. Community Hospital, 946 P.2d 573 (Colo.App.1997), aff'd, 969 P.2d 667 (Colo.1998).

I.
The County contends that landowners may not recover the fees they incurred in pursuing their motions for sanctions. We agree.
A party is not automatically entitled to recover the expenses incurred in successfully pursuing a motion for sanctions. Instead, attorney fees may be awarded only if the trial court determines that the defense to the motion lacked substantial justification. Parker v. Davis, 888 P.2d 324 (Colo.App. 1994). Absent a finding that the defense to a motion for fees under § 13-17-102, C.R.S.2004, lacks substantial justification, it is error to award fees and costs incurred in challenging that defense. Foxley v. Foxley, 939 P.2d 455 (Colo.App.1996).
Here, neither the written order for sanctions nor the written order for fees includes any finding that the County's defense to the motions for sanctions and fees lacked substantial justification. When asked by counsel at the hearing to make such a finding, the trial court initially declined to do so, stating: "I don't think I need to. I don't think it's going to make any difference." When the issue was raised again, however, the court responded that making such a finding would be "difficult." It later stated that the County was entitled to bring to the court's attention cases supporting its defense to the motion, and added: "I can't make a finding that [the County's] assertion that I don't have jurisdiction [to award certain fees] based on those authorities is frivolous and groundless or . . . lacks substantial justification."
Having expressly declined to find that the County's defense lacked substantial justification, the trial court nevertheless stated in its fee order that the fees incurred by landowners in litigating "the issue of the award of fees relating to their Motion for Sanctions" were recoverable. We agree with the County that this ruling amounted to an error of law.
The record confirms that that County's defense to the motions for sanctions and fees did not lack substantial justification. For example, the County brought to the trial court's attention case law supporting its position that the court did not have jurisdiction to award certain of the fees sought by landowners. It also articulated rational grounds for its initial determination that landowners had to be named as defendants in the lawsuit because they were indispensable parties. See Board of County Commissioners v. Kobobel, 74 P.3d 401 (Colo.App.2002); Aztec Minerals Corp. v. Romer, 940 P.2d 1025 (Colo.App.1996). Although the trial court did not accept the County's indispensable party argument, the argument had a rational basis in fact and law and thus, at a minimum, was not a frivolous or groundless defense to a sanctions motion. See Lobato v. Taylor, 13 P.3d 821 (Colo.App.2000)(fact that court does not accept an argument does not make the argument frivolous), rev'd on other grounds, 70 P.3d 1152 (Colo.2003).
For these reasons, and especially in light of the trial court's express refusal to find that the County's defense to the sanctions motion lacked substantial justification, we conclude the trial court erred in including in its fee award the fees incurred by landowners *1023 in pursuing their motions for sanctions and attorney fees. The trial court is accordingly directed on remand to subtract the amount of those fees from the award.

II.
Most of the remaining fees awarded to landowners were incurred by them in pursuing their counterclaims and, particularly, in opposing the County's motions to dismiss the counterclaims. The County asserts that these fees should not have been awarded because: (1) awarding fees relating to counterclaims that were pursued after the complaint was dismissed violates the principle that the victim of a frivolous lawsuit has a duty to mitigate fees and costs incurred in responding to the action; (2) claims dismissed pursuant to C.R.C.P. 12(b) cannot be the basis for an award of attorney fees in favor of the parties whose claims were dismissed; and (3) the state trial court lacked jurisdiction to award fees incurred by landowners while the case was pending in federal court. We agree in part, and we conclude that a remand is required to determine whether certain of the fees at issue here may be included in the fee award.

A.
We first consider the availability of fees under C.R.C.P. 11 and § 13-17-102 for landowners' affirmative pursuit of their counterclaims.
C.R.C.P. 11 and § 13-17-102 both provide for an award of "reasonable" attorney fees against an attorney or party who has brought a civil action that lacks substantial justification. Implicit in the reasonableness requirement is a duty on the part of the party seeking fees to mitigate those fees. See Ruffing v. Lincicome, 737 P.2d 440 (Colo.App.1987)(trial court properly limited award of fees under § 13-17-102 where defendant did not take all reasonable measures to extricate himself from frivolous lawsuit at earliest possible time); see also White v. General Motors Corp., 908 F.2d 675 (10th Cir.1990)(upholding Rule 11 fee award but remanding for reconsideration of amount, where district court failed to consider whether injured party had complied with duty to mitigate its costs and fees); Napier v. Thirty or More Unidentified Federal Agents, 855 F.2d 1080, 1092 (3d Cir.1988)("Although Rule 11 sanctions are designed to deter frivolous lawsuits, the victim of a frivolous lawsuit is charged with a duty to mitigate, using reasonable means to terminate the litigation and to prevent the costs of that frivolous suit from becoming excessive."); Dubisky v. Owens, 849 F.2d 1034 (7th Cir.1988)(party defending against frivolous claim has duty under Rule 11 to mitigate fees and expenses, and hours expended in defense should correlate to merits of plaintiff's claim).
Here, the County argues that landowners' pursuit of their counterclaims, particularly after the complaint against them was dismissed, was a breach of their duty to mitigate their fees, leading to a sanctions award "grossly out of proportion to the seriousness of the issue in dispute." Landowners respond that their counterclaims were purely defensive and were "inextricably bound up with" their affirmative defenses.
We agree with the County that, under the principles set forth above, fees should not have been awarded under § 13-17-102 or C.R.C.P. 11 for any further prosecution of landowners' counterclaims after the County dismissed its complaint against them on June 8, 1999.
As to fees incurred in prosecution of the counterclaims before that date, we distinguish between fees incurred before the case was removed to federal court in October 1998 and fees incurred thereafter.
In regard to the fees incurred during the brief period before the action was removed to federal court, we perceive no basis for separating out work done on the counterclaims from work done in defense against the County's complaint. Further, at oral argument before this court, counsel for the County did not dispute landowners' entitlement to all fees incurred by them before the case went to federal court. Therefore, all such fees are properly included in the fee award.
As to fees incurred in connection with the counterclaims between October 1998 and June 8, 1999, we conclude that, for the reasons *1024 set forth in Part II(C), below, fees incurred in affirmatively prosecuting the counterclaims in federal court could not be awarded by the state trial court pursuant to § 13-17-102 because they did not generate any work product subsequently used in state court.

B.
However, this conclusion does not end the inquiry regarding the availability of fees incurred in connection with the counterclaims after the case was removed to federal court.
C.R.C.P. 121 § 1-15(7) permits a court to assess reasonable attorney fees against a party who files a frivolous motion. Here, landowners were entitled to pursue their counterclaims even after the complaint against them was dismissed. They were not entitled to fees under § 13-17-102 or C.R.C.P. 11 for doing so. However, if the County's motion to dismiss the counterclaims was wholly or partially frivolous, landowners would potentially be entitled to fees under C.R.C.P. 121 § 1-15(7). To determine whether they were, we must consider both the trial court's findings in its sanctions order and its December 1999 dismissal of landowners' state law counterclaims for unlawful taking and inverse condemnation.
The County asserts that, because it was "arguably" entitled under § 13-17-201, C.R.S.2004, to recover its own fees against landowners when the trial court granted its C.R.C.P. 12(b) motion to dismiss the counterclaims, its motion was as a matter of law not frivolous, and it should, at a minimum, not be required to pay any fees incurred by landowners in connection with the dismissed counterclaims.
We do not necessarily agree with the County that, given the nature of landowners' counterclaims, the County could have recovered its own fees under § 13-17-201 when those counterclaims were dismissed. See Jaffe v. City & County of Denver, 15 P.3d 806 (Colo.App.2000). Nevertheless, it is undisputed that the trial court dismissed landowners' counterclaims pursuant to C.R.C.P. 12(b)(1) in a written order in December 1999, and that the trial court did not rescind that order or otherwise direct that the counterclaims could be reinstated.
At the same time, the court's July 2002 sanctions order, which is essentially identical to the proposed order tendered by landowners, includes findings that the counterclaims were "meritorious" and that the County's motion to dismiss was "vexatious, groundless and frivolous."
The findings in the sanctions order cannot be reconciled with the prior order of dismissal. Based on the record before us, it appears that the County made certain unsubstantiated representations in defending against the counterclaims, but that dismissal on ripeness grounds was not erroneous to the extent it was premised on the absence of any final determination as to how landowners could use the road. See Reale Investments, Inc. v. City of Colorado Springs, 856 P.2d 91 (Colo.App.1993)(claim that application of governmental regulations effects a taking of property is not ripe until government has reached a final decision regarding application of regulations to property at issue).
In these circumstances, we conclude that a remand is required to permit the trial court to clarify whether the County's motion to dismiss the counterclaims was itself wholly or partially frivolous. If it was not, landowners are not entitled to fees incurred in defending against that motion. If it was, landowners would be entitled to some or all of their fees incurred in state court in defending against the motion and, as set forth below, some or all of the fees for work product generated in federal court but used in state court to oppose the County's motion to dismiss.

C.
In its August 2003 order awarding attorney fees, the trial court found that it had jurisdiction to award fees incurred by landowners while the case was pending in federal court, and that its jurisdiction "extends to any fees related to [landowners'] federal counterclaims." The County contends this ruling was erroneous. We again agree in part.
Section 13-17-102(1), C.R.S.2004, provides that a court may award reasonable attorney *1025 fees "in any civil action of any nature commenced. . . in any court of record in this state." However, neither the statute nor any Colorado appellate decision of which we are aware addresses the ability of a state court to award fees incurred in federal court proceedings in an action that was "commenced" in state court but then removed for a time to federal court. We therefore look to case law from other jurisdictions for guidance.

1.
We note initially that the fee award in this case was based on C.R.C.P. 11, C.R.C.P. 121 § 1-15(7), and § 13-17-101, et seq., and that the court did not distinguish between fees awarded pursuant to C.R.C.P. 11 and those awarded on other grounds. We conclude that, to the extent fees incurred during the federal court proceedings were awarded as a Rule 11 sanction based on the attorneys' conduct during those proceedings, such award was beyond the jurisdiction of the state trial court.
Whether to impose Rule 11 sanctions on attorneys for their conduct is necessarily a matter within the jurisdiction of the court in which the conduct occurred. See Kirby v. Allegheny Beverage Corp., 811 F.2d 253 (4th Cir.1987)(federal court lacked jurisdiction to impose Rule 11 sanctions for signing and filing state court complaint that was later removed to federal court); Major v. First Virginia Bank-Central Maryland, 97 Md.App. 520, 631 A.2d 127 (1993).
This principle is not rendered irrelevant here, as landowners contend, by the federal court's asserted parallel jurisdiction to award fees pursuant to § 13-17-102. In McCoy v. West, 965 F.Supp. 34 (D.Colo.1997), Judge Babcock  who also presided over the federal court proceedings in this case  denied a request for attorney fees under Fed.R.Civ.P. 11 and § 13-17-101 in a diversity action in which the plaintiff had voluntarily dismissed her claim against the party seeking fees. The court summarized the "safe harbor" provisions applicable to motions for sanctions under Fed.R.Civ.P. 11, and added:
Further, to the extent Colo.Rev.Stat. § 13-17-101 et seq. is inconsistent with the procedural safe-harbor provisions of Rule 11, it is preempted. "[A] federal district court in a diversity case is neither required, nor indeed permitted, to apply state law to a matter covered by a Federal Rule of Civil Procedure." Hiatt v. Mazda Motor Corp., 75 F.3d 1252, 1258 (8th Cir.1996).
McCoy v. West, supra, 965 F.Supp. at 35. The court then concluded that, because Fed.R.Civ.P. 11 included a "safe harbor" provision not found in § 13-17-101, et seq., and because the party requesting fees had not complied with the procedural requirements for seeking fees under the rule, the fee request would be denied.
Thus, we may not uphold the trial court's award of any fees incurred during the federal court proceedings to the extent the award was based on C.R.C.P. 11.

2.
We next consider the availability of federal court attorney fees under § 13-17-101, et seq., and C.R.C.P. 121 § 1-15(7).
Courts in other jurisdictions have held that state courts may not award attorney fees under their own statutes or rules if the fees were incurred solely in connection with federal claims in federal court proceedings. However, the state court may award fees incurred in producing work product during the federal proceedings that was also used in the state court proceedings.
In Major v. First Virginia Bank-Central Maryland, supra, an action had been filed in state court, then removed to federal court, and then remanded to state court following the plaintiff's voluntary dismissal of her federal claim. The state trial court awarded attorney fees under a Maryland rule providing for an award of fees if the conduct of any party was in bad faith or without substantial justification. The appellate court held that, while an award of fees was warranted, the trial court could not include attorney fees incurred during federal court proceedings for work relating to matters before the federal court. However, the court added, "appellees are entitled to fees for work product presented in [state] court even if that same work product was presented in federal court." Major, supra, 631 A.2d at 136.
*1026 In Lopez-Flores v. Hamburg Township, 185 Mich.App. 49, 460 N.W.2d 268 (1990), the court held that the state trial court had exceeded its authority when it awarded attorney fees incurred in defending a federal action that was based on the same facts as the pro se plaintiff's state action. Observing that it is ordinarily "the court in which services were rendered that should determine the amount of attorney fees awardable," the appellate court concluded: "The decision whether to award costs and attorney fees incurred in federal court should have been left to the federal judge who heard the matter, not a [state] court judge who had no jurisdiction over that case." Lopez-Flores, supra, 460 N.W.2d at 270.
We agree with the reasoning of these cases, and thus conclude that the trial court lacked jurisdiction to award fees under § 13-17-101, et seq., for activity related solely to federal court proceedings or landowners' affirmative pursuit of their counterclaims. However, to the extent landowners used their federal court work product in state court to defend against the County's motion to dismiss their counterclaims, they may be entitled under C.R.C.P. 121 § 1-15(7) to reimbursement of some or all of the fees incurred in generating that work product if the trial court on remand determines that the County's motion to dismiss was wholly or partially frivolous. See Major v. First Virginia Bank-Central Maryland, supra.
We vacate the order awarding attorney fees and remand the case to the trial court with directions to: (1) subtract from the fee award all fees incurred in litigating the motions for sanctions and attorney fees; (2) retain in the award all fees incurred up to the date the case was removed to federal court; and (3) determine whether the County's motion to dismiss landowners' counterclaims was frivolous in whole or in part. If the motion was not frivolous, no fees incurred after removal to federal court may be awarded. If the motion to dismiss was wholly or partially frivolous, the court is to award fees incurred in defending against the motion, or the frivolous parts of the motion, in state court, as well as fees incurred for work product developed in federal court but later used in defending against the motion or the frivolous parts thereof in state court. The trial court may conduct such further proceedings as it deems necessary to resolve these issues.
The order is vacated, and the case is remanded for further proceedings in accordance with the views set forth here.
Judge NIETO and Judge HAWTHORNE concur.
NOTES
[*]  Justice KOURLIS would grant as to the following issues:

Whether the court of appeals applied an incorrect rule that the award of attorney fees for expenses incurred in the pursuit of sanctions is only proper where the defense to the motion for sanctions lacked substantial justification.
Assuming that the court of appeals applied the correct rule concerning attorney fees for costs incurred in pursuing sanctions, whether the court of appeals misinterpreted the ruling of the trial court and therefore wrongly found that the trial court found no lack of substantial justification for the county's defense to the motion for sanctions.
