
    [S.F. No. 22993.
    In Bank.
    Jan. 15, 1974.]
    ROGER GREEN, Petitioner, v. THE SUPERIOR COURT OF THE CITY AND COUNTY OF SAN FRANCISCO, Respondent; JACK SUMSKI, Real Party in Interest.
    
      Counsel
    Gilbert T. Graham and Lawrence L. Curtice for Petitioner.
    Allan David Heskin, Myron Moskovitz and Rosalyn M. Chapman as Amici Curiae on behalf of Petitioner.
    No appearance for Respondent or for Real Party in Interest.
   Opinion

TOBRINER, J.

Under traditional common law doctrine, long followed in California, a landlord was under no duty to maintain leased dwellings in habitable condition during the. term of the lease. In the past several years, however, the highest courts of a rapidly growing number of states and the District of Columbia have reexamined the bases of the old common law rule and have uniformly determined that it no longer corresponds to the realities of the modern urban landlord-tenant relationship. Accordingly, each of these jurisdictions has discarded the old common law rule and has adopted an implied warranty of habitability for residential leases. In June 1972, the California Court of Appeal reviewed this emerging out-of-state precedent in the case of Hinson v. Delis (1972) 26 Cal.App.3d 62 [102 Cal.Rptr. 661], and, persuaded by the reasoning of these decisions, held that a warranty of habitability is implied by law in residential leases in California. We granted a hearing in the instant case, and a companion case, to consider the Hinson decision and to determine whether the breach of such implied warranty may be raised as a defense by a tenant in an unlawful detainer action.

For the reasons discussed below, we have determined that the Hinson court properly recognized a common law implied warranty of habitability in residential leases in California, and we conclude that the breach of such warranty may be raised as a defense in an unlawful detainer action.

First, as the recent line of out-of-state cases comprehensively demonstrate, the factual and legal premises underlying the original common law rule in this area have long ceased to exist; continued adherence to the time-worn doctrine conflicts with the expectations and demands of the contemporary landlord-tenant relationship and with modern legal principles in analogous fields. To remain viable, the common law must reflect the realities of present day society; an implied warranty of habitability in residential leases must therefore be recognized.

Second, we shall point out that the statutory “repair and deduct” provisions of Civil Code section 1941 et seq. do not preclude this development in the common law, for such enactments were never intended to be the exclusive remedy for tenants but have always been viewed as complementary to existing common law rights.

Finally, we have concluded that a landlord’s breach of this warranty of habitability may be raised as a defense in an unlawful detainer action. Past California cases have established that a defendant in an unlawful detainer action may raise any affirmative defense which, if established, will preserve the tenant’s possession of the premises. As we shall explain, 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.

1. The facts of the instant case.

We begin with a brief review of the facts of the instant case, which reveal a somewhat typical unlawful detainer action. On September 27, 1972, the landlord Jack Sumski commenced an unlawful detainer action in the San Francisco Small Claims Court seeking possession of the leased premises and $300 in back rent. The tenant admitted nonpayment of rent but defended the action on the ground that the landlord had failed to maintain the leased premises in a habitable condition. The small claims court awarded possession of the premises , to the landlord and entered a money judgment for $225 against the tenant.

The tenant then appealed the decision to the San Francisco Superior Court, where a de novo trial was held pursuant to section 117j of the Code of Civil Procedure. In support of his claim of uninhabitability, the tenant submitted a copy of an October 1972 inspection report of the San Francisco Department of Public Works disclosing some 80 housing code violations in the building in question, as well as an order of the department scheduling a condemnation hearing for January 19, 1973. In addition, in testimony at trial, petitioner and his roommate detailed a long list of serious defects in the leased premises which had not been repaired by the landlord after notice and which they claimed rendered the premises uninhabitable. Some of the more serious defects described by the tenants included (1) the collapse and nonrepair of the bathroom ceiling, (2) the continued presence of rats, mice, and cockroaches on the premises, (3) the lack of any heat in four of the apartment’s rooms, (4) plumbing blockages, (5) exposed and faulty wiring, and (6) an illegally installed and dangerous stove. The landlord apparently did not attempt to contest the presence of serious defects in the leased premises, but instead claimed that such defects afforded the tenant no defense in an unlawful detainer action.

The superior court judge ultimately agreed with the landlord’s contention, holding that the “repair and deduct” provisions of Civil Code section 1941 et seq. constituted the tenant’s exclusive remedy under these circumstances. Accordingly, the superior court entered judgment for the landlord, awarding him $225 and possession of the premises.

The tenant thereafter sought certification and transfer of the case to the Court of Appeal (see Cal. Rules of Court, rules 62, 63), but the superior court denied the request. The tenant then sought a writ of mandate or prohibition from the Court of Appeal, contending that the trial court had erroneously failed to follow the Hinson decision. The Court of Appeal denied the writ summarily; the tenant thereafter sought a hearing in this court. Because of the statewide importance of the general issues presented (cf. Treber v. Superior Court (1968) 68 Cal.2d 128, 131 [65 Cal.Rptr. 330, 436 P.2d 330]; Brown v. Superior Court (1971) 5 Cal.3d 509, 515 [96 Cal.Rptr. 584, 487 P.2d 1224]), we exercised our discretion and issued an alternative writ of mandate, staying the execution of judgment conditioned upon the tenant’s payment into court of all rent which had accrued since the superior court judgment and all future rent as it became due. We now turn to the general legal issues presented.

2. The transformation of the landlord-tenant relationship and developments in analogous areas of law compel the recognition of a common law implied warranty of habitability in residential leases in California.

At common law, the real estate lease developed in the field of real property law, not contract law. .Under property law concepts, a lease was considered a conveyance or sale of the premises for a term of years, subject to the ancient doctrine of caveat emptor. Thus, under traditional common law rules, the landlord owed no duty to place leased premises in a habitable condition and no obligation to repair the premises. (3 Holdsworth, A History of English Law (5th ed. 1966) pp. 122-123; see, e.g., Brewster v. DeFremery (1867) 33 Cal. 341, 345-346.) These original common law precepts perhaps suited the agrarianism of the early Middle Ages which was their matrix; at such time, the primary value of a lease lay in the land itself and whatever simple living structures may have been included in the leasehold were of secondary importance and were readily repairable by the typical “jack-of-all-trades” lessee farmer. Furthermore; because the law of property crystallized before the development of mutually dependent covenants in contract law, a lessee’s covenant to pay rent was considered at common law as independent of the lessor’s covenants. Thus even when a lessor expressly covenanted to make repairs, the lessor’s breach did not justify the lessee’s withholding of the rent. (See 6 Williston, Contracts (3d ed. 1962) § 890, pp. 580-589; Arnold v. Krigbaum (1915) 169 Cal. 143, 145 [146 P. 423].)

In recent years, however, a growing number of courts have begun to re-examine these “settled”- common law rules in light of contemporary conditions, and, after thorough analysis, all of these courts have discarded the traditional doctrine as incompatible with contemporary social conditions and modern legal values. This emerging line of decisions, along with a veritable flood of academic commentaries, demonstrates the obsolescence of the traditional common law rule absolving a landlord of any duty to maintain leased premises in a habitable condition during the term of the lease.

The recent decisions recognize initially that the geographic and economic conditions that characterized the agrarian lessor-lessee transaction have been entirely transformed in the modern urban landlord-tenant relationship. We have suggested that in the Middle Ages, and, indeed, until the urbanization of the industrial revolution, the land itself was by far the most important element of a lease transaction; this predominance explained the law’s treatment of such leases as conveyances of interests in land. In today’s urban residential leases, however, land as such plays no comparable role. The typical city dweller, who frequently leases an apartment several stories above the actual plot of land on which an apartment building rests, cannot realistically be viewed as acquiring an interest in land; rather, he has contracted for a place to live. As the Court of Appeal for the District of Columbia observed in Javins v. First National Realty Corporation (1970) 428 F.2d 1071, 1074 [138 App.D.C. 369]: “When American city dwellers, both rich and poor, seek ‘shelter’ today, they seek a well known package of goods and services—a package which includes not merely walls and ceilings, but also adequate heat, light and ventilation, serviceable plumbing facilities, secure windows and doors, proper sanitation, and proper maintenance.” (Fn. omitted.)

In the past, California courts have increasingly recognized the largely contractual nature of contemporary lease agreements and have frequently analyzed such leases’ terms pursuant to contractual principles. (See, e.g., Medico-Dental etc. Co. v. Horton & Converse (1942) 21 Cal.2d 411, 418-419 [132 P.2d 457]; Groh v. Kover’s Bull Pen, Inc. (1963) 221 Cal.App.2d 611 [34 Cal.Rptr. 637], See generally Note, The California Lease-Contract or Conveyance? (1952) 4 Stan.L.Rev. 244.) Similarly, leading legal scholars in the field have long stressed the propriety of a more contractually oriented analysis of lease agreements. (1 American Law of Property (Casner ed. 1952) § 3.11, pp. 202-205; 2 Powell, Real Property (rev. ed. 1967) 1f 221 [1], p. 179; 6 Williston, Contracts (3d ed. 1962) § 890A, pp. 592-613.) Our holding in this case reflects our belief that the application of contract principles, including the mutual dependency of covenants, is particularly appropriate in dealing with residential leases of urban dwelling units.

Modern urbanization has not only undermined the validity of utilizing general property concepts in analyzing landlord-tenant relations, but it has also significantly altered the factual setting directly relevant to the more specific duty of maintaining leased premises. As noted above, at the inception of the common law rule, any structure on the leased premises was likely to be of the most simple nature, easily inspected by the lessee to determine if it fit his needs, and easily repairable by the typically versatile tenant farmer. Contemporary urban housing and the contemporary urban tenant stand in marked contrast to this agrarian model.

First, the increasing complexity of modern apartment buildings not only renders them much more difficult and expensive to repair than the living quarters of earlier days, but also makes adequate inspection of the premises by a prospective tenant a virtual impossibility; complex heating, electrical and plumbing systems are hidden from view, and the landlord, who has had experience with the building, is certainly in a much better position to discover and to cure dilapidations in the premises. Moreover, in a multiple-unit dwelling repair will frequently require access to equipment and areas solely in the control of the landlord.

Second, unlike the multi-skilled lessee of old, today’s city dweller generally has a single, specialized skill unrelated to maintenance work. Furthermore, whereas an agrarian lessee frequently remained on a single plot of land for his entire fife, today’s urban tenant is more mobile than ever; a tenant’s limited tenure in a specific apartment will frequently not justify efforts at extensive repairs. Finally, the expense of needed repairs will often be outside the reach of many tenants for “[l]ow and middle income tenants, even if they were interested in making repairs, would be unable to obtain any financing for major repairs since they have no long-term interest in the property.” (Javins v. First National Realty Corporation (1970) 428 F.2d 1071, 1078-1079 [138 App.D.C. 369].)

In addition to these significant changes, urbanization and population growth have wrought an enormous transformation in the contemporary housing market, creating a scarcity of adequate low cost housing in virtually every urban setting. This current state of the housing market is by no means unrelated to the common law duty to maintain habitable premises. For one thing, the severe shortage of low and moderate cost housing has left tenants with little bargaining power through which they might gain express warranties of habitability from landlords, and thus the mechanism of the “free market” no longer serves as a viable means for fairly allocating the duty to repair leased premises between landlord and tenant. For another, the scarcity of adequate housing has limited further the adequacy of the tenant’s right to inspect the premises; .even when defects are apparent the low income tenant frequently has no realistic alternative but to accept such housing with the expectation that the landlord will make the necessary repairs. Finally, the shortage of available low cost housing has rendered inadequate the few remedies that common law courts previously have developed to ameliorate the harsh consequences of the traditional “no duty to repair” rule.

These enormous factual changes in the landlord-tenant field have been paralleled by equally dramatic changes in the prevailing legal doctrines governing commerical transactions. Whereas the traditional common law “no duty to maintain or repair” rule was steeped in the caveat emptor ethic of an earlier commercial era (see, e.g., Nelson v. Meyers (1928) 94 Cal.App. 66, 75-76 [270 P. 719]), modern legal decisions have recognized that the consumer in an industrial society should be entitled to rely on the skill of the supplier to assure that goods and services are of adequate quality. In seeking to protect the reasonable expectations of consumers, judicial decisions, discarding the caveat emptor approach, have for some time implied a warranty of fitness and merchantability in the case of the sale of goods. (See Klein v. Duchess Sandwich Co., Ltd. (1939) 14 Cal.2d 272, 276-283 [93 P.2d 799]; Escola v. Coca Cola Bottling Co. (1944) 24 Cal.2d 453, 461-468 [150 P.2d 436] (Traynor, J., concurring.)Peterson v. Lamb Rubber Co. (1960) 54 Cal.2d 339, 341-348 [5 Cal. Rptr. 863, 353 P.2d 575]. See generally Jaeger, Warranties of Merchantability and Fitness for Use (1962) 16 Rutgers L.Rev. 493.) In recent years, moreover, California courts have increasingly recognized the applicability of this implied warranty theory to real estate transactions; prior cases have found a warranty of fitness implied by law with respect to the construction of new housing units. (See Aced v. Hobbs-Sesack Plumbing Co. (1961) 55 Cal.2d 573, 582-583 [12 Cal.Rptr. 257, 360 P.2d 897]; cf. Kriegler v. Eichler Homes, Inc. (1969) 269 Cal.App.2d 224, 227-229 [74 Cal.Rptr. 749]; Avner v. Longridge Estates (1969) 272 Cal.App.2d 607, 609-615 [77 Cal.Rptr. 633].)

In most significant respects, the modem urban tenant is in the same position as any other normal consumer of goods. (See Note, The Tenant as Consumer (1971) 3 U.C. Davis L.Rev. 59.) Through a residential lease, a tenant seeks to purchase “housing” from his landlord for a specified period of time. The landlord “sells” housing, enjoying a much greater opportunity, incentive and capacity than a tenant to inspect and maintain the condition of his apartment building. A tenant may reasonably expect that the product he is purchasing is fit for the purpose for which it is obtained, that is, a living unit. Moreover, since a lease contract specifies a designated period of time during which the tenant has a right to inhabit the premises, the tenant may legitimately expect that the premises will be fit for such habitation for the duration of the term of the lease. It is just such reasonable expectations of consumers which the modern “implied warranty” decisions endow with formal, legal protection. (Cf. Gray v. Zurich Insurance Co. (1966) 65 Cal.2d 263, 269-271 [54 Cal.Rptr. 104, 419 P.2d 168]. See generally Leff, Contract as a Thing (1970) 19 Am. U.L. Rev. 131.)

Finally, an additional legal development casts significant light upon the continued vitality of the traditional common law rule. The past half century has brought the widespread enactment of comprehensive housing codes throughout the nation; in California, the Department of Housing and Community Development has established detailed, statewide housing regulations (see Health & Saf. Code, § 17921; Cal. Admin. Code, tit. 25, §§ 1000-1090), and the Legislature has expressly authorized local entities to impose even more stringent regulations. (See Health & Saf. Code, § 17951.) These comprehensive housing codes affirm that, under contemporary conditions, public policy compels landlords to bear the primary responsibility for maintaining safe, clean and habitable housing in our state. As the Supreme Court of Wisconsin declared with respect to that state’s housing code: “[T]he legislature has made a policy judgment—that it is socially (and politically) desirable to impose these duties on a property owner—which has rendered the old common law rule obsolete. To follow the old rule of no implied warranty of habitability in leases would, in our opinion, be inconsistent with the current legislative policy concerning housing standards.” (Pines v. Perssion (1961) 14 Wis.2d 590, 596 [111 N.W.2d 409, 412-413]; see Buckner v. Azulai (1967) 251 Cal.App.2d Supp. 1013, 1015 [59 Cal. Rptr. 806, 27 A.L.R.3d 920].)

Unquestionably these numerous factual and legal developments have completely eroded the foundations of the traditional common law rule. As noted earlier, the highest courts of seven of our sister states and the Circuit Court of Appeals for the District of Columbia have discarded the traditional common law doctrine, and have explicitly recognized an implied warranty of habitability in residential leases. The Supreme Court of Wisconsin was the first to adopt this approach in 1961, and since 1969 the Supreme Courts of Hawaii, New Jersey, New Hampshire, Illinois, Iowa, and Massachusetts and the Circuit Court of Appeals for the District of Columbia have followed this lead.

The Court of Appeal decision in Hinson v. Delis (1972) 26 Cal.App.3d 62 [102 Cal.Rptr. 661], was decided in the wake of this rapidly burgeoning, uniform trend of out-of-state decisions. In Hinson, after a landlord had refused to repair a number of defects that had developed in the tenant’s apartment—including a rotting bathroom floor, a defective toilet and an improperly fitting, drafty front door—the tenant withheld over two months rent, $200, and requested an inspection of the premises by a local housing inspector. The inspection confirmed the existence of a number of substantial housing code violations, and when the landlord received an official letter from the inspector he finally made the needed repairs. The landlord then demanded that the tenant pay the $200 that had been withheld, but, although the tenant ultimately agreed to resume paying her full rent as of the date of the completion of repairs, she continued to insist that she did not owe the full rent for the period when the premises had been in an unfit condition.

The tenant filed a declaratory judgment action seeking a declaration that her obligation to pay full rent was dependent upon the landlord’s compliance “with his duty to substantially obey the housing codes and make the premises habitable,” and also seeking to enjoin the landlord from evicting her during the pendency of the action. The landlord agreed not to evict the plaintiff during the court proceedings, but the trial court concluded that although the landlord had violated several housing code regulations, the plaintiff had no legal or equitable right to unilaterally withhold rent. Accordingly, the trial court entered a declaratory judgment that the tenant owed the landlord the full back rent.

The Court of Appeal, however, relying heavily on the line of out-of-state decisions cited above, reversed the trial court’s judgment and held that a warranty of habitability was implied by law in the tenant’s lease, and that a landlord’s breach of such warranty could justify a tenant’s refusal to pay the full amount of the rent. The Hinson court emphasized, however, that “the tenant is not absolved from all liability for rent, but remains liable for the reasonable rental value of the premises, as determined by the trial court, for such time as the premises were in violation of the housing codes.” (26 Cal.App.3d at p. 70.) The court therefore remanded the case to the trial court to determine to what extent, if any, the landlord’s alleged breach of an implied warranty of habitability excused the tenant’s rental obligation.

For the reasons discussed at length above, we believe that the traditional common law rule has outlived its usefulness; we agree with the Hinson court’s determination that modem conditions compel the recognition of a common law implied warranty of habitability in residential leases.

3. The “repair and deduct’ remedy of section 1941 et seq. of the Civil Code was not intended as the exclusive remedy for tenants in this field and does not preclude the recognition of a common law warranty of habitability.

The landlord in the present case suggests, however, that sections 1941 through 1942.1 of the Civil Code foreclose this court from adopting a common law implied waranty of habitability. In general, these sections place a statutory duty of maintenance and repair upon lessors of residential property and authorize a tenant, after giving reasonable notice of “dilapidations” to his landlord, either to quit the premises without further liability for rent or to repair the dilapidations himself and to deduct the cost of such repairs—up to one month’s rent—from his rent. A 1970 amendment to section 1942 prohibits a tenant from using the “repair and deduct” option more often than “once in any 12-month period.” The landlord argues that the remedies provided the tenant in section 1942 were intended as the exclusive remedies for any failure of the landlord in his duty to repair. As noted earlier, the trial court in the instant case accepted the landlord’s contention on this point, but we do not agree.

Although past cases have held that the Legislature intended the remedies afforded by section 1942 to be the sole procedure for enforcing the statutory duty on landlords imposed by section 1941 (see, e.g., Van Every v. Ogg (1881) 59 Cal. 563, 566; Sieber v. Blanc (1888) 76 Cal. 173, 174 [18 P. 260]), no decision has suggested that the Legislature designed these statutory provisions to displace the common law in fixing the respective rights of landlord and tenant. On the contrary, the statutory remedies of section 1942 have traditionally been viewed as additional to, and complementary of, the tenant’s common law rights.

In the century since the statutes were first enacted, for example, California courts have evolved the “constructive eviction” doctrine as a common law remedy completely independent of this statutory framework; under the modern constructive eviction decisions, a tenant’s right to terminate his lease has not been measured by the standards of sections 1941 or 1942, but by the developing standard that permits abandonment whenever a landlord’s “acts or omissions [render the premises] unfit for the purposes for which they were leased.” (Groh v. Kover’s Bull Pen, Inc. (1963) 221 Cal.App.2d 611, 614 [34 Cal.Rptr. 637]; Giraud v. Milovich (1938) 29 Cal.App.2d 543, 547 [85 P.2d 182].) Moreover, courts have permitted a tenant to utilize this common law constructive eviction doctrine, even when the tenant had apparently waived his rights under sections 1941 and 1942. (See Buckner v. Azulai (1967) 251 Cal.App.2d Supp. 1013, 1015 [59 Cal.Rptr. 806, 27 A.L.R.3d 920]; cf. Barkett v. Brucato (1953) 122 Cal.App. 2d 264 [264 P.2d 978]. See generally, Note, Partial Constructive Eviction: The Common Law Answer in the Tenant’s Struggle for Habitability (1970) 21 Hastings L.J. 417, 426.) These cases illustrate that the statutory framework of section 1941 et seq. has never been viewed as a curtailment of the growth of the common law in this field.

Furthermore, the limited nature of the “repair and deduct” remedy, in itself, suggests that it was not designed to serve as an exclusive remedy for tenants in this area. As noted above, section 1942 only permits a tenant to expend up to one month’s rent in making repairs, and now also provides that this self-help remedy can be invoked only once in any 12-month period. These limitations demonstrate that the Legislature framed the section only to encompass relatively minor dilapidations in leased premises. (See Nelson v. Myers (1928) 94 Cal.App. 66, 75 [270 P. 719]; Loeb, The Low-Income Tenant in California: A Study in Frustration (1970) 21 Hastings L.J. 287, 292.) As the facts of the instant case reveal, in the most serious instances of deterioration, when the costs of repair are at all significant, section 1942 does not provide, and could not have been designed as, a viable solution.

Thus, we conclude that Civil Code section 1941 et seq. do not preclude the development of new common law principles in this area, and we now hold that a warranty of habitability is implied by law in residential leases in California.

4. A tenant may raise a landlord’s breach of an implied warranty of habitability as a defense in an unlawful detainer proceeding.

The landlord in a companion case (see fn. 2) contends, however, that even if we should uphold such a warranty, we could never permit a tenant to raise a landlord’s breach of it in an unlawful detainer action. Relying initially on the fact that the Hinson decision itself involved a declaratory judgment action and not an unlawful detainer action, the landlord maintains that the trial court’s refusal to permit the defense of a “warranty of habitability” in the instant case fully conforms with Hinson. We cannot agree.

In the first place, nothing in the Hinson decision supports such a distinction. Although the issue in Hinson arose in a declaratory judgment context, as we discuss below the decision itself endorses procedural protections which were specifically designed for unlawful detainer proceedings. (See infra, at pp. 636-637.) Moreover, a number of the out-of-state decisions on which the Hinson court based its opinion explicitly applied this warranty of habitability doctrine in an unlawful detainer context. (See Marini v. Ireland (1970) 56 N.J. 130 [265 A.2d 526, 40 A.L.R.3d 1356]; Javins v. First National Realty Corporation (1970) 428 F.2d 1071 [138 App. D.C. 369]; see also Jack Spring, Inc. v. Little (1972) 50 Ill.2d 351 [280 N.E.2d 208]; Rome v. Walker (1972) 38 Mich.App. 458 [196 N.W.2d 850].)

Second, and more fundamentally, we have concluded that even apart from the Hinson decision, no legal doctrine bars a tenant from raising such a critical defense in an unlawful detainer action. We note initially that absolutely nothing in the statutory provisions governing unlawful detainer proceedings prohibits the assertion of any defense.

The landlord contends, however, that to preserve the summary nature of the procedure, California courts have in the past limited the matters which may be raised by a defendant in an unlawful detainer action, and that these judicially created limits foreclose the tenant from utilizing a breach of warranty defense.

The doctrine invoked by the landlord was most recently analyzed by our court in Knowles v. Robinson (1963) 60 Cal.2d 620, 625 [36 Cal.Rptr. 33, 387 P.2d 833]. In Knowles we explained: “[W]here an objection is interposed in an action for unlawful detainer, no cross-complaint or counterclaim may survive. The remedy of unlawful detainer is designed to provide means by which the timely possession of premises which are wrongfully withheld may be secured to the person entitled thereto. The summary character of the action would be defeated if, by cross-complaint or counterclaim, issues irrelevant to the right of immediate possession could be introduced.” (Italics added.) The court in Lakeside Park Assn. v. Keithly (1941) 43 Cal.App.2d 418, 422 [110 P.2d 1055], similarly observed that: “The reason for this rule is that the statute provides for the action of unlawful detainer as a summary proceeding, . . . and that the infecting of other issues extrinsic to the right of possession may defeat the very purpose of the statute.” (Italics added.)

The basic teaching of Knowles, Lakeside, and the entire line of cases these decisions reflect, is that a defense normally permitted because it “arises out of the subject matter” of the original suit is generally excluded in an unlawful detainer action if such defense is extrinsic to the narrow issue of possession, which the unlawful detainer procedure seeks speedily to resolve. Neither Knowles, Lakeside nor any other California decision, however, prohibits a tenant from interposing a defense which does directly relate to the issue of possession and'which, if established, would result in the tenant’s retention of the premises. The thrust of the Knowles’ line of cases is basically to prevent tenants from frustrating the summary statutory remedy through introduction of extraneous matter; the decisions accomplish this objective by confining the unlawful detainer action to issues directly relevant to the ultimate question of possession.

The crucial issue in this case thus becomes whether a landlord’s breach of a warranty of habitability directly relates to the issue of possession. Holding that such breach was irrelevant to the question of possession, early California cases refused to permit a defense that the landlord had breached a covenant to repair premises. (See, e.g., Arnold v. Krigbaum (1915) 169 Cal. 143, 145 [146 P. 423]; Frasier v. Witt (1923) 62 Cal.App. 309, 315 [217 P. 114].) These decisions, however, rested primarily upon the ancient property doctrine of “independent covenants,” under which a tenant’s obligation to pay rent was viewed as a continuing obligation which was not excused by the landlord’s failure to fulfill any covenant of repair he may have assumed. As indicated earlier in this opinion, the entire foundation of the “independent covenants” doctrine rested on the central role played by land in the lease transaction of the Middle Ages; the doctrine simply reflected the fact that in those early times covenants regarding the maintenance of buildings were generally “incidental” to the furnishing of land, and did not go to the root of the consideration for the lease. In that setting, a landlord’s breach of such an “incidental” covenant to repair was reasonably considered insufficient to justify the tenant’s refusal to pay rent, the tenant’s main obligation under the lease.

The transformation which the residential lease has undergone since the Middle Ages, however, has completely eroded the underpinnings of the “independent covenant” rule. Today the habitability of the dwelling unit has become the very essence of the residential lease; the landlord can as materially frustrate the purpose of such a lease by permitting the premises to become uninhabitable as by withdrawing the use of a portion of the premises. (See fn. 20, supra) Thus, in keeping with the contemporary trend to analyze urban residential leases under modern contractual principles, we now conclude that the tenant’s duty to pay rent is “mutually dependent” upon the landlord’s fulfillment of his implied warranty of habitability. (See Medico-Dental etc. Co. v. Horton & Converse (1942) 21 Cal.2d 411, 419-421 [132 P.2d 457].) Such was essentially the holding of the Court of Appeal in Hinson v. Delis (26 Cal.App.3d at p. 71) as well as a number of the out-of-state cases which have recently adopted the implied warranty of habitability rule. (See pp. 631, 632, ante) As the Supreme Judicial Court of Massachusetts stated most recently: “The old common law treatment of the lease as a property conveyance and the independent covenants rule which stems from this treatment have outlived their usefulness.” (Boston Housing Authority v. Hemingway (1973)-Mass. -[293 N.E.2d 831, 841].)

Once we recognize that the tenant’s obligation to pay rent and the landlord’s warranty of habitability are mutually dependent, it becomes clear that the landlord’s breach of such warranty may be directly relevant to the issue of possession. 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. Under such circumstances, of course, the landlord would not be entitled to possession of the premises. (See Skaggs v. Emerson (1875) 50 Cal. 3, 6; Giraud v. Milovich (1938) 29 Cal.App.2d 543, 547-549 [85 P.2d 182].)

The landlord contends, however, that the recognition of such a defense will completely undermine the speedy procedure contemplated for unlawful detainer actions. In the first place, however, while the state does have a significant interest in preserving a speedy repossession remedy, that interest cannot justify the exclusion of matters which are essential to a just resolution of the question of possession at issue. As the Court of Appeal observed in Abstract Investment Co. v. Hutchinson (1962) 204 Cal.App.2d 242, 249 [22 Cal.Rptr. 309]: “Certainly the interest in preserving the summary nature of an action cannot outweigh the interest of doing substantial justice. To hold the preservation of the summary proceeding of paramount importance would be analogous to the ‘tail wagging the dog.’ ”

Second, we believe the landlord’s contention greatly exaggerates the detrimental effect of the recognition of this defense on the summary unlawful detainer procedure. As illustrated by the numerous California precedents cited and discussed above (see fn. 19), defendants in unlawful detainer actions have long been permitted to raise those affirmative defenses —both legal and equitable—that are directly relevant to the issue of possession; over the years, the unlawful detainer action has remained an efficient, summary procedure. We see no reason why the availability of a warranty of habitability defense should frustrate the summary procedure when the availability of these other defenses has not.

Indeed, the landlord’s dire forecast fades in the light of the host of recent out-of-state decisions which, in adopting a warranty of habitability, have explicitly permitted the issue to be raised in summary dispossession proceedings. (See p. 631, ante.) In addition, several “model” landlord-tenant codes, recently drafted under the auspices of highly regarded legal bodies, have also recommended the recognition of this defense in such summary actions. (See National Conference of Commissioners on Uniform State Laws, Uniform. Residential Landlord-Tenant Act (1972) § 4.105; American Bar Foundation, Model Residential Landlord-Tenant Code (Tent. Draft 1970) §§ 2-203(1), 3-210.) As these authorities recognize, this development accords with “[t]he salutary trend toward determination of the rights and liabilities of litigants in one, rather than multiple proceedings . . . .” (Jack Spring, Inc. v. Little (1972) 50 Ill.2d 351 [280 N.E.2d 208, 213].)

Moreover, as the Hinson court indicated, sound procedural safeguards suffice to protect the landlord’s economic interests without depriving the tenant of a meaningful opportunity to raise the breach of warranty issue. The Hinson court, elaborating on a procedural mechanism suggested by the Court of Appeal for the District of Columbia in the Javins opinion (428 F.2d at p. 1083, fn. 67), stated: “If the tenant claims that all or a part of rent is not due because of defects in the premises, the trial court may, during the pendency of the action and at the request of either party, require the tenant to make the rental payments at the contract rate into court as they become due for as long as the tenant remains in possession. At the trial of the action the court can then determine how the rent paid into court should be distributed.” (26 Cal.App.3d at p. 71.) Such a procedure can serve as a fair means of protection of landlords from potential abuses of the proposed warranty of habitability defense. (See National Conference of Commissioners on Uniform State Laws, Uniform Residential Landlord and Tenant Act (1972) § 4.105.)

4. Conclusion.

We have concluded that a warranty of habitability is implied by law in residential leases in this state and that the breach of such a warranty may be raised as a defense in an unlawful detainer action. Under the implied warranty which we recognize, a residential landlord covenants that premises he leases for living quarters will be maintained in a habitable state for the duration of the lease. This implied warranty of habitability does not require that a landlord ensure that leased premises are in perfect, aesthetically pleasing condition, but it does mean that “bare living requirements” must be maintained. In most cases substantial compliance with those applicable building and housing code standards which materially affect health and safety will suffice to meet the landlord’s obligations under the common law implied warranty of habitability we now recognize. As the Hinson court observed: “[m]inor housing code violations standing alone which do not affect habitability must be considered de minimus and will not entitle the tenant to reduction in rent -. . . .” (26 Cal.App.3d at p. 70.)

In the instant case, the tenant defended the unlawful detainer action on the grounds that the premises were not in a habitable condition; in support of this claim, as noted above, he presented a city housing inspection report detailing some 80 violations of local housing and building codes, including major defects in the building’s plumbing and electrical facilities. At trial the tenant also testified that he had repeatedly informed the landlord of plumbing blockages, a collapsed bathroom ceiling, lack of heat in four rooms, exposed and faulty wiring and an illegally installed and dangerous stove, but that the landlord had failed to make any repairs within a reasonable period of time. Although this evidence of substantial defects in the premises was not controverted at trial, the court granted judgment for the landlord, on the theory that, whatever the condition of the premises, the tenant’s exclusive remedy was provided by section 1941 et seq. of the Civil Code. As discussed above, that conclusion was erroneous and thus we must remand this case to the trial court so that it may determine whether the landlord has breached the implied warranty of habitability as defined in this opinion.

If the trial court does find a breach of implied warranty, the court must then determine the extent of the damages flowing from this breach. Recent decisions have suggested that in these circumstances the “tenant’s damages shall be measured by the difference between the fair rental value of the premises if they had been as warranted and the fair rental value of the premises as they were during occupancy by the tenant in the unsafe or unsanitary condition.” (Mease v. Fox (Iowa 1972) 200 N.W.2d 791, 797; Boston Housing Authority v. Hemingway (1973)-Mass.-[293 N.E.2d 831, 845]; Academy Spires, Inc. v. Jones (1970) 108 N.J.Super. 395 [261 A.2d 413, 417].)

We recognize that the ascertainment of appropriate damages in such cases will often be a difficult task, not susceptible of precise determination, but in this respect these cases do not differ significantly from a host of analogous situations, in both contract and tort law, in which damages cannot be computed with complete certainty. (See, e.g., Shoemaker v. Acker (1897) 116 Cal. 239, 245 [48 P. 62]; Donahue v. United Artists Corp. (1969) 2 Cal.App.3d 794, 804 [83 Cal.Rptr. 131]; Story Parchment Co. v. Paterson Co. (1931) 282 U.S. 555, 562-567 [75 L.Ed. 544, 548-551, 51 S.Ct. 248].) In these situations, trial courts must do the best they can and use all available facts to approximate the fair and reasonable damages under all of the circumstances. (See McGregor, Damages (13th ed. 1972) § 258, p. 184; McCormick, Damages (1935) .§ 27, p. 101.)

In the instant case, the tenant has already quit the premises and thus the only matter to be determined on remand is the question of money damages owing to the landlord. In unlawful detainer actions generally, however, if the trial court determines that the landlord’s breach of warranty is total, and that the tenant owes no rent whatsoever, the court should, of course, enter judgment for the tenant in the unlawful detainer action. If the court determines, however, 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 tent that is owing, as directed by the trial court. (See Code Civ. Proc., § 1174; cf. Academy Spires, Inc. v. Brown (1970) 111 N.J.Super. 447 [268 A.2d 556, 562]; Javins v. First National Realty Corporation (1970) 428 F.2d 1071, 1083 [138 App.D.C. 369].) If the tenant fails to pay such sum, the landlord is entitled to a judgment for possession. Finally, of course, 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.

In summary, we have concluded that the traditional common law rule which imposed no warranty of habitability in residential leases is a product of an earlier, land-oriented era, which bears no reasonable relation to the social or legal realities of the landlord-tenant relationship of today. The United States Supreme Court has observed that “the body of private property law . . ., more than almost any other branch of law, has been shaped by distinctions whose validity is largely historical.” (Jones v. United States (1960) 362 U.S. 257, 266 [4 L.Ed.2d 697, 705, 80 S.Ct. 725, 78 A.L.R.2d 233]), and on previous occasions in recent years our own court has responded to the changes wrought by modern conditions by discarding outworn common law property doctrines. (See Rowland v. Christian (1968) 69 Cal.2d 108 [70 Cal.Rptr. 97, 443 P.2d 561, 32 A.L.R.3d 496].) In taking a similar step today, we do not exercise a novel prerogative, but merely follow the well-established duty of common law courts to reflect contemporary social values and ethics. As Justice Cardozo wrote in his celebrated essay “The Growth of the Law” chapter V, pages 136-137: “A rule which in its origin was the creation of the courts themselves, and was supposed in the making to express the mores of the day, may be abrogated by courts when the mores have so changed that perpetuation of the rule would do violence to the social conscience. . . . This is not usurpation. It is not even innovation. It is the reservation for ourselves of the same power of creation that built up the common law through its exercise by the judges of the past.”

Let a peremptory writ of mandate issue directing the superior court to vacate the San Francisco Superior Court judgment entered in the case of Sumski v. Green, S.C.A. No. 11836 on January 3, 1973, and instructing the court to proceed with the trial of the unlawful detainer action in accordance with the views expressed herein.

Wright, C. J., McComb, J., Mosk, J., Burke, J., Sullivan, J., and Clark, J., concurred. 
      
      See Pines v. Perssion (1961) 14 Wis.2d 590 [111 N.W.2d 409]; Lemle v. Breeden (1969) 51 Hawaii 426 [462 P.2d 470, 40 A.L.R.3d 637]; Javins v. First National Realty Corporation (1970) 428 F.2d 1071 [138 App.D.C. 369], cert. den., 400 U.S. 925 [27 L.Ed.2d 185, 91 S.Ct. 186]; Marini v. Ireland (1970) 56 N.J. 130 [265 A.2d 526, 40 A.L.R.3d 1356]; Kline v. Burns (1971) 111 N.H. 87 [276 A.2d 248]; Jack Spring, Inc. v. Little (1972) 50 Ill.2d 351 [280 N.E.2d 208]; Mease v. Fox (Iowa 1972) 200 N.W.2d 791; Boston Housing Authority v. Hemingway (Mass. 1973) 293 N.E.2d 831.
     
      
      
        Hall v. Municipal Court, S.F. 22992, also decided this day, post, p. 641 [111 Cal.Rptr. 721, 517 P.2d 1185].
     
      
      The instant record contains no allegations—by either the landlord or tenant—that the premises were in an uninhabitable condition at the time they were first rented by petitioner. Consequently we have no occasion in the instant case to pass on the question of whether a lease of such premises constitutes an “illegal contract” (see Shephard v. Lerner (1960) 182 Cal.App.2d 746 [6 Cal.Rptr. 433]; Brown v. Southall Realty Company (D.C.Mun.App. 1968) 237 A.2d 834) or, conversely, whether the tenant should be considered to have “assumed the risk” of uninhabitable premises. On the present record, the case at bar involves only an allegation that the landlord failed to maintain the leased premises in a habitable condition. (Cf. Javins v. First National Realty Corporation (1970) 428 F.2d 1071, 1079 [138 App.D.C. 369].)
     
      
      The superior court judgment states: “The court finds that defendant has not complied with sec. 1941 Civil Code et seq. and is not entitled to relief or withholding of rent by reason of such failure to comply.”
     
      
      The propriety of relief by writ of mandate under these circumstances was recognized in Schweiger v. Superior Court (1970) 3 Cal.3d 507, 517-518 [90 Cal.Rptr. 729, 476 P.2d 97],
     
      
      Petitioner Green failed to make the requisite payments of rent into court, but instead quit the premises, allegedly because of continued deterioration of the dwelling; thus, our stay of execution is no longer in force. The landlord claims that this development has rendered the case moot, and he urges that the action be dismissed. Petitioner has properly pointed out, however, that the trial court judgment of $225 is still outstanding against him. Inasmuch as this outstanding adverse money judgment was rendered without consideration of the effects of a possible breach of an implied warranty of habitability, the present controversy is not moot.
      Moreover, because of the general importance of the underlying warranty of habitability issue and the frequency with which this issue will arise, we believe that in any event we should resolve the question in the instant case. As we stated recently in Liberty Mut. Ins. Co. v. Fales (1973) 8 Cal.3d 712, 715-716 [106 Cal.Rptr. 21, 505 P.2d 213]: “If an action involves a matter of continuing public interest and the issue is likely to recur, a court may exercise an inherent discretion to resolve that issue, even though an event occurring during its pendency would normally render the matter moot. [Citations.]”
     
      
      The list of recent law review articles on this subject, uniformly advocating the adoption of an implied warranty of habitability as a more realistic approach to contemporary conditions, is virtually endless. (E.g., Lesar, Landlord and Tenant Reform (1969) 35 N.Y.U.L.Rev. 1279; Quinn & Phillips, The Law of Landlord-Tenant: A Critical Evaluation of the Past With Guidelines for the Future (1969) 38 Fordham L.Rev. 225; Schoskinski, Remedies of the Indigent Tenant: Proposal for Change (1966) 54 Geo.L.J. 519; Loeb, Low Income Tenants in California: A Study in Frustration (1970) 21 Hastings LJ. 287; Moskovitz, Rent Withholding and the Implied Warranty of Habitability (1970) 4 Clearinghouse Rev. 49; Note, Repairing the Duty to Repair (1971) 11 Santa Clara Law. 298.)
     
      
      Section 33250 of the Health and Safety Code, enacted in 1970, documents this condition in California. The section states: “[The Legislature] finds and declares that there continues to exist throughout the state a seriously inadequate supply of safe and sanitary dwelling accommodations for persons and families of low income. This condition is contrary to the public interest and threatens the health, safety, welfare, comfort and security of the people of this state.”
     
      
      In light of this inequality of bargaining power, the Massachusetts Supreme Judicial Court, in recently recognizing a warranty of habitability for residential leases, held that such warranty generally could not be waived by any provision in the lease or rental agreement. (See Boston Housing Authority v. Hemingway (1973) -Mass. - [293 N.E.2d 831, 843].) We agree that public policy requires that landlords generally not be permitted to use their superior bargaining power to negate the warranty of habitability rule. The Legislature has recently reached a similar conclusion with respect to tenants’ rights under Civil Code section 1941 et seq. (See Civ. Code, § 1942.1.)
     
      
      Thus, for example, the doctrine of “constructive eviction,” which expanded the traditional “covenant of quiet enjoyment” from simply a guarantee of the tenant’s possession of the premises (see Connor v. Bernheimer (N.Y. Com. Pleas 1875) 6 Daly 295, 299; Georgeous v. Lewis (1912) 20 Cal.App. 255, 258 [128 P. 768]) to a protection of his “beneficial enjoyment” of the premises through the maintenance of basic, necessary services (Groh v. Kover’s Bull Pen, Inc. (1963) 221 Cal.App.2d 611, 614 [34 Cal.Rptr. 637]; Sierad v. Lilly (1962) 204 Cal.App.2d 770, 773 [22 Cal.Rptr. 580]), gives little help to the typical low income tenant today because to avail himself of the doctrine a tenant must vacate the premises. (See, e.g., Veysey v. 
        Moriyama (1921) 184 Cal. 802, 805-806 [195 P. 662, 20 A.L.R. 1363]; Lori, Ltd. v. Wolfe (1948) 85 Cal.App.2d 54, 65 [192 P.2d 112].) In the present housing market many tenants cannot find any alternative housing which they can afford, and thus this reform of the common law rules has in reality provided little comfort to most needy tenants. (See Loeb, The Low-Income Tenant in California: A Study in Frustration (1970) 21 Hastings L.J. 287, 304.)
     
      
      Indeed, even before the turn of the century, common law courts had recognized an implied warranty of habitability in leases of furnished rooms or furnished houses. In the seminal case of Ingalls v. Hobbs (1892) 156 Mass. 348, 350 [31 N.E. 286]) the Supreme Judicial Court of Massachusetts explained why the traditional no warranty of habitability rule did not apply to such rentals: “[T]here are good reasons why a different rule should apply to one who hires a furnished room, or a furnished house .... Its fitness for immediate use ... is a far more important element entering into the contract than when there is a mere lease of real estate. . . . An important part of what the hirer pays for is the opportunity to enjoy it without delay, and without the expense of preparing it for use. It is very difficult, and often impossible, for one to determine on inspection whether the house and its appointments are fit for the use for which they are immediately wanted, and the doctrine of caveat emptor, which is ordinarily applicable to a lessee of real estate, would often work injustice if applied to cases of this kind. It would be unreasonable to hold, under such circumstances, that the landlord does not impliedly agree that what he is letting is a house suitable for occupation in its condition at the time.”
      Recent cases have recognized that the rationale underlying the Ingalls court’s adoption of an implied warranty of habitability in the rental of furnished dwellings is now applicable to urban residential leases generally. (See, e.g., Boston Housing Authority v. Hemingway (1973) - Mass. - [293 N.E.2d 831, 841]; Javins v. First
      
      
        
        National Realty Corporation (1970) 428 F.2d 1071, 1078 [138 App.D.C. 369].) Our decision today may be seen as a logical development of the common law principles embodied in the Ingalls decision.
     
      
      The cases are cited in fn. 1, supra. Moreover, lower courts in several additional states have also recently recognized the existence of an implied warranty of habitability. (See, e.g., Amanuensis Ltd. v. Brown (1971) 65 Misc.2d 15 [318 N.Y.S.2d 11]; Quesenbury v. Patrick (Colorado Cty.Ct. 1972) C.C.H. Pov.L.Rptr. ¶ 15,803; Glyco v. Schultz (Ohio Mun.Ct. 1972) C.C.H. Pov.L.Rptr. ¶ 16,608.)
     
      
      The Hinson decision was decided prior to the Illinois, Iowa, and Massachusetts decisions cited in footnote 1, but subsequent to all the other out-of-state authority.
     
      
      Two of the recent decisions of our sister states have reached similar conclusions under comparable circumstances. In Jack Spring, Inc. v. Little (1972) 50 Ill.2d 351 [280 N.E.2d 208] the Illinois Supreme Court recognized a common law implied warranty of habitability in the face of an argument that a state statute which provided for rent withholding by welfare recipients was intended as the exclusive remedy in the area. And in Boston Housing Authority v. Hemingway (1973) -Mass. - [293 N.E.2d 831, 839-842 and fn. 10] the Massachusetts Supreme judicial Court went even further, holding that a general statutory rent withholding procedure did not preclude the development of a common law implied warranty of habitability which would be available to a tenant even if he did not comply with the established statutory procedure. (See also Amanuensis Ltd. v. Brown (1971) 65 Misc.2d 15 [318 N.Y.S.2d 11].)
     
      
      In the recent case of Academy Spires, Inc. v. Brown (1970) 111 N.J.Super. 477 [268 A.2d 556] the landlord similarly claimed that a tenant’s only remedies under the governing New Jersey “warranty of habitability” precedent, Marini v. Ireland (1970) 56 N.J. 130 [265 A.2d 526, 40 A.L.R.3d 1356], were to “repair and deduct” or to abandon the premises. In rejecting this contention in a case involving the malfunctioning of a heating system, water pipes, elevators and an incinerator in a multistoried apartment building, the court declared: “Was the tenant required to make the repairs to this 400-unit complex as a prerequisite to availability of the relief given by Marini? If the answer to that question is in the affirmative, Marini has no meaning to tenants in multi-family dwellings who need the relief most. Obviously, few such tenants have the means to lay out the capital . . . .” (268 A.2d at p. 560.)
     
      
      Section 1170 of the Code of Civil Procedure provides that in summary unlawful detainer proceedings “the defendant may appear and answer or demur” (italics added), and under section 431.30, an “answer” may contain “[a] statement of any new matter constituting a defense” but may not claim affirmative relief. Thus, nothing in the statutory scheme precludes a defendant from interposing an affirmative defense in an unlawful detainer proceeding.
     
      
      See, e.g., Arnold v. Krigbaum (1915) 169 Cal. 143., 145 [146 P. 423]; Cheney v. Trauzettel (1937) 9 Cal.2d 158, 159 [69 P.2d 832]; Knight v. Black (1912) 19 Cal.App. 518, 527-528 [126 P. 512]; D’Amico v. Riedel (1949) 95 Cal.App.2d 6, 8 [212 P.2d 52],
     
      
      An exception to this rule has been recognized when the tenant has voluntarily surrendered possession of the premises before the trial of the unlawful detainer action. (See, e.g., Servais v. Klein (1931) 112 Cal.App. 26, 36 [296 P. 123]; Heller v. Melliday (1943) 60 Cal.App.2d 689, 697 [141 P.2d 447].) In such a case, the right to possession would no longer be at issue and thus the need for a speedy procedure, underlying the rule, would evaporate.
     
      
      Although several Court of Appeal decisions have suggested that the Knowles doctrine precludes the introduction of all affirmative defenses in unlawful detainer actions except for “equitable” defenses (see, e.g., Union Oil Co. v. Chandler (1970) 4 Cal.App.3d 716, 721-722 [84 Cal.Rptr. 756]; Rydell v. Beverly Hills P. & P. Co. (1927) 88 Cal.App. 216, 219 [262 P. 818]; Knight v. Black (1912) 19 Cal.App. 518, 527-528 [126 P. 512]), this characterization is inaccurate on two grounds. First, past cases have not permitted the interposition of any conceivable equitable defense, but have allowed only those defenses which, if established, would preclude the landlord from recovering possession of the property. Second, California decisions have at the same time permitted the introduction of “legal” defenses whenever such defenses, if proven, would have preserved possession in the tenant.
      Two cases aptly illustrate the first proposition. In Smith v. Whyers (1923) 64 Cal.App. 193, 195 [221 P. 387], the court refused to permit a tenant to raise the “equitable defense” that the lease under which she held possession had been obtained by fraud, because even if the tenant established the invalidity of the lease, she would not have been entitled to retain possession but could only have rescinded and obtained damages. By contrast, in Johnson v. Chely (1872) 43 Cal. 299, 305, a tenant was permitted to defend an unlawful detainer action on the ground that the landlord’s lease was obtained by fraud, for the tenant had been in possession prior to the lease and thus by demonstrating its invalidity would have been entitled to retain possession. (See, e.g., Schubert v. Lowe (1924) 193 Cal. 291, 295-296 [223 P. 550]; Rishwain v. Smith (1947) 77 Cal.App.2d 524, 531-533 [175 P.2d 555]; Gray v. Maier & Zobelein Brewery (1906) 2 Cal.App. 653, 657-658 [84 P. 280].)
      Moreover, the Johnson case also demonstrates that the rule permitting defenses that are relevant to the issue of possession is not limited to “equitable” defenses, but applies equally to “legal” defenses. In permitting the' tenant to set up the defenses of fraud under the circumstances discussed above, the Johnson court specifically noted that such defense “wherever set up, is of legal and not of merely equitable cognizance . . . .” (Italics added.) (Johnson v. Chely (1872) 43 Cal. 299, 305.) Similarly, the court in Giraud v. Milovich (1938) 29 Cal.App.2d 543, 547-549 [85 P.2d 182], permitted a tenant in an unlawful detainer action to raise the legal defense of “partial eviction” which excused the tenant’s nonpayment of rent and precluded the landlord from obtaining possession of the premises. (See also Skaggs v. Emerson (1875) 50 Cal. 3, 6; cf. Arnolds. Krigbaum (1915) 169 Cal. 143, 146-147 [146 P. 423].) Indeed several of the early cases from which the so-called “equitable defense” exception emanated permitted defenses which might more appropriately be characterized as legal than equitable. (See, e.g., Knight v. Black (1912) 19 Cal.App. 518, 526 [126 P. 512]; Strom v. Union Oil Co. (1948) 88 Cal.App.2d 78, 81-85 [198 P.2d 347].)
      Two of the more recent unlawful detainer cases, Abstract Investment Co. v. Hutchinson (1962) 204 Cal.App.2d 242 [22 Cal.Rptr. 309] and Schweiger v. Superior 
        
        Court (1970) 3 Cal.3d 507 [98 Cal.Rptr. 729, 476 P.2d 97], provide perhaps the clearest indication that the determination of whether a defense may be raised in such a proceeding does not turn on whether such defense is “equitable” or “legal” in nature, but rather upon whether the establishment of the defense will preclude the removal of the tenant from the premises. In Abstract Investment the court permitted a tenant to raise the landlord’s alleged racially discriminatory motive as a defense in an unlawful detainer action. The court reasoned that if such discrimination were established, constitutional principles would bar the state from giving affirmative aid to the landlord’s eviction efforts; hence, the proffered defense was directly relevant to whether the tenant could retain possession of the premises. Although the court noted the “equitable” considerations involved, the tenant’s defense, in light of its constitutional basis, could at least equally be characterized as “legal” in nature.
      In Schweiger, following the lead of Abstract Investment, we upheld a tenant’s defense to an unlawful detainer action on the ground that the landlord’s attempt to evict a tenant was in retaliation for his exercise of his right to “repair and deduct” granted by Civil Code section 1941 et seq. Without specifically labelling this defense as “legal” or “equitable,” our court recognized that to prevent the emasculation of the “repair and deduct” remedy, we were compelled to permit such a defense in an unlawful detainer action. (3 Cal.3d at pp. 513-517.)
     
      
      The traditional “independent covenant” rule only applied to covenants, such as the covenant to repair buildings, which were “collateral” to the landlord’s obligation to provide land to the tenant; because of the importance of land in early leases, the common law generally recognized that the tenant’s obligation to pay rent was mutually dependent upon the landlord’s fulfillment of his covenant to furnish the land. Thus, if the landlord deeded away even a small portion of the leased land, the common law considered this a “partial actual eviction” and relieved the tenant of his rental obligation. (See Giraud v. Milovich (1938) 29 Cal.App.2d 543, 547-549 [85 P.2d 182].)
     
      
      Our rejection of the “independent covenant” rule in this context was foreshadowed by the Court of Appeal decision in Groh v. Kover’s Bull Pen, Inc. (1963) 221 Cal.App.2d 611 [34 Cal.Rptr. 637]. In Groh, the landlord had covenanted to repair the roof of a store he rented, but failed to make the repairs. During the rainy season, severe leaks led the tenant to terminate the lease and sue for the return of his security deposit. The landlord claimed that his covenant to repair was “independent” of the tenant’s covenant to pay rent, and thus that the tenant could only sue for damages but could not terminate the lease. The Groh court rejected this contention and found that the landlord’s breach of his duty to repair did release the tenant from his obligations under the lease because “the covenant undertaken by defendants to repair the roof goes to the very root of the consideration for the lease.” (221 Cal.App.2d at p. 614.)
     
      
      The recent case of Academy Spires, Inc. v. Brown (1970) 111 N.J.Super. All [268 A.2d 556] gives a good indication of the general scope of the warranty of habitability. In that case, a tenant in a multi-story apartment building complained of a series of defects, including (1) the periodic failure to supply heat and water, (2) the malfunctioning of an incinerator, (3) the failure in hot water supply, (4) several leaks in the bathroom, (5) defective Venetian blinds, (6) cracks in plaster walls, (7) unpainted condition of walls and (8) a nonfunctioning elevator. The Academy Spires court held: “Some of these clearly go to bare living requirements. In a modern society one cannot be expected to live in a multi-storied apartment building without heat, hot water, garbage disposal or elevator service. Failure to supply such things is a breach of the implied covenant of habitability. Malfunction of Venetian blinds, water leaks, wall cracks, lack of painting, at least of the magnitude presented here, go to what may be called ‘amenities.’ Living with lack of painting, water leaks and defective Venetian blinds may be unpleasant, aesthetically unsatisfying, but does not come within the category of uninhabitability. Such things will not be considered in diminution of the rent.” (268 A.2d at p. 559.) (See also Gillette v. Anderson (1972) 4 Ill.App.3d 838 [282 N.E.2d 149] (warranty of habitability breached by failure to provide adequate bathing facilities).)
     
      
      We also believe that the standards of “tenantability” set out in Civil Code section 1941.1, though not strictly applicable in this context of their own force, may provide some helpful guidance in determining whether a landlord has satisfied the common law warranty of habitability.
     
      
      The case of Academy Spires, Inc. v. Brown (1970) 111 N.J.Super. 477 [268 A.2d 556, 561-562] demonstrates one reasonable response to the problem. The Academy Spires court, after fully acknowledging the difficulty of precisely determining damages resulting from a landlord’s breach of an implied warranty of habitability, assessed damages by a “percentage reduction of use” approach, under which the court reduced the tenant’s rental obligation by a percentage corresponding to the relative reduction of use of the leased premises caused by the landlord’s breach. In applying this approach, the Academy Spires court carefully reviewed both the importance of the particular defects in the premises (including failure to supply heat, hot water, elevator service and a working incinerator) and the length of time such defects had existed (from one or two days to several weeks), and finally concluded that under all the circumstances “the diminution in rent of 25% is a fair amount.” (268 A.2d at p. 562.) (See also Samuelson v. Quinones (1972) 119 N.J.Super. 338 [291 A.2d 580, 583]; Morbeth Realty Corp. v. Rosenshine (1971) 67 Misc.2d 325 [323 N.Y.S.2d 363, 366-367].)
     