Glen Endre appeals from the summary judgment entered in the . Superior Court (Washington County, Kravchuk, J.) in favor of Niagara Fire Insurance Company on En-dre’s complaint seeking a declaratory judgment that Niagara Fire has the duty to defend and indemnify Endre against an action for negligence brought by Ellis and Audrey Travis for damages allegedly resulting from Endre’s improper installation and service of a propane heater. We vacate the summary judgment in favor of Niagara Fire and grant a summary judgment in favor of Endre on the issue of Niagara Fire’s duty to defend.
Endre, doing business as Sunrise Gas, was a licensed dealer of R.H. Foster, Inc., a propane gas and equipment dealer. Due to the high cost of liability insurance and the resulting adverse effect on the Foster dealers’ profitability, Foster agreed to name its dealers as additional insureds on its general liability policy through Niagara Fire.1 Toward that end, the following two endorsements were added to Foster’s general liability policy:
ADDITIONAL INSURED — VENDORS
WHO IS AN INSURED (Section II) is amended to include as an insured any person or organization (referred to below as vendor) shown in the Schedule, but only with respect to “bodily injury” or “property damage” arising out of “your products” shown in the Schedule which are distributed or sold in the regular course of the vendor’s business....
ADDITIONAL INSURED — OWNERS, LESSEES OR CONTRACTORS— (FORM B)
WHO IS AN INSURED (Section II) is amended to include as an insured the person or organization shown in the Schedule, but only with respect to liability arising out of “your work” 2 for that insured by or for you.
Foster provided Endre with a certificate of insurance informing Endre that his business had been named as an additional insured on Foster’s general liability policy.3
In December 1989, the Travises purchased from a third party a used propane heater for use in their seasonal home in Steuben. The Travises contracted with Endre to install the heater. At some point prior to installing the used heater, Endre installed Foster propane equipment consisting of two 100-pound cylinders, an aluminum hood and a gas regulator, all used to provide propane to a water heater. During the process of installing the used propane heater, Endre spliced into the existing propane line so that both the water heater and the used heater were supplied propane from the same cylinders. In September 1991, a fire at the Travises’ home resulted in $46,700 in damages. The Travises’ homeowner’s insurer provided coverage and the insurer, as subrogee of its insureds, the Travises, filed a complaint against Endre and Foster, alleging that the fire was caused by “Endre’s improper and negligent installation and or servicing of [the used] propane heater and its attachments,” and that En-dre’s negligence was attributable to Foster *513as its duly authorized principal. Following Niagara Fire’s refusal to provide coverage to Endre for this occurrence, Endre filed a complaint seeking a declaration that Niagara Fire owed to Endre the duty to defend and indemnify him against the Travises’ complaint. The parties filed cross-motions for a summary judgment and, following a hearing, the court granted Niagara’s motion, determining that Niagara Fire had neither a duty to indemnify nor a duty to defend Endre against the Travises’ complaint. Endre appeals from the judgment entered accordingly.
“ ‘In reviewing the grant of a motion for a summary judgment, we examine the evidence in the light most favorable to the nonprevailing party to determine whether the trial court committed an error of law.’ ” Enerquin Air, Inc. v. State Tax Assessor, 670 A.2d 926, 928 (Me.1996) (quoting Dubois v. City of Saco, 645 A.2d 1125, 1127 (Me.1994)). We agree with Endre’s first contention that the court erred in its determination that Niagara Fire had no duty to defend. Whether an insurer has a duty to defend is a question of law, L. Ray Packing Co. v. Commercial Union Ins. Co., 469 A.2d 832, 834 (Me.1983), and is “determined by comparing the allegations in the underlying complaint with the provisions of the insurance policy.” NE Properties, Inc. v. Chicago Title Ins. Co., 660 A.2d 926, 927 (Me.1995) (citing Baywood Corp. v. Maine Bonding & Cos. Co., 628 A.2d 1029 (Me.1993)). Endre is “entitled to a defense ‘if there exists any legal or factual basis which could be developed at trial which would obligate [Niagara Fire] to pay under the policy.’ ” Id. (quoting Baywood Corp., 628 A.2d at 1030). “Except in limited circumstances ... an insurer cannot avoid its duty to defend by establishing, before the underlying action has concluded, that ultimately there will be no duty to indemnify.” Northern Sec. Ins. Co. v. Dolley, 669 A.2d 1320, 1322 (Me.1996) (footnote omitted).
Here, the underlying subrogation complaint avers in pertinent part that “[t]he fire was caused by Endre’s improper and negligent installation and or servicing of said propane heater.... Endre’s negligence in [the] improper installation and servicing of said propane heater and its attachments is attributable to Foster as his duly authorized principal.” (Emphasis added.) Based on the allegations in the complaint, there may be facts developed at trial that would result in a factfinder determining the cause of the fire to be either (1) Endre’s negligence in servicing the heater subsequent to its installation, or (2) Endre’s negligence in installing or servicing the “attachments” to the used heater (i.e., the Foster cylinders, aluminum hood, or gas regulators). In either case, Endre’s actions as alleged in the Travises’ complaint could come within the policy’s definition of “your work.” Accordingly, because there “exists a[ ] legal or factual basis which could be developed at trial which would obligate [Niagara Fire] to pay under the policy,” the court erred by granting a summary judgment in favor of Niagara Fire on the duty to defend. Because, however, “ ‘[t]he insured’s duty to indemnify ... may depend on the actual facts or legal theory behind the underlying action against the insured by the injured party,’ ” Mullen v. Daniels, 598 A.2d 451, 454 (Me.1991) (quoting United States Fidelity & Guar. Co. v. Rosso, 521 A.2d 301, 303 (Me.1987)), any consideration of Niagara Fire’s duty to indemnify must be deferred until the trial court has had an opportunity to examine the fully developed facts of the underlying action and “decide whether the insurance contract language requiring indemnification is met in the present circumstances.” Id.
The entry is:
Judgment vacated. Remanded to the Superior Court for entry of summary judgment in favor of Glen Endre, d/b/a Sunrise Gas, on the issue of Niagara Fire Insurance Company’s duty to defend and for further proceedings consistent with the opinion herein.
All concurring.