The respondents, Agrodyne, Inc. and Energy Incorporated, filed suit to collect the balance due on a contract to provide an ethanol fuel production system for the defendants, Gail and Irene Beard. The Beards counterclaimed for damages, alleging the system installed by the respondents was incomplete and defective. Eventually, the case was dismissed by the district court, purporting to act under I.R.C.P. 40(c).1
The Beards appeal. They raise two issues. First, did the court err by dismissing the action when the Beards failed to comply with an order of the court to post a bond as security for the payment of costs that might be awarded against the Beards? Second, were the respondents prejudiced by any time delay caused by the Beards that would warrant dismissal of the action under Rule 40(c)? We hold the court erred in requiring a bond be posted. Because of this error, we conclude the court did not properly exercise its discretion in dismissing the action under Rule 40(c). We consequently need not reach the second issue raised by the Beards. We vacate the order of dismissal and remand the case.
In greater detail, the procedural history of this case is as follows. The action was filed in 1982 to collect the balance due the respondents on a contract with the Beards for the construction and installation of an ethanol fuel production system on the Beards’ farm. In late 1982, the Beards filed a counterclaim, contending they were damaged because the system installed by the respondents was incomplete and defective. Apparently because no action had *344been taken in the case for more than one year, the court issued a notice on April 9, 1984, that the case would be dismissed on April 29 under Rule 40(c) unless good cause were shown to retain the action on the calendar. The proposed dismissal did not occur, however, because of a stay order previously entered by the United States Bankruptcy Court as a result of proceedings filed in that court by the Beards on April 12, 1983.2
In June, 1985, the stay order was lifted pursuant to a stipulation filed in the bankruptcy proceeding; and in July, 1985, the respondent, Energy Incorporated, was granted leave to file a third-party complaint against another corporation that had designed, and provided the component parts of, the ethanol production system.3 On July 21, 1986, the district court again issued a notice that the action would be dismissed for inactivity, in the absence of a showing of good cause to retain the matter on the calendar by August 11. On August 20, Energy Incorporated, representing that it was the parent company of the respondent Agrodyne and that Agrodyne was no longer actively conducting business, filed a motion for involuntary dismissal of the action under I.R.C.P. 41(b). The motion alleged that delay, resulting from the Beards’ bankruptcy proceeding and the Beards’ failure to diligently prosecute their counterclaim, had been prejudicial to the respondents.
On August 21, 1986, the Rule 40(c) dismissal and the motion for involuntary dismissal were argued before the district court. The court took the issues under advisement. On September 26, the Beards filed an affidavit, disclosing their recent efforts either to settle the case or to proceed with resolution of the action in court. On October 8, the court entered the following order:
The Court has placed the captioned case on the calendar for dismissal as an inactive case under Idaho Rules of Civil Procedure 40(c). The defendant Beards seek to have the case retained on the active calendar and plaintiff Agrodyne seeks to have the case dismissed. The Court is satisfied that there was no activity for more than a year at the time notice was sent out showing the intention of the Court to dismiss unless good cause was shown. This case has some indepth complications and will take extensive pretrial preparation. The Beards are still under some kind of bankruptcy proceedings. Considerable costs could mount and if the Beards do not prevail there are circumstances to give the inference that they could not pay their cost bill.
The Court is of the opinion that there is not good cause yet shown to prevent the dismissal of this case. It would be difficult to find good cause without some kind of assurance that if a cost bill were eventually awarded against the Beards, they would have the ability to pay it.
The Court finds that sufficient cause has not yet been shown, but;
IT IS HEREBY ORDERED That defendant Beards have until the 3rd day of November, 1986, to propose to the Court a method or plan to provide security for the payment of a potential cost bill that might arise in this case that the Beards might be required to pay if they do not prevail in the lawsuit. The Court will invite counsel to confer with the Court in setting an appropriate amount.
Accordingly, an affidavit was filed on behalf of Energy Incorporated, projecting a cost bill for witness’ fees, expert witness’ fees, costs and attorney fees totaling in excess of $426,000. In response, Irene Beard filed her affidavit disputing those calculations. She requested that the court determine the true amount of the expected *345costs and consider requiring each side to “put up” one-half of the cost bill.
On January 15, 1987, the court entered an order finding “that the [plaintiffs] would be unduly prejudiced unless the Beards were to post a bond as security for payment of costs if they do not prevail.” The court ordered that the case would be dismissed under Rule 40(c) unless the Beards posted a bond of $80,000 by February 6, 1987. On February 5, the court granted an extension of thirty days to post the bond. The bond was never posted and on May 5, 1987, the court entered a memorandum decision and order dismissing the case without prejudice under Rule 40(c). In that decision the court- determined the Beards “have not shown sufficient good cause to have the case retained on the calendar.”
With these facts in mind we turn to the contention that the court erred in dismissing the case under Rule 40(c), upon the Beards failure to post a bond to cover respondents’ costs as a condition for retaining the case on the trial calendar. Guidance with regard to the standard of review, on appeal from a dismissal for inactivity under Rule 40(c), has been provided by our Supreme Court in the case of Kirkham v. 4.60 Acres of Land, 100 Idaho 781, 605 P.2d 959 (1980).
In Kirkham the Court considered a dismissal under a local rule of the Sixth Judicial District implementing I.R.C.P. 40(c). Under the local rule, the district court periodically reviewed the civil cases on file to detect those which appeared to be inactive because they had not been scheduled for trial. The rule allowed dismissal of any case “for inaction after one (1) year pursuant to rule 40(c) IRCP.” In Kirkham, the district court served notice on the parties that the case would be dismissed on a specified date, because of no action in the case for approximately twenty-one months. Thereafter, because neither party responded to the notice by the specified date, the district court dismissed the action with prejudice. An appeal was taken after the district court denied a subsequent motion to vacate the dismissal.
The Supreme Court characterized the question before it in Kirkham, at the outset of its opinion, in the following language: “The issue presented on appeal is whether the trial court abused its discretion in dismissing, sua sponte, the above entitled action with prejudice because neither party took any affirmative action in the case for a period of 21 months.” 100 Idaho at 782, 605 P.2d at 959. The Court then reviewed the facts, the procedural history of the case, and quoted the local rule which included reference to dismissals under Rule 40(c). With regard to the district court’s dismissal, the Supreme Court said:
It is well settled in Idaho that the trial court has the authority to dismiss a case because of a failure to prosecute, and that the trial court’s exercise of such authority will not be disturbed on appeal unless it is shown that there was a manifest abuse of discretion. Warden v. Lathan, 96 Idaho 34, 524 P.2d 162 (1974).... Having reviewed the record on appeal, this court does not find any abuse of discretion on the part of the court below in dismissing this case pursuant to the above rule.
100 Idaho at 783, 605 P.2d at 961. The court then considered whether the district court had erred by dismissing the action with prejudice, because Rule 40(c) allowed dismissals only “without prejudice.” In that regard, the Supreme Court determined the district court had erred. Based on that error, the Court then held the district court had abused its discretion in refusing to vacate the order of dismissal. Thus the rule we glean from Kirkham is that, on appellate review, a dismissal under 40(c) is treated as a discretionary decision, which will be upheld unless it is found that the lower court abused its discretion.4
*346We move next, then, to a determination whether the district court in the instant case properly exercised its discretion when dismissing the action under Rule 40(c). Again, a statement from Kirkham is enlightening. There the Court noted: “It is generally held that the trial court abuses its discretion when it fails or refuses to properly apply the law.” 100 Idaho at 785, 605 P.2d at 963.
It is clear in this case that the court dismissed the action under Rule 40(c) not simply for inactivity but because the Beards failed to post the $80,000 bond ordered by the court. A determination concerning the propriety of the court’s exercise of its discretion raises the question, therefore, whether the court had any authority at all to require the bond as security for costs, for if it did not, then the law was not properly applied by the court and the discretionary decision to dismiss under Rule 40(c) would have been tainted by reference to an improper factor.
Similar to the rule that “[t]he right to recover costs is statutory and no cost can be granted without statutory authorization,” Idaho Power Co. v. Idaho Public Utilities Commission, 102 Idaho 744, 750, 639 P.2d 442, 448 (1981), the right to require security for costs or the payment of costs in advance is regarded as wholly statutory. See generally 20 C.J.S. COSTS § 125, at 363 (1940). The Idaho Legislature has specified that awards of costs in civil proceedings shall be made in the manner provided by the Idaho Rules of Civil Procedure. I.C. § 12-101. The “award” of costs being so authorized, it would follow that any security required in advance of the award of costs also should be controlled by the rules of procedure in the absence of any statute directing otherwise. The rules of procedure allow for the assessment of costs, or security for anticipated costs, only in specific circumstances. Examples, under particular rules, are as follows. Costs are recoverable in conjunction with the final judgment or result in an action, under Rule 54(d)(1). Before judgment, costs may be awarded under Rule 37 as a sanction for violation of discovery orders and procedures; and costs may be taxed as a condition to granting a request for enlargément of time or postponement of a hearing, pursuant to Rule 54(d)(3). The rules also permit the court to direct the posting of an appropriate security for costs as a prerequisite to issuance of a restraining order or preliminary injunction, I.R.C.P. 65(c). In another vein, Rule 54(d)(4) prohibits requiring a party to furnish a cost bond or undertaking solely based on the fact that the party is not a resident of Idaho. Finally, where a party refiles an action upon a claim previously dismissed, the court “may make such order for the payment of costs of the action previously dismissed as it may deem proper and may stay the proceedings in the action until the plaintiff has complied with the order.” I.R. C.P. 41(d).
Rule 40(e) does not provide for the furnishing of security for costs as a condition to retaining an inactive case on the calendar. We do not otherwise find among the rules any authorization for a trial court to require the posting of a security for costs as a condition to maintaining an action as an alternative to dismissal under Rule 40(c). Neither are we directed to any statute permitting the same.
Thus, we conclude the district court erred by imposing an improper condition —a bond as security for costs — in order to retain the case on the court’s calendar. It follows that the district court’s dismissal, when the Beards failed to comply with the condition, constituted an exercise of discretion by reference to an incorrect perception of law. Accordingly, the order of dismissal is vacated. Because the district court erroneously applied the law in making its discretionary decision, the case must be remanded to reconsider the application of Rule 40(c) under proper legal standards as *347clarified herein. Matter of the Estate of Kunzler, 109 Idaho 350, 707 P.2d 461 (Ct.App.1985).
We note that, even under Rule 40(c), the discretionary power to dismiss should be cautiously utilized. Our Supreme Court has admonished: “In determination of the question of abuse of discretion, the power of the court should be fully and liberally exercised under the statute so as to dispose of cases substantially upon the merits.” Kirkham, 100 Idaho at 784-85, 605 P.2d at 962-63, (citing Swanson v. State, 83 Idaho 126, 133, 358 P.2d 387, 390 (1961)). See also Stilwell v. Weiser Iron Works, Inc., 66 Idaho 227, 231, 157 P.2d 86, 87 (1945).
The respondents argue that the dismissal should be upheld on an alternative theory. They contend that the record clearly demonstrates a lack of action in the case for over three years, and resultant prejudice to the respondents. Essentially, they assert the dismissal would have been appropriate under Rule 41(b). We note, however, that the district court was presented with this approach upon a motion filed by the respondents. The motion invoked the discretionary judgment of the district court. That discretion was never exercised; instead the court elected to proceed under Rule 40(c). We decline to usurp the role of the district court by substituting our opinion for the initial and yet undecided question of the application of Rule 41(b). For guidance on remand in the event the respondents pursue their motion under Rule 41(b), we direct attention to our recent opinion in Grant v. City of Twin Falls, 113 Idaho 604, 746 P.2d 1063 (Ct.App.1987).
The order of dismissal under Rule 40(c) is vacated and the case is remanded for further proceedings. Costs to appellants; no attorney fees awarded.
BURNETT and SWANSTROM, JJ., concur.ADDENDUM
. At the time of this dismissal, I.R.C.P. 40(c) provided:
Dismissal of inactive cases — In the absence of a showing of good cause for retention, any action, appeal or proceeding, except for guardianships, conservatorships, and probate proceedings, in which no action has been taken for a period of one (1) year shall be dismissed. Dismissal pursuant to this rule in the case of appeals shall be with prejudice and as to all other matters such dismissal shall be without prejudice. At least 10 days prior to such dismissal, the clerk shall give notification of the pending dismissal to all attorneys of record, and to any party appearing on his own behalf, in the action or proceeding subject to dismissal under this rule.
The rule subsequently was amended to reduce the controlling time period from one year to six months, effective November 1, 1987.
. At oral argument we were informed that Beards initially filed a Chapter 11 business reorganization proceeding, then later filed a Chapter 12 farmer’s reorganization proceeding. Both were ultimately dismissed; there was no conversion to a Chapter 7 liquidation.
. At oral argument on this appeal we were advised that no further action was taken on the third-party claim, because of the dismissal of this case. That claim had been filed as a protective measure, for possible indemnification, in the event the respondents were ultimately found liable to the Beards on the latter’s counterclaim.
. Interestingly, the Warden case relied upon by the Court in Kirkham did not involve a dismissal under Rule 40(c). It involved a Rule 41(b) dismissal, which has long been recognized as allowing the trial court, upon motion of a party, to exercise its discretion in deciding whether to dismiss a case for failure to diligently prosecute the action. Rule 40(c) specifies that, in the absence of a showing of good cause for retention, an action shall be dismissed. The word *346"shall” would seem to preclude the exercise of discretion. However, we will follow the lead of the promulgator of the rule, the Supreme Court, and accept its indication in Kirkham that Rule 40(c) dismissals fall within the trial court’s discretionary power. Although the Supreme Court in Kirkham bypassed the question whether the finding of "good cause" was a discretionary determination, as we explain in the text of this opinion, the exercise of that discretion must be untainted by reliance upon an incorrect perception of the law.