
150 Ariz. 248 (1986)
722 P.2d 975
INA INSURANCE COMPANY OF NORTH AMERICA, a Pennsylvania corporation, Plaintiff-Appellee,
v.
VALLEY FORGE INSURANCE COMPANY, a Pennsylvania corporation, Defendant-Appellant.
No. 1 CA-CIV 7692.
Court of Appeals of Arizona, Division 1, Department D.
May 29, 1986.
*250 Gammage & Burnham by Richard B. Burnham, Richard K. Mahrle, Phoenix, for plaintiff-appellee.
Chandler, Tullar, Udall & Redhair by Keith W. Kroese, Tucson, for defendant-appellant.
OPINION
GRANT, Presiding Judge.
This is an appeal from the granting of summary judgment for appellee INA Insurance Company of North America (INA) against Valley Forge Insurance Company (Valley Forge). We must decide whether the trial judge correctly determined that INA was entitled to indemnification from Valley Forge for attorney's fees and costs.
FACTS
In November 1980, Pamela Marks (not a party to this appeal) purchased a Valley Forge homeowners insurance policy through Valley Forge's authorized agent, Russell L. Strand d/b/a Strand Insurance Agency (Strand). The Marks home was destroyed by fire in May, 1981. Ms. Marks submitted a loss claim to Valley Forge.
Valley Forge believed the fire was of suspicious origin and probably intentionally set by Ms. Marks's husband, James. It also determined that Ms. Marks's proofs of loss were insufficient. By letter of January 20, 1982, a claim representative for CNA, an affiliate of Valley Forge, notified Marks that there was no coverage for her loss because of the insufficient proofs of loss and because of an exclusion for intentional acts applicable to the insured James Marks.
Pamela Marks filed suit in federal district court. She named as defendants CNA (in reality Valley Forge), the Strand Insurance Agency, and the agency's owner. Count I against all defendants alleged that Marks had performed all of her obligations under the contract and that the defendants refused to pay her under the policy. Count III, also against all defendants, claimed that the defendants had intentionally inflicted emotional distress upon the plaintiff. Count II alleged, in part, against all defendants:
2. That on or about November 10, 1980, defendants, R.L. STRAND, R.L. STRAND d/b/a STRAND INSURANCE AGENCY, and CHA [sic], represented to plaintiff that they would sell, and did sell, a policy of insurance that would protect plaintiff's property against loss due to fire and that in the event such a loss occurred they would promptly pay all amounts due plaintiff.
3. The representations so made by the defendants, and each of them, were, in fact, false and fraudulent. The true facts were that defendants, and each of them, did not intend to pay plaintiff when her property was destroyed by fire.
4. When defendants, and each of them, made such representations, they knew them to be false and said statements were made with the intent to defraud and deceive plaintiff and to induce her to purchase said property insurance policy.
Count IV contained allegations only against Strand:
2. That on or about November 10, 1980, defendant, R.L. STRAND and R.L. STRAND d/b/a STRAND INSURANCE AGENCY, sold a homeowners insurance policy to plaintiff, covering plaintiff's property with a maximum limit of $50,000.00 on the dwelling.
3. That on that date and ever since that date the reasonable value of the insured's dwelling was $75,000.00, and *251 defendants R.L. STRAND and R.L. STRAND d/b/a STRAND INSURANCE AGENCY knew that the dwelling was worth $75,000.00 but carelessly and negligently failed to provide sufficient coverage on said dwelling to adequately protect plaintiff in the event the dwelling was totally destroyed by fire.
Strand tendered defense of the suit to Valley Forge, pursuant to an indemnification clause in an agreement between them entitled "Standard Agency Agreement":
Loss Control
We will indemnify and hold you harmless against liability you may become obligated to pay for damages sustained and caused by our error or omission in connection with our performance of loss control counseling ... or similar related work ..., provided you have not caused or contributed to such liability by your own acts, errors or omissions. You agree as a condition to such indemnification to notify us of any claim or suit against you and to allow us to make any investigation, settlement or defense we deem prudent.
Valley Forge refused to provide a defense. It concluded that there was no contractual or legal duty to defend Strand because Marks's complaint made allegations of independent negligence against Strand. Strand subsequently was defended by his professional errors and omissions insurer, INA.
The Marks suit was dismissed by stipulation. Prior to dismissal, however, INA incurred attorney's fees and costs in defending Strand. Once the Marks suit was terminated, INA demanded that Valley Forge pay these expenses. Valley Forge refused, and this suit followed. The trial court granted summary judgment in favor of INA awarding attorney's fees and costs to INA.
THE RIGHT TO INDEMNITY
Valley Forge's position, in its appeal from the summary judgment, is that the complaint contained allegations of Strand's own wrongdoing which contributed to Marks's alleged losses. Valley Forge characterizes Count II of the complaint in Marks v. CNA as an allegation that R.L. Strand represented that the policy would cover fire losses even when caused by the insured's arson. The other alleged wrongdoing, in Count IV, was Strand's failure to provide adequate insurance. According to Valley Forge, allegations of the complaint determine whether there is a duty to indemnify. Because there were allegations pertaining to Strand's independent wrongdoing, Valley Forge concludes that there was no right of indemnity at all, even though there were other counts which might arguably give Strand the right to indemnity. The language in the indemnity provision on which Valley Forge relies is that there is a right to indemnity "provided you [Strand] have not caused or contributed to such liability by your own acts, errors or omissions." Valley Forge also relies on the theory of implied indemnity, and on cases analyzing the duty to defend.
To INA, the proper resolution of the issue concerning the significance of the complaint is reached by using rules developed in implied indemnity cases. INA views the indemnity provision as a recitation of implied indemnity principles under § 439 of the Restatement (Second) of Agency (1958).[1] INA urges us to apply *252 common law indemnity principles to the express indemnity provision because the contractual provision is substantially identical to the common law obligation.
The parties do not rely on the express agreement to answer the two central issues: (1) whether the allegations of a third party's complaint against the parties to the indemnity contract control the accrual of the right of indemnification, and (2) whether allegations of independent wrongdoing against the agent Strand, accompanied by allegations which would otherwise entitle the agent to indemnity, bar completely the agent's right of indemnification. Valley Forge and INA tacitly recognize that the contract alone does not answer the questions posed because they go to the heart of the concept of indemnity, whether express or implied.
When there is an express indemnity contract, the extent of the duty to indemnify must be determined from the contract, Skousen and Pecan Centers of Ariz. v. Olsen Investment, 149 Ariz. 251, 717 P.2d 930 (App. 1986); Estes Co. v. Aztec Construction, Inc., 139 Ariz. 166, 168, 677 P.2d 939, 941 (App. 1983), and not by reliance on implied indemnity principles, Rossmoor Sanitation, Inc. v. Pylon, Inc., 13 Cal.3d 622, 119 Cal. Rptr. 449, 532 P.2d 97 (1975).
Recovery under a contract providing for indemnity obviates any right to recover under the common law theory of implied indemnity since by such an express contract the parties have already themselves determined how and under what circumstances losses shall be allocated.
Prater v. Luhr Brothers, Inc., 51 Ill. App.3d 685, 691-92, 9 Ill.Dec. 142, 147, 366 N.E.2d 399, 404 (1977). Accord Booth-Kelley Lumber Co. v. Southern Pacific Co., 183 F.2d 902 (9th Cir.1950); Frederick v. Hess Oil Virgin Islands Corp., 492 F. Supp. 1338 (D. St. Croix V.I. 1980), aff'd mem. 642 F.2d 53 (3d Cir.1981); Wyoming Johnson, Inc. v. Stag Industries, Inc., 662 P.2d 96 (Wyo. 1983). Cf. McGinn v. Northwestern Steel and Wire Co., 68 Ill. App.3d 632, 24 Ill.Dec. 867, 386 N.E.2d 71 (1978) (party may pursue indemnification under express contract and under common law, but may recover on only one theory).[2]
In the absence of an express indemnity agreement, a party has a right to indemnity when there is an implied contract for indemnity or when justice demands there be the right. First National Bank v. Otis Elevator Co., 2 Ariz. App. 596, 411 P.2d 34 (1966) modifying 2 Ariz. App. 80, 406 P.2d 430 (1965). See Restatement of Restitution § 76 (1937); Restatement of Agency (Second) § 439. A right of implied contractual indemnity may arise when an agent, through no wrongdoing of his own, incurs liability for an act performed on behalf of a principal, e.g., Southern Farm Bureau Casualty Insurance Co. v. Gooding, 263 Ark. 435, 565 S.W.2d 421 (1978). Indemnity by operation of law may arise when liability is imposed on a joint tortfeasor due only to his "passive" or "secondary" negligence, e.g., Busy Bee Buffet v. Ferrell, 82 Ariz. 192, 310 P.2d 817 (1957).
Contractual and implied indemnity, while arising under different circumstances, share the same basis: indemnity is an "obligation resting on one party to make good a loss or damage another party has incurred." Rossmoor Sanitation, Inc. v. *253 Pylon, Inc., 13 Cal.3d at 628, 119 Cal. Rptr. at 452, 532 P.2d at 100. In this sense whether the right to indemnity fails to accrue because of the wrongdoing of the indemnitee is not dependent upon whether the right arises out of contract or is implied.
We therefore conclude that the issue of whether allegations of a complaint control the right to indemnity is really an issue of when the right to indemnity accrues. Basically, Valley Forge is claiming that any such right accrues at the beginning, and only at the beginning, of litigation initiated by a third party. We conclude that such an analysis renders the right of indemnity illusory as it would be controlled by one not a party to the indemnity relationship.
A contractual right of indemnity may accrue upon the happening of one or both of two events. Skousen and Pecan Centers v. Olsen Investment. Indemnification against liability applies once liability for a cause of action is established; the indemnitee is not required to make actual payment. Alberts v. American Casualty Co., 88 Cal. App.2d 891, 899, 200 P.2d 37, 42 (1948); 42 C.J.S. Indemnity § 14(b) (1944). This somewhat circular definition may be clarified by example: a party seeking liability indemnification for a tort judgment rendered against him would not have to pay the judgment for his right to indemnification for liability to accrue. An indemnification against loss or damages, in contrast, applies when the indemnitee has actually paid the obligation for which he was found liable. Alberts v. American Casualty Co., 88 Cal. App.2d at 898-99, 200 P.2d at 41; 42 C.J.S. Indemnity § 14(c). An agreement may also provide for both types of indemnification. Alberts v. American Casualty Co., 88 Cal. App.2d at 899, 200 P.2d at 48. The standard agency agreement at issue here appears to be one indemnifying against liability, as actual payment is not required: "We will indemnify and hold you harmless against liability you may become obligated to pay for damages...."
The accrual of the right to indemnity is important here, not to determine which point of accrual is provided for in the agency agreement, but to illuminate a basic principle of indemnity. The right exists when there is a legal obligation on the indemnitee to pay or a sum is paid by him for which the indemnitor should make reimbursement. Such an obligation or sum cannot be imposed solely by a third party's unproven allegations against the indemnity parties, but requires factual determinations.
The indemnity provision is a recognition by Valley Forge of this fundamental principle of indemnity. The language of the provision removes the right of indemnity only when Strand has "caused or contributed" to Valley Forge's liability. Thus, the language focuses on the outcome of the litigation, not on the initial allegations.
Our conclusion about the basic principle of the right to indemnity is consistent with the conclusions of jurisdictions addressing the accrual of indemnity under implied indemnity theories. For example, in Insurance Co. of North America v. King, 340 So.2d 1175 (Fla. Dist. Ct. App. 1976), a complaint alleged active negligence against an automobile dealer and an automobile manufacturer. At trial, judgment was entered against the defendants, but against the dealer solely for its passive negligence. The dealer succeeded in obtaining indemnification from the manufacturer against the judgment but was denied attorney's fees and costs. The manufacturer claimed the dealer was not entitled to the attorney's fees and costs because the plaintiffs alleged active negligence by the dealer. On appeal the appellate court held that the dealer was entitled to indemnification for these expenses.
We conclude that it is an indemnitee's actual wrongdoing or lack of it, rather than allegations of wrongdoing, which determine the indemnitee's rights. A plaintiff should not be able to arbitrarily deprive a defendant of his right to indemnification from a third party by alleging that he was actively negligent when in *254 fact the defendant is found not to have been actively negligent.
Id. at 1176.
The same conclusion was reached by the Nevada Supreme Court in an action for expenses incurred in defending a lawsuit by a distributor of a product against the manufacturer:
It does not require any legal ingenuity to draft a complaint charging someone with negligence, and no evidence is needed to support such an allegation. The right to indemnification for litigation expenses should not depend on the pleading choices of a third party, who through an excess of caution or optimism, may allege far more than he can prove at trial.
Piedmont Equipment Co. v. Eberhard Manufacturing Co., 99 Nev. 523, 528, 665 P.2d 256, 259-60 (1983) (citations omitted). See also Pullman Standard Inc. v. Abex Corp., 693 S.W.2d 336 (Tenn. 1985) (adopting rule of Insurance Company of North America v. King); Koch v. City of Seattle, 9 Wash. App. 580, 513 P.2d 573 (1973).
There is opposing authority for the proposition that the right of indemnity is controlled by a third party's complaint. E.g., Leingang v. Bottled Gas Corp., 332 F.2d 959, 962-63 (7th Cir.1964) (applying Iowa law); Lennon v. Aluminum Co. of America, 279 F. Supp. 487, 489 (S.D.Iowa 1968) (applying Iowa law); Rauch v. Senecal, 253 Iowa 487, 112 N.W.2d 886 (1962). The differing result is based on an "all-or-nothing" view of indemnity: if a party defended himself against an allegation of negligence, he is not entitled, even though his defense was successful, to indemnity from the party adjudged liable. The underlying reasoning appears to be that the non-liable party had to defend himself for his own benefit regardless of outcome, so it would be inequitable to make the party at fault responsible for the other party's expenses. See, e.g., Leingang v. Bottled Gas Corp.
The Iowa Supreme Court reconsidered the rule announced in Rauch v. Senecal. It held in Peters v. Lyons, 168 N.W.2d 759 (Iowa 1969) that the allegations of a third party do not control the right to recover attorney's fees under implied indemnity for a successfully defended suit. Whether an indemnitee may recover from the indemnitor
should not rest on the presence or absence of [pleading primary negligence] by a third party, who through an overabundance of caution or optimism alleges more (or less) than he can prove. The decision must be made on the facts as found by the trier thereof.
Id. at 770.
Under the "all-or-nothing" analysis, a candidate for possible indemnity loses the right even if the plaintiff's complaint against that defendant is groundless. We prefer the rule of Insurance Co. of North America v. King because it is based on actual rather than alleged fault, thus resting upon the substance of the issues and not upon unproven claims of a third party.
Valley Forge's argument is premised in part on analogizing its position to an insurer's duty to defend its insured. The duty to defend depends on the allegations of the plaintiff's complaint and on the facts known to the parties. See Kepner v. Western Fire Insurance Co., 109 Ariz. 329, 509 P.2d 222 (1973) and Western Casualty & Surety Co. v. International Spas, 130 Ariz. 76, 634 P.2d 3 (App. 1981)
The authorities on which Valley Forge relies for its argument that the complaint controls the right of indemnity are cases where the courts seem to equate the duty to defend with the duty to indemnify. Leingang v. Bottled Gas Corp.; Lennon v. Aluminum Company of America. St. Paul Fire & Marine Insurance Co. v. Crosetti Bros., 256 Or. 576, 475 P.2d 69 (1970). It is true that the obligation to indemnify may be satisfied either by defending the indemnitee or by paying the indemnitee's costs of defense if the claim is covered by the indemnity agreement. Northwestern Pacific Indemnity Co. v. Junction City Water Control District, 295 Or. 553, 556, 668 P.2d 1206, 1208, at n. 3 (1983), modified 296 Or. 365, 677 P.2d 671 (1984) (revoking directed verdict for plaintiff).
*255 The duty to defend, however, is not the same as the duty to indemnify. The duty to defend arises at the earliest stages of litigation and generally exists regardless of whether the insured is ultimately found liable. The duty to indemnify depends on whether the indemnitee engaged in actual, active wrongdoing. See Koch v. City of Seattle. The accrual of the obligation to provide a defense does not control the accrual of the obligation to indemnify.
We hold that allegations in Marks's complaint of independent wrongdoing by Strand do not control Strand's contractual right to indemnity. We must next resolve whether the matter is in the appropriate posture to determine INA's right to attorney's fees and costs.
First, we dispose of one of Valley Forge's sub-issues. Valley Forge asserts that the agency agreement provides indemnification only for damages and not for attorney's fees. Valley Forge's position is contrary to the general rule of indemnification:
[R]egardless of whether indemnity is based upon an implied or an express agreement, ... when a claim is made against an indemnitee for which he is entitled to indemnification, the indemnitor is liable for any reasonable expenses incurred by the indemnitee in defending against such claim, regardless of whether the indemnitee is ultimately held not liable.
St. Paul Fire and Marine Insurance Co. v. Crosetti Bros., 256 Or. at 579, 475 P.2d at 71.
Valley Forge's argument is also contrary to the indemnification provision which states that the agent, Strand, would be "held harmless." A party is not "held harmless" unless the indemnitor bears the indemnitee's costs of defending the third party's claim. Northwestern Pacific Indemnity Co. v. Junction City Water Control District, 296 Or. 365, 677 P.2d 671 (1984).
As to the main issue, we note that Strand was dismissed from the Marks lawsuit by stipulation. The dismissal by itself does not reveal whether any act by Strand in fact caused or contributed to any injury to Marks in connection with Valley Forge's performance. INA is entitled to indemnity if Strand's conduct was not such a cause of injury. The parties have not presented any evidence on this issue in these proceedings. An indemnitee must be proven to be free of negligence in order to receive indemnity either under a general indemnity agreement or under implied indemnity. Westinghouse Electric Corp. v. Dade County, 472 So.2d 866 (Fla. Dist. Ct. App. 1985) (contractual indemnity); Occidental Fire & Casualty Co. v. Stevenson, 370 So.2d 1211 (Fla. Dist. Ct. App. 1979) (implied indemnity); Piedmont Equipment Co. v. Eberhard Manufacturing Co. (implied indemnity). The burden is on the party seeking indemnity to prove he is entitled to it. Westinghouse Electric Corp. v. Dade County. Since no evidence was presented by either party on this issue this case must be remanded to determine whether any act by Strand contributed to Valley Forge's potential liability in the Marks lawsuit.
If it is determined that Strand was entitled to indemnification, INA may recover its attorneys fees and costs. INA's recovery of defense costs must be limited to the costs attributable to claims for which Strand was entitled to receive indemnity. If, for example, some of the costs are related to defending the claim that Strand failed to procure adequate insurance coverage, Strand and INA must bear those costs because the indemnification agreement would not apply to that act unless it somehow arose out of Valley Forge's performance. The fees will have to be apportioned according to the defenses relating to claims in the complaint covered by the agreement. An indemnitee under implied indemnity "may recover only those fees and expenses attributable to the making *256 of defenses which were not primarily directed toward rebutting charges of active negligence." Piedmont Equipment Co. v. Eberhard Manufacturing Co., 99 Nev. at 529, 665 P.2d at 260. Attorney fee apportionment is not new in Arizona. Chantler v. Wood, 6 Ariz. App. 134, 430 P.2d 713, supplemented 6 Ariz. App. 325, 432 P.2d 469 (1967) (in an action for deed reformation and to quiet title, successful party was entitled to award of attorney's fees to quiet title).
INA has asked for its attorney's fees on appeal because the matter arises from contract. Under general indemnity principles, INA would have no right to fees: the right of indemnity includes a right to attorney's fees incurred in defending the underlying claim, but does not include the right to fees incurred in establishing the right of indemnity. Vallejos v. C.E. Glass Co., 583 F.2d 507 (10th Cir.1978); Howard P. Foley Co. v. Employers-Commercial Union, 15 Ariz. App. 350, 488 P.2d 987 (1971); Tri-M Erectors, Inc. v. Donald M. Drake Co., 27 Wash. App. 529, 618 P.2d 1341 (1980). However, A.R.S. § 12-341.01 allows a court to award fees "[i]n any contested action arising out of contract" to "the successful party." Because appellee INA has prevailed on the question of law INA is a successful party entitled to attorney's fees under A.R.S. § 12-341.01, according to Wagenseller v. Scottsdale Memorial Hospital, 147 Ariz. 370, 710 P.2d 1025 (1985) as supplemented. INA is directed to comply with rule 21, Arizona Rules of Civil Appellate Procedure. See Schweiger v. China Doll Restaurant, Inc., 138 Ariz. 183, 673 P.2d 927 (App. 1983).
The judgment is affirmed but the case remanded for the reasons previously set forth and for a determination of apportionment of fees and costs as may be appropriate within the context of this opinion.
JACOBSON and SHELLEY, JJ., concur.
NOTES
[1]  The Restatement (Second) of Agency § 439 (1958), provides:

When Duty of Indemnity Exists
Unless otherwise agreed, a principal is subject to a duty to exonerate an agent who is not barred by the illegality of his conduct to indemnify him for:
* * * * * *
(d) expenses of defending actions by third persons brought because of the agent's authorized conduct, such actions being unfounded but not brought in bad faith....
Comment h amplifies the meaning of § 439:
An agent who has done an authorized act which brings him into contact with others, such as the making of a contract or the taking of possession of a chattel, is ordinarily entitled to indemnification for the expenses of a successful defense to actions brought by third persons acting under the mistaken belief that the agent's conduct was a breach of contract, a tort, or otherwise created liability to them.
[2]  Any doubt as to the meaning of this type of indemnification provision should be resolved in favor of the indemnitee, in keeping with the settled rule that contracts are construed against the draftsman, who has a superior bargaining position. Allison Steel Manufacturing Co. v. Superior Court, 22 Ariz. App. 76, 80, 523 P.2d 803, 807 (1974); Restatement (Second) of Contracts § 206 (1979)

A special indemnity rule to the contrary, construction in favor of the indemnitor, applies when a party claims indemnification for its own negligence, a common occurrence, for example, between general contractors and their subcontractors. In these cases, the rule in favor of the indemnitor (the subcontractor) also construes the contract against the draftsman, because the party seeking indemnification for its own negligence is the general contractor who drafted the contract. E.g., Allison Steel Manufacturing Co. v. Superior Court. See generally Annot., 68 ALR 3d 7 (1976).
