
724 P.2d 208 (1986)
Donald J. MASSEY, and Bertha M. Massey, his wife, Appellants,
v.
SUNRISE HOSPITAL; a Nevada corporation, Respondent.
No. 16370.
Supreme Court of Nevada.
September 4, 1986.
Eric Zubel, Jeffrey Fihn, Las Vegas, for appellants.
Barker, Gillock & Perry, Las Vegas, for respondent.

OPINION
PER CURIAM:
Bertha and Donald Massey initiated a claim against Sunrise Hospital for professional malpractice. They later amended their complaint to name Ralph J. Litton, M.D., as a codefendant. Dr. Litton was granted a separate trial in order to hear his statute of limitations defense. A jury returned a verdict in favor of Dr. Litton. Later, Sunrise Hospital moved to dismiss for want of prosecution pursuant to NRCP 41(e). The district court granted this motion. The Masseys argue that the district court erred in its construction of the rule. We agree. Therefore, we reverse and remand for further proceedings consistent with this opinion.

The Facts
Ms. Massey experienced numbness and paralysis in her left foot following hip replacement surgery. An initial complaint was filed July 28, 1978, against Sunrise Hospital (Sunrise) alleging negligence. On September 11, 1979, an amended complaint was filed naming Dr. Litton as a co-defendant. He moved to dismiss on the ground that the statute of limitations barred the claim. On April 16, 1982, Dr. Litton's motion to dismiss was granted, and judgment was entered in his favor pursuant to NRCP 54(b).
The Masseys then appealed to this court claiming that the district court erred in its *209 construction of the statute of limitations. During the pendency of the appeal involving Dr. Litton, the Masseys and Sunrise Hospital entered a stipulation, which the district court approved, to waive NRCP 41(e) until six months after remittitur of the appeal.[1] This was accomplished on June 15, 1983. Expiration of the mandatory five-year period was July 28, 1983. Remittitur was filed by the trial court December 28, 1983. As per the stipulation, trial was to be commenced by June 28, 1984.
In Massey v. Litton, 99 Nev. 723, 669 P.2d 248 (1983), we deemed summary judgment improper and remanded the issue for an evidentiary hearing. Dr. Litton was granted a separate trial for resolution of his affirmative defense and judgment was rendered in his favor on April 11, 1984. On December 6, 1984, Sunrise moved to dismiss pursuant to NRCP 41(e). The motion was granted and this appeal followed.

Statutory Interpretation
NRCP 41(e) contains several provisions which provide for dismissal for want of prosecution. The provision with which we are concerned is as follows:
When in an action after judgment, an appeal has been taken and judgment reversed with cause remanded for a new trial (or when an appeal has been taken from an order granting a new trial and such order is affirmed on appeal), the action must be dismissed by the trial court on motion of the defendant after due notice to plaintiff, or of its own motion, unless brought to trial within three years from the date upon which remittitur is filed by the clerk of the trial court.
The spirit of the law contemplates a trial on the merits. E.g., Spiegelman v. Gold Dust Texaco, 91 Nev. 542, 545, 539 P.2d 1216, 1218 (1975). Balanced against this policy, however, is the desire to end litigation after a reasonable amount of time. Bank of Nevada v. Friedman, 86 Nev. 747, 751, 476 P.2d 172, 175 (1970). Rule 41(e) accomplishes this end by requiring counsel's diligence in pursuing claims. Absent a written stipulation, claims not brought to trial within five years of commencement are dismissed pursuant to motion. Such action is mandatory. E.g., Meredith v. Arden, 92 Nev. 620, 621, 555 P.2d 1241, 1242 (1976). The "three-year" provision, however, extends the "five-year" rule when an appeal is taken. Such an extension is necessary in order to assure that plaintiffs are treated fairly. Without a three-year extension after remittitur of the appeal, many claims would be outside the five-year limitation period.
It is noted, however, that NRCP 41(e) explicitly addresses "new trials." Here, Dr. Litton was summarily dismissed as a defendant in the action. There had never been an initial trial on the merits of the case. In McGinnis v. Consolidated Casinos *210 Corp., 97 Nev. 31, 623 P.2d 974 (1981), we faced a similar situation. There, an amended complaint was dismissed by the lower court and, on appeal, we reversed the order of dismissal and remanded with instructions to reinstate the amended complaint. The respondent was then granted summary judgment and a second appeal ensued. The respondent moved to dismiss the appeal contending that even if the summary judgment was reversed, the "five-year" rule would require dismissal. Id. at 32, 623 P.2d 974.
We determined that the "three-year" provision was triggered even though the case had been remanded for an initial trial. Id. at 33, 623 P.2d 974.
If a district court should be permitted to allow a maximum of three years to re-try a case following reversal, then surely like exigencies dictate that the district court should have discretion to allow equal time, following remand, to conclude preparation and bring a matter to trial in the first instance.
Id.
Any plaintiff who perceives error by the district court is entitled to appeal a final judgment pursuant to NRAP 3A(b)(1). During the pendency of an appeal, any time limitations are tolled. A plaintiff cannot be penalized for exercising a right to challenge the trial judge in such a situation. Here, the district court judge granted Dr. Litton's motion for summary judgment. The court certified that the judgment was final and there was no just reason for delay. See generally, Wilmurth v. State, 79 Nev. 490, 387 P.2d 251 (1963). The Masseys chose to appeal this decision and did not want to proceed to trial solely against Sunrise. In effect, the case was delayed by the ruling of the district court; thus, the "three-year" provision was triggered. These same policy considerations were asserted in Boren v. City of North Las Vegas, 98 Nev. 5, 638 P.2d 404 (1982). The appellant there claimed that dismissal of the action was mandated by the "five-year" rule. This was "notwithstanding the fact that proceedings had been stayed for more than four years immediately preceding the motion to dismiss." Id. We determined that "[f]or a court to prohibit the parties from going to trial and then to dismiss their action for failure to bring it to trial is so obviously unfair and unjust as to be unarguable." Id. at 5-6, 638 P.2d 404.
Sunrise urges, however, that the "three-year" rule cannot be utilized to bind one defendant when an appeal is taken by the plaintiff against a co-defendant. We disagree. Proceeding to trial against one defendant during the pendency of such an appeal is unduly burdensome to the plaintiff as well as to the judiciary. In effect, by its NRCP 54(b) certification, the district court determined that an interlocutory appeal should take precedence over a trial. Therefore, where the claim involves multiple defendants and the plaintiff chooses to exercise the right to an appeal, we hold the other defendants likewise will be held to the "three-year" rule.
We note that the motion to dismiss pursuant to NRCP 41(e) was brought by respondent based on the "five-year" rule. As elucidated above, such action is mandatory. Although the order of dismissal is silent as to the reasons for same, we must assume the trial judge felt such dismissal was mandatory and failed to exercise the necessary discretion which the "three-year" rule requires. A court's failure to exercise discretion (when available) is error. People v. Massie, 66 Cal.2d 899, 428 P.2d 869, 428 P.2d 869, 881-82 (Cal.1967); Moser v. Zion's Co-op. Mercantile Inst., 114 Utah 58, 197 P.2d 136, 139 (Utah 1948).
Accordingly, we reverse the order and judgment of the district court. The cause is remanded for a trial on the merits.
NOTES
[1]  NRCP 41(e) states:

The court may in its discretion dismiss any action for want of prosecution on motion of the defendant and after due notice to the plaintiff, whenever plaintiff has failed for two years after action is filed to bring such action to trial. Any action heretofore or hereafter commenced shall be dismissed by the court in which the same shall have been commenced or to which it may be transferred on motion of the defendant, after due notice to plaintiff or by the court upon its own motion, unless such action is brought to trial within five years after the plaintiff has filed his action, except where the parties have stipulated in writing that the time may be extended. When, in any action after judgment, a motion for a new trial has been made and a new trial granted, such action shall be dismissed on motion of defendant after due notice to plaintiff, or by the court of its own motion, if no appeal has been taken, unless such action is brought to trial within three years after the entry of the order granting a new trial, except when the parties have stipulated in writing that the time may be extended. When in an action after judgment, an appeal has been taken and judgment reversed with cause remanded for a new trial (or when an appeal has been taken from an order granting a new trial and such order is affirmed on appeal), the action must be dismissed by the trial court on motion of defendant after due notice to plaintiff, or of its own motion, unless brought to trial within three years from the date upon which remittitur is filed by the clerk of the trial court. A dismissal under this subdivision (e) is a bar to another action upon the same claim for relief against the same defendants unless the court otherwise provides.
