
373 A.2d 247 (1977)
AMERICAN POLICYHOLDERS' INSURANCE COMPANY
v.
CUMBERLAND COLD STORAGE COMPANY et al.
Supreme Judicial Court of Maine.
May 18, 1977.
*248 Lowry, Platt, Fitzhenry, Lunt & Givertz by Robert D. Platt, Donald G. Lowry, Portland, for plaintiff.
Richardson, Hildreth, Tyler & Troubh by Ronald Russell, Harrison Richardson, Portland, Reef & Mooers by Daniel W. Mooers, Portland, for George I. Lewis.
Before DUFRESNE, C. J., and POMEROY, WERNICK, ARCHIBALD, DELAHANTY and GODFREY, JJ.
DELAHANTY, Justice.
This is an action for declaratory relief brought by American Policyholders' Insurance Company (American). The case is before us on American's appeal from the granting of summary judgment for defendant George I. Lewis (Lewis).
We deny the appeal and affirm the judgment of the Superior Court as modified pursuant to our discussion below.
On October 25, 1973, a fire occurred in a Portland cold storage warehouse owned by Pine State Beef Company (Pine State) and leased to Cumberland Cold Storage Company (Cumberland). Numerous lawsuits for damages resulting from the fire were filed in Cumberland County Superior Court by companies storing goods in the warehouse. On February 13, 1975 American filed a complaint for declaratory judgment seeking a declaration that the general liability insurance policy in question afforded no coverage to Lewis "for either judgment or defense of any suits brought now or in the future, for destruction and/or damage resulting from the fire." On April 30, 1975, Lewis moved to bring in, as additional defendants, various companies who purportedly had stored goods at the premises and were in the process of bringing suit against Lewis. On that same day, American's action against Lewis was consolidated with similar actions by the insurer for declaratory judgment against Pine State and against Cumberland. We are concerned here only with American's appeal from the grant of summary judgment for Lewis.
The policy under consideration provides various coverages, including comprehensive general liability and contractual liability insurance. Lewis is specifically listed in the declarations as a named insured and, according to the terms of the policy, he is thus insured as an individual. In addition, Lewis admitted in his answer that he is an officer of Cumberland, and thus he is also insured as an executive officer of a named organization.
By the terms of both the comprehensive general liability and the contractual liability insurance, American agreed to:
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 any 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. . . .
Both types of coverage contain a specific exclusion for liability for damage to "property in the care, custody or control of the insured as to which the insured is for any purpose exercising physical control." American bottoms its denial of coverage on this provision, alleging that Lewis "was, on behalf of said Cumberland Cold Storage Co., exercising care, custody or control of said damaged and destroyed property."
On October 29, 1975 the presiding Justice granted Lewis' motion for summary judgment. Judgment was entered on November *249 12, 1975, ordering American to "take necessary action to defend defendant, George I. Lewis, and to indemnify said defendant under the terms of said policy, against all claims asserted against defendant, George I. Lewis. . . ." We will consider separately the order to defend and the order to indemnify.
It is accepted in the overwhelming majority of jurisdictions that the obligation of a liability insurance company to defend an action brought against the insured by a third party is to be determined solely by the allegations contained in the complaint in that action. 7A J. Appleman, Insurance Law and Practice, § 4683 (1962); 14 G. Couch, Cyclopedia of Insurance Law, § 51:40 (2d ed. 1965); 50 A.L.R.2d 458, 465-69 (1956). Our Court recognized this pleading test in Marston v. Merchants Mutual Insurance Co., Me., 319 A.2d 111 (1974). We said in Marston that:
the determination of the question whether the insured has a duty to defend the action depends upon whether the complaint in that action states facts which appear to bring the claim of damage within the policy coverage. Id. at 114.
Accordingly, if the allegations in the underlying tort actions in the instant case are within the risk insured against and there is a potential basis for recovery, then American must defend Lewis, regardless of the actual facts or the ultimate grounds on which Lewis' liability to the injured parties may be predicated. 7A Appleman, supra at § 4683: 14 Couch, supra at § 51:45.
The judge below correctly engaged in this comparison test. It is apparent from his decree that he laid the underlying damage complaints alongside the insurance policy and then determined that the pleadings were adequate to encompass an occurrence within the coverage of the policy. He concluded:

The underlying claims against Pine State Beef Co. and George I. Lewis which American Policyholders' Insurance seeks to avoid the obligation to defend and indemnify are based on allegations that Pine State Beef Co. and/or George I. Lewis are the owner or owners of a building in which claimants' property had been stored pursuant to an arrangement with Cumberland Cold Storage, the lessee of Pine State Beef and/or George I. Lewis. Thus, the claims against these two Defendants are based upon their alleged responsibility and negligence as owners of a building. Such liability is clearly within the coverage of the insurance policy referred to. The underlying claims have given rise to a number of civil actions pending in the Superior Court in Cumberland County; this court has reviewed the pleadings in such actions. (emphasis added).
American contends that the justice committed a procedural error and engaged in improper judicial notice when he reviewed the pleadings in the underlying pending civil actions. We disagree. The consolidation order of April 30, 1975 consolidated not only the three declaratory judgment suits but also the related underlying actions brought by the parties whom Lewis had joined as additional defendants. Accordingly, the complaints in the underlying damage claims were properly before the justice, and his judicial notice of them was entirely appropriate. That those pleadings have not been included in the record to this Court is of no consequence.
The above-quoted language of the presiding Justice indicates that, in the underlying damage actions, Lewis was being sued as the owner or co-owner of the building. From the record before us, we cannot ascertain whether Lewis was, in fact, an owner. He admits in his answer that he is an officer of Cumberland, the lessee of Pine State, but this does not rule out the possibility that he is also an owner of the building. In any event, the pleading test for determination of the duty to defend is based exclusively on the facts as alleged rather than on the facts as they actually are. Lee v. Aetna Casualty & Surety Co., 178 F.2d 750 (2d Cir. 1949); see cases cited *250 in 50 A.L.R.2d 458, § 18 at 498-99 (1956).[1] Thus, whether Lewis was, in fact, the owner of the building is totally irrelevant here. In each of the underlying claims Lewis is being sued for negligence as the owner of the building, not as a bailee of the stored goods. Were he sued for negligence as bailee, then the question of the applicability of the "care, custody, or control" exclusion might indeed arise. But here, correctly or not, he is being sued as the owner of the building, and we agree with the presiding Justice that such liability is "clearly within the coverage of the insurance policy." We accordingly conclude that the Justice below correctly ordered that American defend Lewis in each of the underlying actions.
Although we do not hesitate to affirm that portion of the order relating to the duty to defend, we cannot, on the record before us, likewise affirm the granting of summary judgment as to the obligation to indemnify.
Courts have frequently observed that the duty to defend is broader than the duty to pay or indemnify. Missionaries of Company of Mary, Inc. v. Aetna Casualty & Surety Co., 155 Conn. 104, 230 A.2d 21 (1967); Goldberg v. Lumber Mutual Casualty Insurance Co., 297 N.Y. 148, 77 N.E.2d 131 (1948); Employers' Fire Insurance Co. v. Beals, 103 R.I. 623, 240 A.2d 397 (1968). Whereas the duty to defend depends only upon the facts as alleged to be, the duty to indemnify, i. e., ultimate liability, depends rather upon the true facts. Heyden Newport Chemical Corp. v. Southern General Insurance Co., 387 S.W.2d 22 (Tex.1965). Thus, it is not uncommon that an insurer will have a duty to defend based on the allegations in the complaint, yet have no subsequent duty to indemnify the insured. This situation will occur when trial on the merits of the underlying claim proves the facts to be otherwise than as alleged, and judgment is entered on a ground dissimilar to the one contained in the complaint. For instance, in the case before us, there remains a possibility that a judgment may be rendered against Lewis on a theory of bailment. The applicability of the "care, custody and control" exclusion is an issue which would then emerge, although we intend here to intimate no opinion as to its resolution.
The record in this case does not permit a determination that, as a matter of law, American must indemnify Lewis. It is entirely possible that an adverse judgment may be entered against Lewis which American would not be obligated to satisfy. There is therefore a genuine issue as to a material fact; in such a case, summary judgment is improper. M.R.Civ.P. 56(c). See generally Green v. Aetna Insurance Co., 349 F.2d 919 (5th Cir. 1965); All-Star Insurance Corp. v. Steel Bar, Inc., 324 F.Supp. 160 (N.D.Ind.1971).
We recognize that there are many situations in which declaratory judgment may be entered simultaneously as to both the duty to defend and the duty to pay. For example, when the case is based on such issues as nonpayment of a premium, cancellation of a policy, failure to cooperate or lack of timely notice, then both obligations may be appropriately determined prior to the entering of judgment. Green v. Aetna Insurance Co., supra, 349 F.2d at 926; Employers' Fire Insurance Co. v. Beals, supra, 240 A.2d at 402. But in a case such as the one before us, where we find the presence rather than absence of duty to defend, *251 the indemnification obligation depends upon the theory under which judgment is entered in the underlying damage actions.[2]
We therefore delete that portion of the judgment appealed from which states that American must "indemnify said defendant under the terms of said policy" and, as so modified, we affirm the judgment.
The entry must be
Declaratory judgment affirmed as modified.
All Justices concurring.
NOTES
[1]  We recognize that there is some conflict in the case law of the various jurisdictions as to the applicability of this exclusive pleading test when the insurer has knowledge of actual facts which are different from those alleged in the underlying complaint. 7A Appleman, supra at § 4684; 14 Couch, supra at § 51:47. We have examined these cases and have concluded that the most logical rule is the one which predicates the duty to defend solely on the allegations in the complaint, even when the insurer has knowledge of facts to the contrary. Accord, Lamb v. Belt Cas. Co., 3 Cal.App.2d 624, 40 P.2d 311 (1935); McFadyen v. North River Ins. Co., 62 Ill.App.2d 164, 209 N.E.2d 833 (1965). Contra, Hardware Mut. Cas. Co. v. Hilderbrandt, 119 F.2d 291 (10th Cir. 1941); Marshall's United States Auto Supply, Inc. v. Maryland Cas. Co., 354 Mo. 455, 189 S.W.2d 529 (1945) and cases cited in 50 A.L.R.2d 458, § 20 at 500-04 (1956).
[2]  We note that some courts believe that declaratory judgment on the duty to indemnify if never appropriate prior to judgment being entered against the insured. Since a verdict in the insured's favor in the underlying claim would totally dispense with the question of indemnity, there is no satisfaction of the "real controversy" requirement for a declaratory judgment; there exists only a contingent possibility of a future dispute. See cases cited in 142 A.L.R. 8, 32-33 (1943).

We do not intend that our holding in this case be interpreted as an adoption of the above view. Rather, we concur with what we believe to be the better-reasoned authority which holds that a judgment against the insured is not a condition precedent to the determination of the duty to indemnify. See, e. g., Associated Indem. Corp. v. Manning, 92 F.2d 168 (9th Cir. 1937); Ohio Cas. Ins. Co. v. Miller, 29 F.Supp. 993 (E.D.Mich.1939); see generally 142 A.L.R. 8, 29-38 (1943). Summary judgment on the indemnity issue in this particular case was inappropriate prior to the entering of judgment against Lewis not because of a lack of ripeness or actual controversy, but simply because certain essential determinants of the duty to indemnify, such as the theory under which liability, if any, would be imposed on Lewis, could not be foreseen by the presiding Justice.
