I concur in part and dissent in part. I agree with the reversal of the order denying defendant’s motion to strike $9,147 in costs. I disagree, however, with the reversal of the order denying plaintiffs’ motion for attorney fees. In my view, the breaching tenants who, without justification, had withheld rent for a year, may not enforce a contractual attorney fee clause against a landlord whose breach of *932the implied warranty of habitability caused the tenants to suffer property damage in an electrical fire. The landlord’s breach did not, in this specific case, extinguish the tenants’ duty to pay the back rent accrued during the year before the fire.1
The majority cite an unlawful detainer case, Green v. Superior Court, supra, 10 Cal.3d at page 619, for the proposition that there is “a common law implied warranty of habitability in residential leases in California . . . .’’In general, I agree that a residential tenant who defeats an unlawful detainer action by asserting the landlord’s breach of the implied covenant of habitability may, in addition to remaining in possession of the premises, recover attorney fees under the lease agreement, provided the landlord’s breach has canceled the obligation to pay rent. “[A] landlord’s breach of a warranty of habitability directly relates to whether any rent is ‘due and owing’ by the tenant; hence such breach may be determinative of whether the landlord or tenant is entitled to possession of the premises upon nonpayment of rent. Accordingly, the tenant may properly raise the issue of warranty of habitability in an unlawful detainer action.” (Green v. Superior Court, supra, 10 Cal.3d at p. 620.) “If the tenant can prove such a breach by the landlord, he may demonstrate that his nonpayment of rent was justified and that no rent is in fact ‘due and owing’ to the landlord.” (Green v. Superior Court, supra, 10 Cal.3d at p. 635.)
The degree to which the landlord’s breach of the implied warranty of habitability provides a defense to an unlawful detainer action depends entirely upon the extent of the damages caused by the landlord’s breach. If *933the “landlord’s breach of warranty is total, [such] that the tenant owes no rent whatsoever, the court should, of course, enter judgment for the tenant in the unlawful detainer action.” (Green v. Superior Court, supra, 10 Cal.3d at p. 639.) On the other hand, “if the trial court finds that the landlord has not breached the warranty of habitability, it should immediately enter judgment in favor of the landlord.” (Ibid.) Where the landlord’s breach falls somewhere in between, such that the damages do not exceed the fair rental value, the trial court will assess the amount of rent owed: “If the court determines . . . that the damages from the breach of warranty justify only a partial reduction in rent, the tenant may maintain possession of the premises only if he pays that portion of the back rent that is owing, as directed by the trial court. [Citations.] If the tenant fails to pay such sum, the landlord is entitled to a judgment for possession.” (Ibid.)
If the landlord’s breach is total, such that the tenant’s nonpayment of rent is excused, I believe the tenant may enforce the attorney fee clause because the tenant has not breached the lease agreement. (See Greenwald & Asimow, Cal. Practice Guide: Cal. Real Property Transactions (The Rutter Group 2000) ¶ 11:55, pp. 11-10.1 to 11-10.2 [“A party’s legally excused or justified failure to perform a material covenant of a contract is not a breach of contract and thus does not give the other party any affirmative cause of action.” (Italics omitted.)].) That is not the case here, however. In this case, the trial court found the tenants owed $12,000 in back rent, a finding that is undisputed on appeal. Accordingly, the tenants were conclusively found to be in breach of a material term of the lease agreement.
The only reasonable inference to be drawn from the award of back rent in this case is that the tenants’ failure to pay rent was not related to or excused by any defect in the condition of the premises. Had the condition of the premises been so poor as to justify nonpayment or a reduction of rent, the trial court would not have awarded the landlord $12,000 in back rent.2 Based on the award of back rent, I would infer the tenants’ damages flowing from *934the landlord’s breach of the implied warranty of habitability first occurred when the fire destroyed their personal property, and not earlier.
Under standard contract law principles, a party who has breached a contract without justification or excuse may not enforce the contract. “To state a cause of action for breach of contract, [a party] must plead the contract, his performance of the contract or excuse for nonperformance, [the other party’s] breach and the resulting damage.” (Otworth v. Southern Pac. Transportation Co. (1985) 166 Cal.App.3d 452, 458 [212 Cal.Rptr. 743].)
Although the tenants have proven their damages resulting from a breach of the implied warranty of habitability, they have failed to prove either their own performance (payment of rent) or excuse for nonperformance. We are bound by the finding, implicit in the award of $12,000 back rent, that the tenants’ nonpayment of rent was unjustified. The tenants, having breached the contract without justification, may not enforce the attorney fee clause. (See Otworth v. Southern Pac. Transportation Co., supra, 166 Cal.App.3d at p. 458.) This is not a case where the tenants’ nonpayment of rent was justified by the uninhabitable condition of the premises.
Enforcing the attorney fees clause under these facts would only serve to warn other landlords not to tolerate a nonpayment of rent and to file unlawful detainer actions immediately, in every instance. Any rational landlord will do so as a matter of self-protection. If by enforcing the attorney fee clause despite the tenants’ unjustified material breach of contract, the majority seek to further the public policy of requiring landlords to maintain habitable dwellings, it is not necessary to punish this landlord to accomplish that goal. The law already protects holdover tenants by requiring landlords to maintain the premises in a habitable condition, despite the tenants’ unjustified nonpayment of rent. (Civ. Code, § 1941 [“The lessor of a building intended for the occupation of human beings must, in the absence of an *935agreement to the contrary, put it into a condition fit for such occupation, and repair all subsequent dilapidations thereof, which render it untenantable, except such as are mentioned in section nineteen hundred and twenty-nine.”].) Accordingly, although nonpayment of rent is a material breach that gives rise to a summary action for recovery of possession and back rent, it does not excuse the landlord from maintaining a habitable dwelling during the holdover period.
The fact that a landlord must maintain the premises in a habitable condition during the holdover period does not mean, however, that the attorney fee clause is suddenly resurrected if the landlord later breaches the implied warranty of habitability. The contractual obligation to pay attorney fees is not the same as the implied obligation to maintain a habitable dwelling. I know of no legal authority to support the proposition that a tenant’s unjustified nonpayment of rent will be eradicated by the landlord’s subsequent failure to maintain the premises during the holdover period, such that the tenant may enforce the attorney fee clause against the landlord as though the tenant had not materially breached the contract. In my view, when a tenant’s nonpayment of rent is unjustified, his remedies for the landlord’s failure to maintain the premises should be no greater than the remedies available under a lease that does not contain an attorney fee clause. A nonbreaching tenant with no such clause in the lease is on his own in retaining counsel to sue for breach of the habitability covenant.3 Under the majority view, a breaching tenant who is lucky enough to have such a clause gets to have the landlord fund the tenant’s lawsuit.
As a matter of public policy, a tenant can always enforce the habitability covenant. But I would not let a breaching landlord or tenant recover attorney fees.
In this case, the tenants’ net monetary recovery made them, in the trial court’s view, the prevailing party under Civil Code section 1717, a finding which the landlord does not dispute on appeal. On this record, however, the trial court should have refused to confer prevailing party status upon either party, given that the tenants’ nonpayment of rent was independent of, and not excused by, the landlord’s breach.
I agree with the majority that the trial court’s stated reasons for denying attorney fees were wrong. Attorney fees nevertheless were properly denied *936because the tenants were in breach due to their unjustified nonpayment of rent. On that basis, I would affirm the order denying fees.
I recognize the trial court’s finding that the landlord had kept the “electrical system in a state of proven disrepair” appears possibly inconsistent with a determination that the home was habitable before the fire. (See Civ. Code, § 1941.1, subd. (e) [a dwelling is untenantable if the electrical wiring is not maintained in good working order].) The issue is one of degree: Was the electrical wiring in such disrepair that the nonpayment of rent was justified? (See Green v. Superior Court (1974) 10 Cal.3d 616, 635 [111 Cal.Rptr. 704, 517 P.2d 1168].)
I can only infer from the trial court’s award of $12,000 in back rent that the electrical wiring, before the fire, had caused no damages and did not justify the nonpayment of rent. “The principles of review which must guide us are elementary. ... [A] ‘reviewing court is without power to substitute its deductions for those of the trial court.’ . . . [‘]“In brief, the appellate court ordinarily looks only at the evidence supporting the successful party, and disregards the contrary showing.” [Citation.] All conflicts, therefore, must be resolved in favor of the respondent.’ [. . . Citation.]” (Campbell v. Southern Pacific Co. (1978) 22 Cal.3d 51, 60 [148 Cal.Rptr. 596, 583 P.2d 121].) “All presumptions are in favor of the judgment. Trial judges and juries are the exclusive judges of credibility and may disbelieve any witness. Trial courts are designed and responsible for determining facts. Appellate courts are designed to review errors of law. Economy, efficiency, and practicality require recognition of those specialized roles.” (Rivard v. Board of Pension Commisioners (1985) 164 Cal.App.3d 405, 412 [210 Cal.Rptr. 509].)
The trial court arrived at the $12,000 figure by “compromising] the amorphous sums testified to on both sides to $12,000—e[.]g. $6,000 admitted arrearage and half the $12,000 difference between $18,000 and $6,000 and determining] defendant is entitled to $12,000 credit for unpaid rental.” The trial court said nothing about reducing the amount of back rent to compensate for any damages caused by the breach of the implied warranty of habitability. Accordingly, I infer the calculation of back rent had nothing to do with the condition of the premises before the fire.
In the earlier appeal, we noted the difficulty the trial court had in determining causation. We quoted the following from the statement of decision: “ ‘No one was able with reasonable certainty to pinpoint the precise location and cause of the fire which caused the damage. After review of the so called expert testimony (viewed askance from both sides by the court for reasons expressed at the time of oral argument) the court is left unenlightened by the partisan *934bias of each side’s witnesses and must infer from the circumstantial evidence that the fire started at or in the electric panel/lead in/(now contraband) aluminum wire(s) at or near the electric panel. The court does acknowledge both sides]’] ‘fire expert’s’ acknowledgement that the location of the start of the fire was in the comer of the garage in the vicinity of the elect[r]ic panel. The testimony on causation by both sides was found implausible and unreliable and has not been relied upon, therefore, by the court, as to causation and as to what made the fire break out, in the first place. The court concludes the fire was electrical in origin.’ ” (Fairchild v. Park (Apr. 17, 2000, B131806) [nonpub. opn.].)
Given the trial court’s great difficulty in determining the cause of the fire, the trial court evidently did not believe a sufficient basis existed to reduce the amount of back rent owed to compensate for damages caused by a failure to maintain the premises before the fire. The trial court made no finding that any damages were caused by the failure to maintain the premises other than the personal property lost in the fire itself.
A tenant may recover attorney fees by statute under the conditions set forth in Civil Code section 1942.4, which do not apply here. One requirement of Civil Code section 1942.4 is that a government official must have given the landlord written notice of the substandard condition, which did not occur in this case.