
871 P.2d 809 (1994)
125 Idaho 392
In re the General Adjudication of Rights to the Use of Water from the Snake River Drainage Basin Water System.
Alvin MUSSER; Tim Musser; and Howard "Butch" Morris, Petitioners-Respondents,
v.
R. Keith HIGGINSON, in his official capacity as Director of the Idaho Department of Water Resources and the Idaho Department of Water Resources, Respondents-Appellants.
No. 20807.
Supreme Court of Idaho, Boise, February 1994 Term.
February 28, 1994.
Rehearing Denied April 22, 1994.
*810 Larry EchoHawk, Atty. Gen., and Clive J. Strong, Phillip J. Rassier and Peter R. Anderson, Deputy Attys. Gen., for respondents-appellants. Peter R. Anderson argued.
Hepworth, Nungester & Lezamiz, Chtd., Twin Falls, for petitioners-respondents. John C. Hohnhorst argued.
JOHNSON, Justice.
This case is a water distribution case. The primary issue presented is whether the trial court properly issued a writ of mandate ordering the director (the director) of the Idaho department of water resources (the department) immediately to comply with I.C. § 42-602 and distribute water in accordance with the doctrine of prior appropriation. There are also issues concerning the award of attorney fees and the trial court's order prohibiting the payment of these attorney fees and costs from the Snake River Basin Adjudication account (SRBA account).
We affirm the trial court's issuance of the writ of mandate, its award of attorney fees, and the order prohibiting the payment of attorney fees and costs awarded from the SRBA account.

I.

THE BACKGROUND AND PRIOR PROCEEDINGS.
Alvin and Tim Musser own real property (the Mussers' property) in Gooding County, *811 Idaho, which has appurtenant to it a decreed right for 4.8 cubic feet per second (cfs) of water from the Martin-Curran Tunnel (the tunnel) with a priority date of April 1, 1892. Howard "Butch" Morris leases the Mussers' property together with the appurtenant water rights. In this opinion, we refer to the Mussers and Morris collectively as "the Mussers."
The Mussers' property is located within water district 36A (the district). The district is served by a watermaster (the watermaster) appointed by the director. The springs which supply the Mussers' water are tributary to the Snake River and are hydrologically interconnected to the Snake plain aquifer (the aquifer).
In the spring of 1993, the Mussers found that the tunnel did not supply them with sufficient water to fulfill their adjudicated water rights. As a result, they contend they planted less acreage than they had previously and that many of their crops were lost and damaged.
On May 25, 1993, other owners of water rights from the tunnel demanded that the watermaster deliver water to them. The watermaster relayed the demand to the director who rejected the demand. On June 16, 1993, the Mussers made a similar demand on the director for the "full and immediate delivery of their decreed water rights from the Curran Tunnel." The director denied the demand on the grounds that "the director is not authorized to direct the watermaster to conjunctively administer ground and surface water within Water District 36A short of a formal hydrologic determination that such conjunctive management is appropriate."
The Mussers sought a writ of mandate to compel the director: (1) to deliver their full decreed water rights, and (2) to control the distribution of water from the aquifer according to the priority date of the decreed water rights.
The director and the department moved to dismiss the Mussers' request for a writ of mandate, arguing that the request was moot because after the Mussers initiated the action, the director issued a notice of intent to promulgate rules and a notice and order for a contested case. The proposed rules would allow the director to respond to the Mussers' demands by providing for the conjunctive management of the aquifer and the Snake River. The contested case would provide a forum for determining how to deliver the Mussers' water pending completion of the proposed rules. Alternatively, the director and the department contended the petition should be dismissed because a writ of mandate is an inappropriate method by which to litigate the relationship between senior and junior ground water rights.
The trial court denied the motion to dismiss and concluded that the director owes the Mussers "a clear legal duty to distribute water under the prior appropriation doctrine." The trial court determined that the director's failure to adopt rules and regulations enabling him to respond to the Mussers' demand for delivery of their water was a breach of his "mandatory, ministerial duty." The trial court also said the director's refusal to honor the Mussers' demand was "arbitrary and capricious" and that the Mussers had no "adequate, plain or speedy remedy at law."
The trial court issued a writ of mandate commanding the director "to immediately comply with I.C. § 42-602 and distribute water in accordance with the Constitution of the State of Idaho and the laws of this state commonly referred to as the Doctrine of Prior Appropriation...." The director and the department appealed and asked the trial court to stay the writ during the appeal. The trial court denied the motion to stay, noting: "I don't see what there is in the writ of mandate that needs to be stayed since the department is proceeding to honor it in its entirety." This Court also denied the request of the director and the department to stay the writ during this appeal.
The Mussers sought attorney fees in the trial court pursuant to I.C. §§ 12-117 and 12-121 and the private attorney general doctrine. The trial court concluded that the director and the department acted without a reasonable basis in fact or law and defended the action frivolously, unreasonably and without foundation and that the Mussers were compelled to pursue private enforcement "to *812 require the director to perform a duty that is clear, unambiguous and constitutionally required." The trial court ruled that the Mussers are entitled to fees under all three of the theories advanced, and ordered that the costs and fees not be paid out of the SRBA account, pursuant to I.C. § 12-117(3). The director and the department appealed.

II.

THE TRIAL COURT PROPERLY ISSUED A WRIT OF MANDATE COMMANDING THE DIRECTOR IMMEDIATELY TO COMPLY WITH I.C. § 42-602.
The director and the department assert that the trial court should not have issued the writ of mandate. We disagree.
In Idaho Falls Redev. Agency v. Countryman, 118 Idaho 43, 794 P.2d 632 (1990), the Court recapitulated the requirements for the issuance of a writ of mandate:
In Utah Power & Light Co. v. Campbell, 108 Idaho 950, 953, 703 P.2d 714, 717 (1985), this Court stated that "[m]andamus will lie if the officer against whom the writ is brought has a `clear legal duty' to perform the desired act, and if the act sought to be compelled is ministerial or executive in nature." Existence of an adequate remedy in the ordinary course of law, either legal or equitable in nature, will prevent issuance of a writ, and the party seeking the writ must prove that no such remedy exists. This Court has repeatedly held that mandamus is not a writ of right and the allowance or refusal to issue a writ of mandate is discretionary. Likewise, Idaho law requires that a writ must be issued in those cases where there is not a plain, speedy, and adequate remedy in the ordinary course of law.
Id. at 44, 794 P.2d at 633 (citations omitted).
I.C. § 42-602 provides:
It shall be the duty of the director of the department of water resources to have immediate direction and control of the distribution of water from all of the streams, rivers, lakes, ground water and other natural water sources in this state to the canals, ditches, pumps and other facilities diverting therefrom. Distribution of water shall be accomplished either (1) by watermasters appointed as provided in this chapter and supervised by the director; or (2) directly by employees of the department of water resources under authority of the director in those areas of the state not constituted into water districts as provided in this chapter. The director must execute the laws relative to the distribution of water in accordance with rights of prior appropriation as provided in section 42-106, Idaho Code.

The director of the department of water resources shall, in the distribution of water from the streams, rivers, lakes, ground water and other natural water sources, be governed by this title.
I.C. § 42-602 (emphasis added).
We conclude that the director's duty to distribute water pursuant to this statute is a clear legal duty. The director himself testified that he was aware that his duty to deliver water under I.C. § 42-602 is mandatory.
The director contends, however, that although his duty under I.C. § 42-602 is mandatory, the statute leaves to the director's discretion the means that will be used to respond to calls for water. For more than three-quarters of a century, the Court has adhered to the following principle: "The fact that certain details are left to the discretion of the authorities does not prevent relief by mandamus." Beem v. Davis, 31 Idaho 730, 736, 175 P. 959, 961 (1918) (emphasis in original). See also Moerder v. City of Moscow, 74 Idaho 410, 415, 263 P.2d 993, 998 (1953) ("Public officials may, under some circumstances, be compelled by writ of mandate to perform their official duties, although the details of such performance are left to their discretion.")
This principle applies to this case. The director's duty pursuant to I.C. § 42-602 is clear and executive. Although the details of the performance of the duty are left to the director's discretion, the director has the duty to distribute water.
*813 The director defended his refusal to honor the Mussers' demand by claiming that a "policy" of the department prevented him from taking action. In his testimony at the hearing to consider whether the writ would issue, the director referred to I.C. § 42-226 and stated that "a decision has to be made in the public interest as to whether those who are impacted by groundwater development are unreasonably blocking full use of the resource."
We note that the original version of what is now I.C. § 42-226 was enacted in 1951. 1951 Idaho Sess.Laws, ch. 200, § 1, p. 423. Both the original version and the current statute make it clear that this statute does not affect rights to the use of ground water acquired before the enactment of the statute. Therefore, we fail to see how I.C. § 42-226 in any way affects the director's duty to distribute water to the Mussers, whose priority date is April 1, 1892.
The Mussers presented evidence indicating that suing the director for damages was not a plain, adequate, and speedy remedy in the ordinary course of law because of the ongoing nature of the harm and the difficulty in determining the damages they would incur due to the director's refusal to comply with I.C. § 42-602. The Mussers also contended that suing the director was inadequate because of the director's immunity from damages under I.C. § 6-904, a portion of the Idaho tort claims act.
The director and the department contend that the Mussers could have pursued administrative hearings before the director, administrative appeals, and motions for interim administration of water rights. We note that the only manner in which any of these asserted remedies were presented to the trial court was in the final argument by the attorney for the director and the department at the hearing concerning the request for the writ. There, the attorney argued that the Mussers should seek a hearing and then judicial review pursuant to I.C. §§ 42-237e and 42-1701A. Because these were the only alternative remedies presented to the trial court, these are the only ones we will address.
I.C. § 42-237e states:
Any person dissatisfied with any decision, determination, order or action of the director of the department of water resources.... made pursuant to this act may, if a hearing on the matter already has been held, seek judicial review pursuant to section 42-1701A(4), Idaho Code. If a hearing has not been held, any person aggrieved by the action of the director.... may contest such action pursuant to section 42-1701A(3), Idaho Code.
By its terms, I.C. § 42-1701A(3) applies only to "any applicant for any permit, license, certificate, approval, registration, or similar form of permission required by law to be issued by the director." I.C. § 42-1701A(3) concludes: "Judicial review of any final order of the director issued following the hearing may be had pursuant to subsection (4) of this section." These provisions do not apply to the circumstances presented in this case. The Mussers did not seek a permit, license, certificate, approval, registration, or similar form of permission required by law to be issued by the director. Therefore, these remedies are not available to the Mussers to obtain review of the director's refusal to comply with I.C. § 42-602.

III.

THE TRIAL COURT DID NOT ABUSE ITS DISCRETION IN AWARDING ATTORNEY FEES PURSUANT TO I.C. § 12-117 AND IN ORDERING THAT THE FEES AND COSTS NOT BE PAID FROM THE SRBA ACCOUNT.
The director and the department assert that the trial court should not have awarded attorney fees to the Mussers and should not have ordered that the fees and costs not be paid from the SRBA account. We conclude that the trial court did not abuse its discretion in awarding attorney fees pursuant to I.C. § 12-117 and in ordering that the fees and costs not be paid from the SRBA account, pursuant to I.C. § 12-117(3).
I.C. § 12-117(1) provides, in part:
In any administrative or civil judicial proceeding involving as adverse parties a state agency and a person, the court shall *814 award the person reasonable attorney's fees, witness fees and reasonable expenses, if the court finds in favor of the person and also finds that the state agency acted without a reasonable basis in fact or law.
In awarding attorney fees and costs, the trial court concluded that by rejecting the Mussers' request to perform the duties mandated by I.C. § 42-602, the director acted without any reasonable basis in fact or law.
Recently, we have reiterated the standard by which we review the award of attorney fees:
In those instances wherein attorney fees can properly be awarded, the award rests in the sound discretion of the trial court and the burden is on the person disputing the award to show an abuse of discretion.
Fox v. Board of County Com'rs, 121 Idaho 684, 685, 827 P.2d 697, 698 (1992).
Applying the three-step analysis of Sun Valley Shopping Ctr. v. Idaho Power Co., 119 Idaho 87, 94, 803 P.2d 993, 1000 (1991), we conclude that the trial court did not abuse its discretion in awarding attorney fees pursuant to I.C. § 12-117. The trial court correctly perceived the award to be a discretionary act, acted within the outer boundaries of its discretion and consistently with the legal standards applicable to the consideration of an award, and reached its decision by an exercise of discretion. We agree with the trial court that there was no reasonable basis in law or fact for the director's refusal to comply with I.C. § 42-602.
Citing I.C. § 12-117(3), the trial court ordered that the attorney fees and costs awarded to the Mussers not be paid out of the SRBA adjudication account. I.C. § 12-117(3) provides: "Expenses awarded under this section shall be paid from funds in the regular operating budget of the state agency." The adjudication account is created under § 42-1777. This statute limits the use by the department of money in the account, "upon appropriation by the legislature, to pay the costs of the department attributable to general water rights adjudications conducted pursuant to chapter 14, title 42, Idaho Code."
The attorney fees and costs awarded to the Mussers were not costs of the department attributable to a general water rights adjudication. The Court has recently reiterated that the purpose of an award pursuant to I.C. § 12-117 is to deter groundless or arbitrary agency action and to provide a remedy for persons who have borne unfair and unjustified financial burdens attempting to correct mistakes agencies should never have made. Lockhart v. Department of Fish and Game, 121 Idaho 894, 898, 828 P.2d 1299, 1303 (1992). Treating the trial court's award as costs of the department under I.C. § 42-1777 is inconsistent with this purpose.
Because we affirm the award of attorney fees pursuant to I.C. § 12-117, we find it unnecessary to address the other bases for the award stated by the trial court.

IV.

CONCLUSION.
We affirm the trial court's issuance of the writ of mandate, award of attorney fees and costs, and order that the attorney fees and costs not be paid out of the SRBA account.
We award the Mussers costs on appeal. We also award the Mussers attorney fees on appeal pursuant to I.C. § 12-117.
McDEVITT, C.J., and BISTLINE, TROUT and SILAK, JJ., concur.
