
854 P.2d 851 (1993)
HOME SAVINGS ASSOCIATION, Nevada Savings and Loan Association, and H.S. Services Corporation, Appellants,
v.
AETNA CASUALTY AND SURETY COMPANY, Respondent.
No. 21569.
Supreme Court of Nevada.
June 15, 1993.
Beckley, Singleton, DeLanoy, Jemison & List, Las Vegas, for appellants.
Beasley, Holden & Brooks, Reno, for respondent.

OPINION
PER CURIAM:

Facts
In 1976, H.S. Service Corporation (H.S.) constructed a 301 unit apartment complex known as the Forest Lane Apartments. While H.S. was the general contractor on the project, the actual construction work was performed by independent subcontractors, and H.S. provided only inspection services. Following completion of the building in 1977, the building was sold to Marlene Michaels, who, through a triple escrow, *852 transferred the property to Forest Lane Associates (Forest Lane), a limited partnership. Building code violations resulted in substantial portions of the apartment complex being condemned. In 1979, Forest Lane commenced a suit against H.S. and its parent corporation, Home Savings Association (Home Savings). Home Savings had financed the construction of the Forest Lane Apartments, and it provided the permanent financing. Between October 13, 1977, and March 10, 1981, H.S. and Home Savings were insured by Aetna Casualty and Surety Company (Aetna) under various policies, including a primary policy and an excess umbrella policy. Although the property damage, which manifested itself first in May, 1978, was within the policy period of both the primary policy and the excess umbrella policy, Aetna denied coverage on both policies and declined to defend the lawsuit for either H.S. or Home Savings.
On November 6, 1986, Forest Lane obtained a judgment pursuant to a jury verdict of $9,318,507.14, with an additional award of $1,000,000.00 in punitive damages, against H.S. and Home/Nevada.[1] Pre-litigation costs totaled $5,997.18 and were paid by Home Savings. From the commencement of the Forest Lane litigation through September 30, 1982, litigation defense costs amounted to roughly $165,000.00 and were paid by Home Savings. After the merger of Home Savings and Nevada Savings in 1982, Home/Nevada obtained new legal counsel, and from September 30, 1982, until August 19, 1983, defense costs amounting to roughly $174,000.00 were paid by Home/Nevada. In 1983, Home/Nevada retained separate counsel, John O'Brien (O'Brien), and H.S. continued to employ Beckley, Singleton, DeLanoy, Jemison & List (Beckley, Singleton), the law firm that had been conducting H.S. and Home/Nevada's joint defense since the Home/Nevada merger. From August, 1983, through December 20, 1985, Home/Nevada paid defense costs of approximately $84,000.00 incurred by John O'Brien, $413,000.00 incurred by Beckley, Singleton on behalf of H.S., and $135,000.00 incurred jointly by both parties. Beginning in 1986, H.S. paid costs of roughly $64,000.00 incurred by Home/Nevada, $331,000.00 incurred by H.S., and $190,000.00 incurred jointly by both parties. In total, Home Savings paid approximately $170,000.00 in defense costs, Home/Nevada paid approximately $820,000.00, and H.S. paid approximately $587,000.00.
Meanwhile, on November 13, 1981, H.S. and Home Savings brought a declaratory action against Aetna seeking a declaration of coverage and of a duty to defend. On December 22, 1983, Home Savings, H.S., and Home/Nevada filed an amended complaint. The district court bifurcated the action pursuant to NRCP 42(b), and H.S. proceeded alone against Aetna. On June 22, 1984, the district court issued its decision in favor of H.S., stating it would be willing to entertain: (1) a motion for certification of finality by H.S. under NRCP 54(b), and (2) a motion for summary judgment by Home/Nevada. On October 2, 1984, the district court entered a final judgment in favor of H.S. pursuant to NRCP 54(b) declaring H.S. to be covered by the Aetna policy for the Forest Lane claims and declaring Aetna to owe H.S. a duty to defend the claims. Home/Nevada failed to timely pursue summary judgment.
Aetna appealed the district court's judgment in favor of H.S. to this court, and on February 6, 1987, we ordered the appeal dismissed. Subsequently, Aetna agreed to permit its attorney to make a limited appearance on behalf of Home/Nevada in Home/Nevada and H.S.'s joint appeal from the Forest Lane judgment.
On July 10, 1987, H.S.'s attorneys, Beckley, Singleton, sent a request to Aetna for reimbursement for H.S. and Home/Nevada's attorney's fees of $1,153,967.34. Aetna's attorney responded with a letter dated July 21, 1987, which stated that a more detailed account of costs and attorney's fees would be required before Aetna could take any action. On September 23, 1987, *853 H.S.'s attorneys sent an itemized bill to Aetna for $1,192,833.14 in defense fees and costs. In a letter dated December 8, 1987, Aetna specifically disavowed responsibility for certain items on the bill submitted by H.S. and Home/Nevada, including attorney's fees for Home/Nevada's attorney, O'Brien. In May, 1988, Aetna informed counsel for H.S. that, in Aetna's opinion, the matter could not be resolved without judicial assistance.
On October 11, 1988, Home/Nevada moved for summary judgment as to its action for declaratory relief, stating that the district court's declaration of coverage and of a duty to defend as to H.S. was binding in Home/Nevada's suit against Aetna. On October 17, 1988, Aetna moved to dismiss, asserting that Home/Nevada's failure to bring its case to trial within five years required dismissal pursuant to NRCP 41(e).[2] On January 3, 1989, the district court granted Aetna's motion and on January 6, 1989, dismissed Home/Nevada's action. Pursuant to NRCP 41(e), this dismissal was presumed to be with prejudice, because the court did not otherwise provide. Thereafter, Home/Nevada filed a motion to have the order of dismissal amended to specify that the dismissal was without prejudice. On February 15, 1989, the district court denied this motion.
Meanwhile, on November 10, 1988, Home Savings filed a second complaint against Aetna seeking both declaratory relief and damages for breach of contract and bad faith. On November 7, 1989, Aetna filed a motion for partial summary judgment against both Home/Nevada and H.S. with respect to the legal fees incurred by both parties from March 8, 1979, through December 20, 1985, and paid by Home Savings and Home/Nevada. With respect to Home/Nevada, Aetna alleged that the NRCP 41(e) dismissal precluded any recovery. In the alternative, Aetna alleged that any action based on Home/Nevada's second complaint was barred by the six-year statute of limitations for contract actions set forth in NRS 11.190(1)(b).[3] With respect to H.S., Aetna alleged that H.S. lacked standing for its claim because its fees were paid by either Home Savings or Home/Nevada during that period, and that consequently, H.S. suffered no damages.
In response to Aetna's motion for partial summary judgment, Home/Nevada and H.S., on December 15, 1989, filed their own motion for partial summary judgment. On April 11, 1990, the district court granted Aetna's motion for partial summary judgment and denied H.S. and Home/Nevada's motion. The district court found that, because H.S.'s attorney's fees prior to December 20, 1985, were paid by either Home Savings or Home/Nevada, H.S. was not damaged and was not entitled to reimbursement of these fees. The district court determined that H.S. could only recover those costs and attorney's fees paid by H.S. after January 1, 1986. The district court also determined that both the NRCP 41(e) dismissal and the statute of limitations barred Home/Nevada's claim for defense costs and fees, and that judgment should be entered against it. The district court refused Home/Nevada's invitation to treat the NRCP 41(e) dismissal as being "without prejudice."
In order to facilitate immediate review of the district court's rulings by resolving with finality all the claims of all the parties, on September 10, 1990, Home/Nevada, H.S., and Aetna entered into a "Stipulation for Dismissal," which was signed by the *854 district judge as an order. The parties agreed that the order of April 11, 1990, determined that: (1) H.S. was not entitled to attorney's fees and costs paid by Home Savings and Home/Nevada between March 8, 1979, and December 20, 1985; (2) H.S. had no claim in tort against Aetna, and therefore no recovery of punitive damages would be available; and (3) Home/Nevada's claims were barred by the statute of limitations and by the prior NRCP 41(e) dismissal with prejudice. H.S. and Home/Nevada then appealed from the September 10, 1990, order and all other orders made final and appealable through that order.

Discussion
Because Home/Nevada did not bring its case to trial within five years of the filing of the complaint, the district court was required to dismiss the action pursuant to NRCP 41(e), as dismissal in such a case is mandatory. See Erickson v. One Thirty-Three, Inc., 104 Nev. 755, 757, 766 P.2d 898, 899-900 (1988). However, the district court has discretion under NRCP 41(e) to dismiss with or without prejudice. See Lighthouse v. Great W. Land & Cattle, 88 Nev. 55, 57, 493 P.2d 296, 296-97 (1972). NRCP 41(e) was enacted as a measure of preventing unreasonable and unnecessary delays in the prosecution of a lawsuit. See Massey v. Sunrise Hospital, 102 Nev. 367, 369, 724 P.2d 208, 209 (1986). Because the law favors trial on the merits, however, dismissal with prejudice may not be warranted where such delay is justified by the circumstances of the case. Circumstances which this court has considered in deciding whether to uphold a discretionary dismissal by a district judge include the conduct and good faith belief of the parties and whether the underlying action has merit. See Northern Ill. Corp. v. Miller, 78 Nev. 213, 216-17, 370 P.2d 955, 956 (1962). "[W]hen justice so requires the court may dismiss the action [pursuant to NRCP 41(e) ] without prejudice." United Ass'n of Journeymen v. Manson, 105 Nev. 816, 821, 783 P.2d 955, 958 (1989) (holding that justice required the district court to exercise its discretion by dismissing the claim without prejudice and modifying the dismissal with prejudice to a dismissal without prejudice). Factors in determining whether dismissal should be with or without prejudice include whether plaintiff offers adequate excuse for the delay and whether plaintiff's case lacks merit. See Erickson, 104 Nev. at 758, 766 P.2d at 900; Monroe, Ltd. v. Central Telephone Co., 91 Nev. 450, 455-56, 538 P.2d 152, 156 (1975).
While the district court has broad discretion in determining whether an NRCP 41(e) dismissal should be with or without prejudice, this discretion is not unbridled. See Transit Casualty Company v. Security Trust Company, 396 F.2d 803, 803 (5th Cir.1968), cert. denied, 393 U.S. 1024, 89 S.Ct. 635, 21 L.Ed.2d 568 (1969) (vacating dismissal with prejudice pursuant to analogous Federal Rule of Civil Procedure 41(b) and directing dismissal without prejudice). In the instant case, Home/Nevada's behavior suggests that it was acting in accordance with a reasonable and good faith belief that its interests were being protected in the litigation between H.S. and Aetna. Home/Nevada's interests were actively asserted before the district court by H.S., and the district court's decision stated that it was based in large part upon Home/Nevada and H.S.'s reply brief. Home/Nevada's one failing was not filing a separate motion for summary judgment, but rather waiting to see how this court would rule on the H.S. judgment on appeal. Home/Nevada waited until after Aetna's appeal against H.S. had been decided to contact Aetna with a request for payment. This delay in contacting Aetna was justifiable, because our decision with respect to H.S. would also conclusively determine Home/Nevada's rights. Home/Nevada followed its initial contact with numerous other attempts to resolve this matter without further resort to the courts. Thus, the circumstances of this case, involving repeated contact between the parties and Home/Nevada's justifiable reliance upon Aetna's behavior, argue in favor of reversing the dismissal with prejudice.
Furthermore, Aetna agreed to represent Home/Nevada in the appeal from the Forest *855 Lane judgment, suggesting a weakening of its position that it did not owe Home/Nevada a duty to defend. Finally, after H.S. obtained its judgment, letters were sent to Aetna on behalf of H.S., Home Savings, and Home/Nevada requesting Aetna pay all litigation costs. Aetna's first response stated, "Before Aetna Casualty & Surety Company pays those attorney's fees and costs which H.S. Service Corporation and Home Savings Association incurred in defending against that lawsuit brought by Forest Lane Associates, it will be necessary for your clients to provide me and Aetna Casualty & Surety Company with detailed documentation regarding these expenditures." While Aetna disputed the amount of reasonable fees owed to H.S. and Home/Nevada, Aetna never informed either H.S. or Home/Nevada that it would not pay the fees incurred by H.S. and paid by Home/Nevada. On the contrary, Aetna led H.S. and Home/Nevada to believe that it would pay these fees once a reasonable amount could be agreed upon. Accordingly, Home/Nevada reasonably believed that, upon resolution of H.S.'s action, Aetna conceded the validity of Home/Nevada's action and was willing to pay all defense costs incurred by both H.S. and Home/Nevada.
We must also note the time frame involved here. H.S. and Home Savings filed the original complaint on November 13, 1981. Five years would have elapsed on November 13, 1986. Yet, the underlying litigation upon which the complaint was based did not conclude until February 6, 1987. In United Ass'n of Journeymen v. Manson, 105 Nev. 816, 783 P.2d 955 (1989), we concluded that it is an abuse of discretion for a district court to dismiss a case with prejudice pursuant to the five-year rule of NRCP 41(e) where the case did not fully ripen within five years of the time it was filed. Id. at 821, 783 P.2d at 958.
In addition, a district court should be more reluctant to dismiss with prejudice when the underlying action is meritorious. In the instant case, Home/Nevada's action had substantive merit, as is clear from the district court's 1984 decision inviting Home/Nevada's motion for summary judgment.
Aetna also contends the district court did not err in dismissing the action with prejudice because the six-year statute of limitations for contract actions in NRS 11.190(1)(b) barred any subsequent action by Home/Nevada, including Home/Nevada's second complaint for damages. We disagree. An insurer obligated by contract to defend an insured owes the insured a continuing duty to defend, and this duty continues throughout the course of the litigation against the insured. Lambert v. Commonwealth Land Title Ins., 53 Cal.3d 1072, 282 Cal.Rptr. 445, 447-48, 811 P.2d 737, 739-40 (1991) (en banc); Israelsky v. Title Ins. Co. of Minnesota, 212 Cal. App.3d 611, 261 Cal.Rptr. 72, 74-75 (1989); Colpan Realty Corp. v. Great Am. Ins. Co., 83 Misc.2d 730, 373 N.Y.S.2d 802, 804 (1975); Bush v. Safeco Ins. Co. of America, 23 Wash.App. 327, 596 P.2d 1357, 1358 (1979). The statute of limitations on a claim against an insurer for breach of its duty to defend commences when a final judgment in the underlying litigation against the insured is entered. Lambert, 282 Cal.Rptr. at 445-47, 811 P.2d at 737-39, 741-42 ("the limitation period for an action under a[n] ... insurance policy for failure to defend accrues when the insurer refuses the insured's tender of defense, but is tolled until the underlying action is terminated by final judgment"); Israelsky, 261 Cal.Rptr. at 73; Colpan Realty Corp., 373 N.Y.S.2d at 804; Bush, 596 P.2d at 1358.
In the instant case, Aetna maintained a duty to defend the action against Home/Nevada which continued until the termination of the underlying litigation. On November 6, 1986, the district court entered a final judgment in favor of Forest Lane against Home/Nevada. On November 10, 1988, Home/Nevada filed another complaint against Aetna seeking declaratory relief and seeking damages for breach of contract and for bad faith. We conclude that, in filing a second complaint seeking damages for Aetna's breach of contract in declining to defend Home/Nevada, Home/Nevada asserted its claim well within *856 six years of the final judgment in the underlying litigation. Therefore no statute of limitation bars Home/Nevada's action against Aetna. Considering that Home/Nevada showed adequate cause for delay in pursuing its action against Aetna, that the merits of the case strongly favored Home/Nevada, and that any subsequent action following dismissal would not be barred by the applicable statute of limitations, we conclude that the district court abused its discretion in dismissing Home/Nevada's action with prejudice.
We conclude the district court erred in granting partial summary judgment in favor of Aetna and in dismissing Home/Nevada's claim with prejudice pursuant to NRCP 41(e). Home/Nevada's claim should have been dismissed without prejudice since Home/Nevada subsequently filed another complaint prior to the running of the statute of limitations, and we conclude that Home/Nevada is not barred from further pursuing recovery from Aetna of fees and costs incurred in defending the Forest Lane action. We have carefully considered all other contentions on appeal, and we conclude that they either lack merit or need not be further addressed in light of our disposition. Accordingly, we reverse and remand for proceedings consistent with this opinion.[4]
NOTES
[1]  On July 20, 1982, Home Savings merged with Nevada Savings and Loan Association, and the resulting company (Home/Nevada) became the parent company of H.S.
[2]  NRCP 41(e) states:

Any action heretofore or hereafter commenced shall be dismissed by the court in which the same shall have been commenced... after due notice to the parties, unless such action is brought to trial within five years after the plaintiff has filed his action.... 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.
(Emphasis added.)
[3]  NRS 11.190 provides, in part:

Periods of limitation. Actions other than those for the recovery of real property, unless further limited by specific statute, can only be commenced as follows:
1. Within 6 years:
....
(b) An action upon a contract, obligation or liability founded upon an instrument in writing....
[4]  The Honorable Miriam Shearing, Justice, did not participate in the decision of this appeal.

The Honorable Michael E. Fondi, Judge of the First Judicial District Court, was designated by the Governor to sit in place of the Honorable John C. Mowbray, Justice. Nev. Const., art. 6, § 4.
The Honorable Myron E. Leavitt, Judge of the Eighth Judicial District Court, was designated by the Governor to sit in place of the Honorable Thomas L. Steffen, Justice. Nev. Const., art. 6, § 4.
