Gerald Timm, et al., (Timms) appeal from a judgment dismissing their claims against the Portage County Drainage District and members of the Portage County Drainage Commission (defendants). Okray Produce Company, Inc., et al., property owners within the drainage district, were permitted to intervene against the Timms in the trial *746court. The dispositive issues on appeal are (1) whether defendants are immune from suit pursuant to sec. 893.80(4), Stats.,1 and (2) whether the trial court abused its discretion in denying the Timms equitable relief. On cross-appeal, defendants seek costs and attorney fees pursuant to secs. 814.04(9) and 823.08(4), Stats.2 We conclude that defendants are immune from suit pursuant to sec. 893.80(4) and that the trial court abused its discretion in denying the Timms equitable relief. With regard to the cross-appeal, we conclude that defendants cannot recover costs and attorney fees under secs. 814.04(9) and 823.08(4). Therefore we affirm in part, reverse in part, and remand for further proceedings.
The Timms are farmers whose land lies within the Portage County Drainage District. The Timms’ property lies adjacent to drainage ditches Nos. 3, 4 and 8, which the defendants control and manage. In August 1982, defendants removed stop logs from dams 12 and 53, thereby lowering the water level in the ditches. The Timms claim this caused substantial widening and deepening of the ditches resulting in soil erosion, destruction of trees and vegetation and decreased property and crop values.
*747The Timms began this lawsuit alleging the following causes of actions: (1) violation of secs. 88.63, .71 and .72, Stats;3 (2) violation of sec. 844.01, Stats;4 (3) private nuisance; (4) negligence; and (5) unlawful trespass. Defendants denied that any of their acts were wrongful or that they breached any duty owed to the Timms. They also claimed immunity from suit under sec. 893.80(4), Stats., which provides: "No suit may be brought against any ... governmental subdivision or agency thereof... or against its officers ... for acts done in the exercise of ... quasi-judicial functions.”
The determination of whether defendants are immune from suit under sec. 893.80(4), Stats., requires statutory interpretation. We review such questions de novo. E.S. v. Seitz, 141 Wis. 2d 180, 184, 413 N.W.2d 670, 672 (Ct. App. 1987).
*748"'The purpose of [governmental] immunity is "to insure that courts refuse to pass judgment on policy decisions in the province of coordinate branches of government... [if] such a policy decision, consciously balancing risks and advantages, took place.’”” Scarpaci v. Milwaukee County, 96 Wis. 2d 663, 687, 292 N.W.2d 816, 827 (1980) (citation omitted).5 Therefore, in order for a public officer to claim sec. 893.80(4), Stats., immunity to a suit based on his or her allegedly wrongful act, that act must be: (1) within the public officer’s lawful jurisdiction, id. at 696, 292 N.W.2d at 831; and (2) based on a policy decision, consciously balancing risks and advantages. Id. at 687, 292 N.W.2d at 827.
Section 88.21, Stats., provides in part: "In addition to other powers expressly granted or necessarily implied, the drainage board may: ... (10) With the consent of the court ... operate all ... floodgates ... necessary to the successful drainage ... of any district ....” It is undisputed that the dams are floodgates and that defendants have the court’s consent to operate the dams. We conclude that the defendants had jurisdiction to operate the dams.
*749However, the Timms argue that defendants lost their jurisdiction because, by removing the stop logs and permitting erosion to proceed, they knowingly enlarged the ditches without following proper statutory procedures.6 Therefore, the Timms claim that defendants lost their sec. 893.80(4), Stats., immunity.
We disagree. The removal of the stop logs is not the activity that sec. 88.71, Stats., seeks to control. If a drainage board wishes to substantially and materially alter, enlarge or extend the drainage ditches, it must follow the procedure outlined in sec. 88.71. Section 88.71 applies to intentional alteration activities, such as dredging, excavating, extending or enlarging the ditches through direct mechanical means. It does not apply to alteration of the ditches by the action of the water itself.7 It would be absurd to follow the procedure outlined in sec. 88.71 to remove or install a stop *750log. We will not interpret a statute to reach an absurd result. State v. Yellow Freight System, Inc., 101 Wis. 2d 142, 153, 303 N.W.2d 834, 839 (1981). The defendants were not required to follow sec. 88.71 procedure to remove the stop logs.
Having concluded that defendants had jurisdiction to operate the dams, we now determine whether defendants’ action in removing the stop logs was "quasi-judicial” or discretionary, Scarpaci, 96 Wis. 2d at 683, 292 N.W.2d at 826, and therefore entitled to immunity. The Timms argue that defendants’ action in removing the stop logs was an act of operational discretion, not policy discretion, and thus not protected by governmental immunity. See Gordon v. Milwaukee County, 125 Wis. 2d 62, 68-69, 370 N.W.2d 803, 807 (Ct. App. 1985) (planning discretion, but not operational discretion, entitled to immunity). The Timms assert that the only policy or "planning” discretion in this case occurred when the drainage district was organized, and when the drains were originally constructed. We reject this analysis. The question is whether defendants made their decision to remove the stop logs after consciously balancing risks and advantages. Scarpaci, 96 Wis. 2d at 687, 292 N.W.2d at 827.
In August 1982, a number of farmers complained to defendants that too much water was being held behind dam 12, and that this resulted in wet field conditions. One of the defendants testified that the conditions were getting so serious that certain area farmers "couldn’t harvest their crops,” and that the area farmers "were losing their hay and other crops and everything.” The Timms, however, wanted the stop logs to remain.
The trial court found that "the drainage board balanced the interests of the agricultural concerns of *751surrounding farmers against the erosion problems and agricultural issues that Mr. Timm raised.” We uphold a trial court’s factfindings unless clearly erroneous. Sec. 805.17(2), Stats.; Noll v. Dimiceli’s, Inc., 115 Wis. 2d 641, 643, 340 N.W.2d 575, 577 (Ct. App. 1983).
The trial court’s finding that defendants balanced the competing interests in making the stop log decision is supported by the record and is not clearly erroneous. Defendants’ decision to remove the stop logs and their decision not to replace them were policy decisions inasmuch as these decisions were the result of a conscious balancing of risks and advantages. Gordon, 125 Wis. 2d at 65-66, 370 N.W.2d at 805. Defendants are entitled to sec. 893.80(4), Stats., immunity.
The Timms suggest that if defendants are immune from suit under sec. 893.80(4), Stats., this results in an unconstitutional interpretation of the drainage laws. We have not found in the record any notice to the attorney general that the Timms are challenging the laws’ constitutionality. Therefore we do not consider this argument. Kurtz v. City of Waukesha, 91 Wis. 2d 103, 117, 280 N.W.2d 757, 764-65 (1979).
The Timms do not argue that they may sue defendants in spite of their immunity under sec. 893.80(4), Stats. Therefore we do not address this issue.8
*752The Timms argue that the trial court erred by not ordering defendants to repair the drainage ditches, as required by sec. 88.63, Stats. The Timms had requested the trial court to order defendants to take measures to prevent the ditches on the Timm farm from becoming further eroded and enlarged, and to repair the damage already done to the ditches. The trial court denied the Timms’ request, concluding that the Timms had "unclean hands,” and were thus ineligible for equitable relief.
Whether to award equitable relief is within the trial court’s discretion. See Prince v. Bryant, 87 Wis. 2d 662, 674, 275 N.W.2d 676, 681 (1979); American Med. S., Inc. v. Mutual Fed. S. & L., 52 Wis. 2d 198, 205, 188 N.W.2d 529, 533 (1971) (trial court has power to apply and adapt remedy to meet needs of particular case). A trial court abuses its discretion if it relies upon an erroneous view of the law or bases its decision upon irrelevant factors. Barstad v. Frazier, 118 Wis. 2d 549, 554, 348 N.W.2d 479, 482 (1984).
"For relief to be denied a plaintiff in equity under the 'clean hands’ doctrine, it must be shown that the alleged conduct constituting 'unclean hands’ caused the harm from which the plaintiff seeks relief.” Security Pac. Nat. Bank v. Ginkowski, 140 Wis. 2d 332, 339, 410 N.W.2d 589, 593 (Ct. App. 1987). "The court must clearly see that it is the fruit of his own wrong, *753or relief from the consequences of his own unlawful act, which the plaintiff seeks, before his action can be dismissed.” Clemens vs. Clemens and wife, 28 Wis. 637, 655 (1871) (emphasis in original).
The principle that a plaintiff who asks affirmative relief must have clean hands before the court will entertain his plea is both ancient and universally accepted. ... The general principle simply is that he who has been guilty of substantial misconduct "in regard to, or at all events connected with, the matter in litigation, so that it has in some measure affected the equitable relations subsisting between the two parties and arising out of the transaction,” shall not be afforded relief when he comes into court ....
Huntzicker v. Crocker, 135 Wis. 38, 41-42, 115 N.W. 340, 341-42 (1908).
The trial court said: "The Court expects you to have what we call clean hands in equity; that means that you’ve done everything that you can to correct that problem at the same time.” The court based its decision to refuse the Timms’ request for an order requiring defendants to maintain and repair the ditches on the following reasons: (1) the Timms had been asked to correct the problem and they had not; and (2) the Timms were going to charge defendants for the trees they removed from the Timms’ ditch banks.
The trial court’s view of the law is erroneous. The facts cited by the trial court do not support its conclusion that the Timms’ request for an order was barred by "unclean hands.” The Timms had no duty to maintain or repair the ditches. Such duty is delegated to defendants. Section 88.63(1), Stats. Though the *754Timms threatened to charge defendants for each tree removed, that assertion could not relieve defendants of their statutory duty to maintain and repair the ditches. Because the trial court exercised its discretion based upon an erroneous view of the "clean hands” doctrine, we reverse and remand this issue to the trial court for further proceedings.
In their cross-appeal, defendants seek attorney fees and costs pursuant to sec. 814.04(9), Stats., and sec. 823.08(4), Stats. Whether these statutes allow the granting of costs and attorney fees in this case requires statutory interpretation. We review such questions de novo. E.S., 141 Wis. 2d at 184, 413 N.W.2d at 672.
Section 814.04(9), Stats., provides that in actions where an agricultural use or practice is alleged to be a nuisance, a successful defendant shall be allowed costs as provided in sec. 823.08(4), Stats., which allows such a defendant to recover reasonable costs and attorney fees. " '[Agricultural practice’ means any activity associated with an agricultural use.” Sec. 814.04(9). Section 91.01(1), Stats., defines "agricultural use” to include "vegetable raising.”
Defendants argue that their activities, which formed the basis for the Timms’ nuisance complaint, are associated with the agricultural use to which all the land in the drainage district is put — vegetable raising.
"Statutes allowing costs are in derogation of the common law and should be strictly construed.” Guthrie v. Wis. Employment Relations Comm., 107 Wis. 2d 306, 317, 320 N.W.2d 213, 219 (Ct. App. 1982), aff'd, 111 Wis. 2d 447, 331 N.W.2d 331 (1983). "[A] statute should be interpreted in light of its purpose.” State v. Mauthe, 123 Wis. 2d 288, 299, 366 N.W.2d 871, 877 *755(1985). The purpose of sec. 823.08, Stats., is found in sec. 823.08(1):
The legislature finds that changes in agricultural technology, practices and scale of operation have, on occasion, tended to create conflicts between agricultural and other activities. The legislature believes that, to the extent possible consistent with good public policy, the law should not hamper agricultural production or the use of modern technology. The legislature therefore deems it in the best interest of the state to establish guidelines for the resolution of those conflicts which reach the judicial system. ...
The purpose of sec. 823.08, Stats., is to provide some protection from nuisance suits to those involved in agricultural production. To extend the statute’s protection to cover nuisance suits brought against drainage commissions would require us to liberally construe this costs statute. We are not to do so. Guthrie, 107 Wis. 2d at 317, 320 N.W.2d at 219. We conclude that the operation of the drainage ditches by defendants is not an "agricultural practice” within the meaning of secs. 823.08(4) and 814.04(9), Stats. Therefore these sections do not allow the award of costs and attorney fees in this action.
By the Court — Judgment affirmed in part, reversed in part, and cause remanded for further proceedings.