In this case we address the issue of an insurance company’s duty to represent its insured in a lawsuit.
A 1982 winter storm blew down a pole barn being built on the Ballantyne Brothers farm. Claiming its subcontractor was negligent, the seller/contraetor, Menard, Inc., refused to pay the subcontractor, Hart Construction Company, for the additional cost of rebuilding the pole barn. Hart sued Menard and the Ballantynes. Menard and the Bal-lantynes answered, raising the affirmative defense of negligence. Menard cross-claimed against the Ballantynes for failure to maintain insurance required by their agreement. Ballantynes counterclaimed against Hart for indemnity from Menard’s cross-claim. Hart amended his complaint adding his insurer, American Family Mutual Insurance Company, as a defendant, claiming American Family had a duty to defend and indemnify him from the affirmative defenses of, and counterclaim for, negligence. American Family denied liability, claiming it had no obligation to assist in Hart’s suit. Hart’s claim against American Family was severed from the rest of Hart’s claims. The district court granted American Family’s motions for summary judgment concluding American Family had no duty to defend or indemnify Hart under the insurance policy. Hart appeals.
We reverse and remand, holding: (1) the Ballantynes’ counterclaim for negligence was a “suit for damages” under the insuring clause of Hart’s American Family policy; (2) Hart’s policy, as amended, provided coverage for Hart’s negligence; and therefore, (8) American Family was under a duty to defend Hart from the Ballantynes’ counterclaim.
I
Michael E. Hart, Jr., owns an incorporated construction business, Hart Construction Company. In September 1981, Hart agreed with Menard, Inc., to serve as a subcontractor to build Menard farm buildings. Under the agreement, Hart was required to purchase and maintain insurance protecting against claims arising out of Menard con*386tracts performed by Hart as subcontractor.1 Hart took the Menard/Hart agreement to James Donahue, his American Family insurance agent, and requested an update in his comprehensive general liability insurance (CGL) policy. Hart’s original CGL policy, effective May 22, 1981, provided $300,000 bodily injury liability coverage, and $100,000 property liability coverage. The policy also contained a “CL-425” endorsement, modifying the policy’s exclusions section.
Donahue forwarded the necessary paperwork and a copy of the Menard/Hart agreement to American Family. American Family issued a change endorsement amending Hart’s policy. Under the amended policy, American Family agreed to insure Hart for $1,000,000 bodily injury and property damage liability coverage, effective November 21, 1981. The change endorsement did not include, or refer to, the CL-425 endorsement.
In October 1981, Menard sold a pole barn to the Ballantyne Brothers, a farming operation at Westhope, North Dakota, and assigned Hart to perform the work on the contract. In February 1982, a winter storm with high winds blew down the partially completed pole barn. Under the contract with Menard, the Ballantynes were required to carry builder’s risk insurance. The Ballan-tynes had not purchased builder’s risk insurance. The Ballantynes claimed the pole barn collapsed because of Hart’s negligent construction. Hart filed a claim with American Family. American Family concluded Hart’s amended policy did not provide coverage for negligence. American Family did not notify Hart of its conclusion. Instead, American Family sent a letter to the Ballantynes denying the claim, explaining an investigation found no negligence on Hart’s part.
Hart repaired the damage and finished construction on the pole bam. Based on its contention that Hart’s negligence was responsible for the collapse, Menard refused to pay Hart for the extra material and labor costs of rebuilding the pole barn. Claiming authority under the Menard/Hart agreement, Menard also withheld payments for other jobs Hart had completed. Hart sought indemnity from American Family. American Family refused coverage.
In 1986, Hart Construction Company and Michael E. Hart, Jr., (collectively Hart) sued Menard, Inc., and Russell and Orlyn Ballan-tyne, doing business as Ballantyne Brothers (Ballantynes), claiming breach of contract and fraud and deceit. The suit sought damages for labor costs, material costs, lost profits, and loss of business. Menard answered, claiming because Hart was negligent in constructing the pole bam, all sums due under the Menard/Hart agreement were satisfied by payment. Menard filed a cross-claim against the Ballantynes, claiming the Ballan-tynes were under a contractual duty to carry builder’s risk insurance, and therefore, the Ballantynes were liable to Menard for any sums due under Hart’s complaint. The Bal-lantynes defended by claiming Hart was negligent in constructing the pole barn. The Ballantynes counterclaimed against Hart seeking indemnity in the event Menard recovered judgment against them for damages resulting from the collapsed barn.
In response to Menard’s defense and the Ballantynes’ counterclaim, Hart amended his complaint and added American Family as a defendant. Hart claimed American Family should defend and indemnify him from Me-nard’s affirmative defense of, and the Ballan-tynes’ counterclaim for, negligence. Hart’s claim against American Family was severed from the claims against Menard and the Bal-lantynes. A jury returned a verdict in Hart’s favor on his claim against Menard and the Ballantynes. The jury found the collapse of the pole barn was not caused by Hart’s negligence.
Following the jury verdict, Hart renewed his claims against American Family, arguing: *387(1) American Family was under an obligation to defend and indemnify him against Me-nard’s and the Ballantynes’ charges of negligence; (2) American Family acted in bad faith when it refused to defend and indemnify him; and (3) he is entitled to damages.
In its motions for summary judgment and dismissal, American Family argued: (1) under the CGL policy, American Family was not obligated to indemnify Hart against Me-nard’s actions of self-help; (2) under the CGL policy, American Family was not obligated to provide legal support in Hart’s plaintiff suit against Menard and the Ballan-tynes because: (a) there was no suit for damages against Hart, and (b) the CGL policy excluded coverage for damages caused by Hart’s negligence; and, (3) American Family acted in good faith and provided the insurance coverage Hart requested.
In a March 9,1990, memorandum decision, the district court granted American Family partial summary judgment, concluding American Family was not liable to Hart under the CGL policy:
“Despite Plaintiffs argument that it makes no difference whether Mr. Hart commences an action or is being sued as a defendant, it appears the basis for the liability insurance coverage under Coverage B, property damage liability, is clearly applicable only when insured ‘shall become legally obligated to pay as damages’.... Where the plaintiff, as an insured, commences a lawsuit to collect monies legally owed him, and the affirmative defense of negligence is alleged by the defendants, this court concludes as a matter of law that no obligation exists upon the insurer under the general contracting language of this policy.”
The district court also concluded the doctrine of reasonable expectations of the insured did not apply in this case. The court however allowed Hart to amend his complaint:
“The only matter unresolved is whether the Plaintiff has any claim for relief remaining or available as a result of the evidence now before the Court. While this Court hesitates to develop any theories or claim for relief in a case, Plaintiff has raised throughout the case, the issue of whether the insurance coverage was less than what Plaintiff requested and discussed with his agent, Mr. Donahue_ Stated differently, the issue of whether the insurer through their agent failed or omitted to initially procure the proper insurance for Mr. Hart.”
In response to the March 9, 1990, memorandum decision, Hart moved to amend the complaint and for reconsideration of the issue of coverage under the policy. Hart argued American Family was under a duty to defend him against Menard’s and the Ballan-tynes’ claims of negligence. The district court, in a May 3, 1990, memorandum decision, granted Hart’s motion to amend the complaint, but denied Hart’s motion for reconsideration. The court explained:
“A review of [duty to defend cases] confirms that in each case the insured had been sued by a third party. This factor is a fundamental difference in Plaintiffs case. A review of North Dakota caselaw, neighboring jurisdictions, and the treatises have not turned up any caselaw to support the Plaintiffs position of a duty to defend when the insured commences the action. Very clearly, the duty to defend is triggered by two factors. First, the insured is sued by a third party. Second, the language in the Complaint of the third party. Plaintiffs assertion to extend the duty to defend to an action commenced by the insured against third parties who raise an affirmative defense of negligence is without authority, and is not a natural extension of this liability policy.”
In Hart’s amended complaint, he added his agent, James Donahue, as a defendant. The amended complaint included claims against American Family and Donahue for a breach of contract, breach of fiduciary duty, breach of duty of good faith and fair dealing, negligence, and fraud and deceit. Hart settled his claims against Donahue.
American Family moved for summary judgment on Hart’s amended complaint. Hart responded and again requested the court reconsider its March 9, 1990, decision. In support of his motion, Hart argued a factual dispute as to coverage in effect at the *388time the barn collapsed. Specifically, Hart argued the CL-425 endorsement, which had been attached to his original policy, was not in effect as part of the November 21, 1981, amended policy. According to Hart, without the CL-425 endorsement, the amended policy provided coverage for negligent construction. American Family responded, arguing it was only required to defend Hart if there was a suit against Hart seeking damages. American Family claimed this condition had not been met.
On October 8, 1992, the district court granted American Family’s motion for summary judgment on the amended complaint, and denied Hart’s second motion for reconsideration. The court concluded:
“1. There is no duty to defend by American Family based upon the facts underlying this litigation.
2. There is no coverage other than liability coverage by American Family. Therefore, there is no contractual obligation to defend against the affirmative defense of comparative negligence.
3. There is no basis for a claim for bad faith by American Family based upon their response to the claim filed by Hart.”
II
The standard of review on a motion for summary judgment is clear:
“Under Rule 56, N.D.R.Civ.P., a summary judgment should be granted only if it appears that there are no issues of material fact or any conflicting inferences which may be drawn from those facts. The party seeking summary judgment has the burden to clearly demonstrate that there is no genuine issue of material fact. In considering a motion for summary judgment, the court may examine the pleadings, depositions, admissions, affidavits, interrogatories, and inferences to be drawn from the evidence to determine whether summary judgment is appropriate. The court must view the evidence in a light most favorable to the party opposing the motion, and that party will be given the benefit of all favorable inferences which can reasonably be drawn from the evidence. Courts must also consider the substantive standard of proof at trial when ruling on a motion for summary judgment.”
Ellingson v. Knudson, 498 N.W.2d 814, 817 (N.D.1993) (citations omitted).
The construction of a written contract to determine its legal effect is a question of law for the court to decide. Miller v. Schwartz, 354 N.W.2d 685, 688 (N.D.1984). In Continental Cas. Co. v. Kinsey, 499 N.W.2d 574, 577-78 (N.D.1993), we set forth this Court’s method of contract interpretation:
“The primary goal of contract interpretation is to give effect to the mutual intention of the parties as it existed at the time of contracting. Section 9-07-03, N.D.C.C.; National Bank v. International Harvester Co., 421 N.W.2d 799 (N.D.1988). If possible, the intention of the parties is to be ascertained from the written contract alone. Section 9-07-04, N.D.C.C.
“As a tool for interpreting insurance policies, this Court has expressly adopted the ‘Doctrine of Contract of Adhesion,’ whereby ambiguous policies are construed most strongly against the insurers and in favor of providing insurance coverage.... [See] Aid Ins. Services, Inc. v. Geiger, 294 N.W.2d 411, 414-415 (N.D.1980):
⅜ ⅜ ⅜ ⅜ ⅜?
“However, we do not apply this doctrine in a vacuum. If parol evidence is offered which clearly indicates that the parties, particularly the insured, did not contemplate insurance coverage under the circumstances, or if application of other relevant rules of contract interpretation clearly shows that the parties did not intend coverage, then the Doctrine of Contract of Adhesion will not be applied to obtain a contrary result.”
Continental Cas. Co., 499 N.W.2d at 577-78.
Ill
A
American Family contends, under the insuring clause of the policy, it was not under a duty to defend Hart against the Ballantynes’ counterclaim or Menard’s affirmative defense of negligence because Hart was not sued for *389damages. The insuring clause of Hart’s policy provides:
“The company will pay on behalf of the insured all sums which the insured shall become legally obligated to pay as damages because of
A. bodily injury, or
B. property damage
To which this insurance applies, caused by an occurrence, and the company shall have the right and duty to defend any suit against the insured seeking damages on account of such bodily injury or property damage, even if any of the allegations of the suit are groundless, false or fraudulent, and may make such investigation and settlement of any claim or suit as it deems expedient, ...” (Emphasis added.)
In Kyllo v. Northland Chemical Co., 209 N.W.2d 629 (N.D.1973), this Court explained the standard for determining whether an insurer has a duty to defend.
“ ‘The insurer’s obligation to defend must be measured by the terms of the insurance policy and the pleading of the claimant who sues the insured.... If the allegations of the claimant’s complaint would support a recovery upon a risk covered by the insurer’s policy, then the duty to defend is present.’ ”
Kyllo at 634, (quoting Blackfield v. Underwriters at Lloyd’s, London, 245 Cal.App.2d 271, 53 Cal.Rptr. 838, 840 (1966)). Any doubt as to whether the duty to defend exists is resolved in favor of the insured. Kyllo, 209 N.W.2d at 634; see also National Farmers v. Kovash, 452 N.W.2d 307 (N.D.1990); Aid Ins. Services, Inc. v. Geiger, 294 N.W.2d 411 (N.D.1980).
The insuring clause of Hart’s policy places three conditions precedent on American Family’s duty to defend. First, there must be a “suit” against the insured. Second, the suit against the insured must seek “damages.” Third, the alleged bodily injury or property damage must be based on an occurrence to which the insurance applies. The first condition has been met. The Bal-lantynes’ counterclaim is a “suit” under the policy. See Baldt Inc. v. American Universal Ins. Co., 599 F.Supp. 955, 957 (E.D.Pa.1985) (When the allegations in a counterclaim state a claim that may potentially fall within the policy’s coverage, the insurer must provide a defense.); Maryland Casualty Company v. Willsey, 380 P.2d 254, 258 (Okl.1963).
According to American Family, the Ballan-tynes’ counterclaim for indemnity was not a suit for damages under the policy because if the Ballantynes prevailed, Hart would not have had to pay money damages. American Family cites Stuhlmiller v. Nodak Mut. Ins. Co., 475 N.W.2d 136 (N.D.1991), Thief River Falls v. United Fire & Cas. Co., 336 N.W.2d 274 (Minn.1983), and Ladd Const. Co. v. Ins. Co. of North America, 73 Ill.App.3d 43, 29 Ill.Dec. 305, 391 N.E.2d 568 (1979). These cases are not persuasive.
In Stuhlmiller, a worker was injured while riding in his vehicle which was driven by a co-employee. After collecting workers’ compensation benefits, the worker attempted to recover under his liability insurance policy, which insured the vehicle, and under the co-employee-driver’s underinsured motorist liability policy. The liability portion of the injured worker’s policy provided the worker could recover only if the driver of the vehicle was “legally liable to pay” damages for the worker’s injuries. Similarly, the co-employee-driver’s underinsured motor vehicle policy provided coverage only if the worker was “legally entitled to recover” from the co-employee-driver. This Court held the worker was not entitled to recover under either of the policies because the workers’ compensation statute granted the co-employee-driver immunity for the work-related accident and provided the sole remedy for the injured worker. See also Cormier v. Nat. Farmers U. Prop. & Cas., 445 N.W.2d 644 (N.D.1989).
This case is very different from Stuhlmil-ler. In this case, had the Ballantynes prevailed on their counterclaim of negligence, Hart would have been “legally liable” to pay damages, and the Ballantynes would have been “legally entitled” to recover from Hart. Hart was not immune from the Ballantynes’ suit for negligence.
Thief River Falls, and Ladd Const. Co. are also very different from this case. In both Thief River Falls and Ladd Const. Co., the suit against the insured sought equitable re*390lief in the form of an injunction, not money damages or indemnity. In both cases, the reviewing courts concluded injunctive relief was not covered under the insurance policies’ “suit for damages” provisions.
“‘Clearly, the policy covers only payments to third persons when those persons have a legal claim for damages against the Insured on account of injury to or destruction of property. The obligation of the insurer to pay is limited to “damages”, a word which has an accepted technical meaning in law.’ Black’s Law Dictionary (3d Ed.) p. 499 defines damages as:
“A pecuniary compensation or indemnity which may be recovered in the courts by any person who has suffered loss, detriment or injury, whether to his person, property, or rights, through the unlawful act or omission or negligence of another.”
‘This is a far cry from the cost to unsuccessful litigants of complying with an in-junctive decree.’ ”
Ladd Const. Co., 391 N.E.2d at 571 (quoting Aetna Casualty and Surety Co. v. Hanna, 224 F.2d 499, 53 A.L.R.2d 1125 (5th Cir.1955)).
The Ballantynes’ counterclaim was not a suit for injunctive relief, it was a suit seeking indemnity. If successful, the counterclaim would have required Hart to indemnify the Ballantynes. Black’s Law Dictionary, 6th Edition, p. 769, defines “indemnify” as:
“To restore the victim of a loss, in whole or in part, by payment, repair, or replacement. To save harmless; to secure against loss or damage; to give security for the reimbursement of a person in case of an anticipated loss falling upon him. To make good; to compensate; to make reimbursement to one of a loss already incurred by him.”
The word “damages” in the insuring clause of Hart’s CGL policy is broad enough to include a suit for indemnification. Accordingly, we construe the policy against American Family. Any other conclusion would elevate form over substance and lead to an absurd result. See Simon v. Maryland Casualty Company, 353 F.2d 608, 613 (5th Cir.1965); American Home Assur. Co. v. Miller, 717 F.2d 1310, 1312 (9th Cir.1983). Hart was “sued for damages.”
B
Because the district court thought there was no “suit for damages,” it held American Family owed no duty to Hart, regardless of the type of coverage American Family provided. Having concluded Hart was sued for damages, however, we must determine whether the amended CGL policy included coverage for Hart’s negligence.
The issue of coverage turns on whether Hart’s amended policy included a CL^25 endorsement. Without a CL-425 endorsement, the language in Hart’s policy has been interpreted by this Court to include coverage for negligent construction. See Applegren v. Milbank Mut. Ins. Co., 268 N.W.2d 114, 118 (N.D.1978); Aid Ins. Services, Inc., 294 N.W.2d at 414. Hart argues his amended CGL policy did not include a CL-425 endorsement, and therefore, the policy provided coverage for his negligence. American Family argues the change endorsement, which increased Hart’s coverage, did not alter any of the other terms of the existing policy, including the CL-425 endorsement.
In its original form, Hart’s policy included a CL-425 endorsement attached to modify exclusion (a) of the bodily injury liability and property damage liability sections of the policy. The change endorsement, which amended the policy in November 1981, provided, in part:
“IT IS AGREED THAT THE POLICY IS AMENDED AS FOLLOWS:
THE LIMITS OF LIABILITY ARE CHANGED TO READ AS PER ATTACHED. THE EXPOSURE FOR CODE # 15145 IS CHANGED TO READ AS PER ATTACHED. CODES # 17765S, 17761S & 16299 ARE ADDED TO THE POLICY AS PER ATTACHED. COVERAGE PARTS L9288 1/73 PERSONAL INJURY LIABILITY INSURANCE, L6400 1/73 CONTRACTUAL LIABILITY INSURANCE & L9300 1/73 EXTENSION SCHEDULE ARE ADD*391ED TO THE POLICY AS PER ATTACHED.
⅜ ⅜ ⅜ ¾: ⅜ ⅜
“All other terms, agreements, conditions, and provisions remain unchanged.”
Included as an attachment was a page titled “Comprehensive General Liability Insurance.” The attached page provides, in part:
“For attachment to Policy No. ... to complete said policy.
[[Image here]]
“The insurance afforded is only with respect to such of the following Coverages as are indicated by specific premium charge or charges. The limit of the company’s liability against each such Coverage shall be as stated herein, subject to all the terms of this policy having reference thereto.”
The attached page lists “Coverages” as “A-Bodily Injury Liability” and “B-Property Damage Liability,” in the amounts of $1,000,-000 each. The attached page also provides a box for “[f]orm numbers of endorsements attached at issue.” Although several form numbers are listed, the CL-425 endorsement is riot. Printed on the back of the coverage page is a list of the terms for bodily injury and property damage liability coverage. The listed terms repeated are identical to the unmodified terms included in the original policy, including the original unmodified exclusion (a).
The terms attached as part of the change endorsement directly conflict with the terms of the original policy as modified by the CL-425 endorsement. When there is a conflict between the provisions of an insurance policy and an attached endorsement, the provisions of the endorsement prevail. State Farm v. LaRoque, 486 N.W.2d 235, 237 (N.D.1992); Thiel Industries v. Western Fire Ins. Co., 289 N.W.2d 786, 788 (N.D.1980); Haugen v. Auto-Owners Insurance Co. of Lansing, 191 N.W.2d 274, 280 (N.D.1971). Under the terms of the change endorsement, as interpreted by prior decisions of this Court,, the policy provides coverage for negligent construction. American Family was under a duty to defend Hart from the Ballan-tynes’ counterclaim.
IV
American Family contends that when Hart settled his claims against Donahue, he also released American Family from any vicarious liability arising from Donahue’s acts or omissions. Hart’s claims against Donahue were based on Donahue’s alleged failure to secure the appropriate insurance for Hart. Because American Family was under a direct contractual duty to defend Hart, the issue of vicarious liability for failure to secure appropriate insurance is moot. The release of a servant does not release the master from liability claims for its “own wrongful conduct independent of any theory of vicarious liability.” Zimprich v. N.D. Harvestore Systems, 419 N.W.2d 912, 913 (N.D.1988). Thus, Hart’s release of Donahue did not released direct liability claims against American Family.
American Family also contends that because its duty to defend Hart was fairly debatable, Hart’s claim of bad faith should, as a matter of law, be dismissed. North Dakota recognizes a cause of action for breach of the implied covenant of good faith and fair dealing in an insurance policy. See Corwin Chrysler-Plymouth v. Westches-ter Fire, 279 N.W.2d 638, 643 (N.D.1979). The mere fact that an insurer’s position is held invalid by the courts does not necessarily mean it acted in bad faith. Corwin Chrysler-Plymouth at 644-45. The test for an insurer’s bad faith is whether the “insurer has acted unreasonably in handling an insured’s claim by failing to compensate the insured, without proper cause, for a loss covered by the policy.” Seifert v. Farmers Union Mut. Ins. Co., 497 N.W.2d 694, 698 (N.D.1993) (quoting William M. Shernoff, et al., Insurance Bad Faith Litigation, § 5.02[2] (1992)). Whether an insurer has acted in bad faith in refusing to pay amounts claimed under an insurance policy is in question of fact. Szarkowski v. Reliance Ins. Co., 404 N.W.2d 502, 505 (N.D.1987); Corwin Chrysler-Plymouth 279 N.W.2d at 644.
The district court dismissed Hart’s bad faith claim because it concluded the insurance policy did not obligate American Family *392to defend Hart. There was a duty to defend. It is necessary, therefore, for the district court to consider the merits of Hart’s bad faith claim.
The judgment of the district court is reversed, and this case is remanded for trial.
VANDE WALLE, C.J., MESCHKE, J., and RALPH J. ERICKSTAD, Surrogate Judge, concur. RALPH J. ERICKSTAD, Surrogate Judge, sitting in place of NEUMANN, J., disqualified.. Article 6 of the Menard/Hart agreement provided:
"Article 6: Insurance
Section A — The Subcontractor agrees to purchase and maintain insurance which will protect him from claims arising out of each contract given to him, whether said claim arises out of the Subcontractor's work or the work of his agents or employees. Such insurance shall include but not be limited to:
⅜ ⅜ * sfc ⅝ ⅜:
2) General Liability coverage in the amount of One Million Dollars for personal injury and One Million Dollars for properly damage."