
495 S.W.2d 65 (1973)
Oscar KING, Respondent,
v.
Marie MOOREHEAD, Appellant.
No. 25812.
Missouri Court of Appeals, Kansas City District.
April 2, 1973.
Motion for Rehearing and/or Transfer Denied May 7, 1973.
*67 James L. Muller, The Legal Aid and Defender Society of Greater Kansas City, Inc., Kansas City, for appellant.
None for respondent.
Before DIXON, C. J., and SHANGLER, SWOFFORD, PRITCHARD and WASSERSTROM, JJ.
SHANGLER, Judge.
This action was commenced in the magistrate court by a landlord's complaint which alleged that defendant occupied certain premises as a tenant of the plaintiff leased on the 6th day of March, 1969, from month to month at the rate of $85 per month and that the sum of $109 was due plaintiff as rent. The complaint sought judgment for possession and rent in the sum demanded, and the magistrate entered judgment accordingly.
The tenant appealed to the circuit court and filed an answer in which she admitted the lease of the premises for use as a single family dwelling as a month to month tenant of the plaintiff for the agreed rent of $85 per month, that she paid rent through the month ending May 6, 1969, but refused to do so thereafter until plaintiff corrected and abated certain substantial housing code violations, and admitted that she did not vacate the premises until August 1, 1969, when she was finally able to obtain other housing. Defendant then denied indebtedness to plaintiff for any rent for her occupancy from and after May 6, 1969, and as the basis for this denial asserted two affirmative defenses.
The first affirmative defense alleged that the rental agreement was illegal, void and unenforceable because in violation of the Housing Code of Kansas City, Missouri.[1] The defense pleaded as exhibits numerous provisions of the Code, among them, Section 20.16 which renders it unlawful for any person to use or occupy, or for any owner to permit any dwelling *68 unit to be used or occupied, as a place for human habitation unless in compliance with the requirements of the Code, and declaring any building for habitation and which does not conform to the regulations to be a nuisance; and, Section 20.34 which requires the owner of a dwelling to maintain it in good order and repair and fit for human habitation; and, Section 20.10 which renders a violation of the Code a misdemeanor and provides for a fine of not more than $100 for each offense. The defendant also alleged fourteen specific conditions, including rodent and vermin infestation, defective and dangerous electrical wiring, leaking roof, inoperative toilet stool, unsound and unsafe ceilings, which at the time of letting the plaintiff knew or should have known were in violation of the Housing Code and rendered the premises unfit for human habitation.[2] In consequence, the defendant alleged the unenforceability of the rental agreement in the pending action. The second affirmative defense reasserted the allegations of the illegality defense and further alleged that at the time of the letting, plaintiff impliedly covenanted to provide premises in a safe, sanitary and habitable condition, and to so maintain them in compliance with state and local laws, including the provisions of the Housing Code. This defense also alleged that the refusal of the plaintiff to abate the conditions constituting violations of the Housing Code rendered the premises wholly unsuitable for human habitation, was a substantial breach of the implied covenant, and amounted to a failure of consideration on the part of the plaintiff so as to relieve defendant of her obligation to pay rent in whole or in substantial part.[3]
The circuit court determined that the defendant's answer admitted occupancy of the premises without payment of the accrued rent for the period alleged in the complaint, and thus failed to state a legal defense to the plaintiff's claim. The court ordered the first and second affirmative defenses stricken and entered judgment for plaintiff for $109 and his costs. The effect of the judgment of the circuit court that the allegations of illegality of lease and breach of an implied warranty of habitability were not sufficient as legal defenses to the plaintiff's claim for rent was to concede the truth of the facts well pleaded by defendant. We test the propriety of the trial court's judgment in the perspective of that concession. Higday v. Nickolaus, 469 S.W.2d 859, 864 [10] (Mo. App.1971).
At early common law, a lease was considered a conveyance of an estate in land and was equivalent to a sale of the premises *69 for the term of the demise. Warner v. Fry, 360 Mo. 496, 228 S.W.2d 729, 730 [1] (1950); 2 Powell, The Law of Real Property, § 221(1) at 178. As a purchaser of an estate in land, the tenant was subject to the strict property rule of caveat emptorlet the buyer beware. The lessee's eyes were his bargain. He had the duty to inspect the property for defects and took the land as he found it. "[F]raud apart, there (was) no law against letting a tumble-down house." Robbins v. Jones, 15 CBNS 221, 143 Eng. Rep. 768, 776 (1863). There was no implied warranty by the lessor that the leased premises were habitable or fit. The common law traditionally assumed that the landlord and tenant were of equal bargaining power. So, if the tenant wished to protect himself as to the fitness of the premises, he could exact an express covenant from the landlord for that purpose. Burnes v. Fuchs, 28 Mo.App. 279, 281 (1887); Griffin v. Freeborn, 181 Mo.App. 203, 168 S. W. 219, 220 [1-5] (1914); See also, Landlord and TenantImplied Warranty of HabitabilityDemise of the Traditional Doctrine of Caveat Emptor, 20 DePaul L. Rev. 955 (1970-1971).
The law of leasehold originated in an era of agrarian economy which assumed that the land was the most important feature of the conveyance. The tenant was only the conduit for the rent which was conceived to issue from the land itself "without reference to the condition of the buildings or structures on it". Hart v. Windsor, 12 M & W 68, 152 Eng.Rep. 1114, 1119. If the buildings were not habitable, the rentwhich was the quid pro quo of the tenant's possessionwas still due from him.[4] Thus, even where the tenant was successful in exacting a covenant that the lessor make repairs, this covenant was considered only incidental to the land and independent of the tenant's covenant to pay rent.[5] Hence a breach by the landlord did not suspend the obligation of rent; the tenant's only remedy was to sue for damages arising from the breach. For all practical purposes, the obligation to pay rent was absolute.
This rule of law where rigorously applied had harsh results.[6] The severity of the rule has been softened by judicially created exceptions which recognize a lease as a conveyance but, in certain circumstances, treat the landlord-tenant relationship as if governed by principles of contract law. Thus, even the earliest common law lease was understood to be "a contract for title to the estate" and thus to imply a covenant of quiet enjoyment of the demised premises.[7] If the landlord evicts a tenant by physically depriving him of possession, he breaches the implied covenant of quiet enjoyment and the obligation of the tenant to pay rent is suspended. Dolph v. Barry, 165 Mo.App. 659, 148 S.W. 196, 198 (1912). The covenant of quiet enjoyment is not only an exception to caveat *70 emptor but also to the doctrine that the covenants of a lease are independent.[8]
Upon this exception was built another exception, the doctrine of constructive eviction. The courts soon came to realize that a tenant's possession and quiet enjoyment could be molested by something less than physical extrusion by the landlord. A constructive eviction arises when the lessor, by wrongful conduct or by the omission of a duty placed upon him in the lease, substantially interferes with the lessee's beneficial enjoyment of the demised premises. Under this doctrine the tenant is allowed to abandon the lease and excuse himself from the obligations of rent because the landlord's conduct, or omission, not only substantially breaches the implied covenant of quiet enjoyment but also "operates to impair the consideration for the lease". Dolph v. Barry, 165 Mo.App. 659, 148 S.W. 196, 198 [3] (1912).[9] Thus, the first remedy created by the courts to insure habitability, and to exonerate the tenant's obligation for rent under a lease for lack of it, was "designed to operate as though there were a substantial breach of a material covenant in a bilateral contract". Lemle v. Breeden, 51 Haw. 426, 462 P.2d 470, 475 [5] (1969).
The other significant, but more limited, exception to caveat emptor and the absolute obligation of the tenant to pay rent is the implied warranty of fitness for immediate use as a habitation in cases of furnished dwellings leased for a short period of time. The leading case, Ingalls v. Hobbs, 156 Mass. 348, 31 N.E. 286 (1892) states this principle in gist, l. c. 286:
One who lets for a short time a house provided with all furnishings and appointments for immediate residence may be supposed to contract in reference to a well-understood purpose of the hirer to use it as a habitation. 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.
The rationale of Ingalls, and those cases which follow it, can be understood to rest on the contractual principle that the parties intended, and the lessee could reasonably expect, that such premises would be suitable for immediate occupancy without inspection.
Although the early agrarian lease was viewed as a conveyance, the authorities agree that the modern lease is both a conveyance and a contract.[10] With the change from an agricultural to an urban society, the function of the lease has also changed. The land itself, once the central reason for the lease, is of no value to an urban dweller. The minds of the parties to a modern lease contemplate more than the mere delivery of possession and the fixing of rent. The urban lessee seeks and expects "a well known package of goods and service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." Javins v. First National Realty Corporation, 138 U.S.App.D.C. 369, 428 F. 2d 1071, 1074 [1] (1970). Thus, the importance of a lease to such a tenant today is not to create a tenurial relationship but to arrange for a habitable dwelling. Kline v. Burns, 111 N.H. 87, 276 A.2d 248, 251 (1971).
*71 The recognition that modern housing leases are bilateral contracts as well as conveyances of a property interest has resulted in re-examination of the no-repair rule enjoyed by the landlord under caveat emptor. In a context other than, but related to, the circumstances and question presented here, our Supreme Court in Minton v. Hardinger, 438 S.W.2d 3 (1968) approved the American Law of Property text criticism of the common law rule which imposes the duty of repairs upon the tenant, l. c. 7:
The rule that the tenant must make repairs was probably fair when applied in an agrarian economy where the materials for repairs were simple and at hand, and the tenant capable of making them himself. At least as concerns the actual making of repairs, the rule seems archaic and completely out of harmony with the facts when applied in a complicated society to urban dwellings occupied by persons on salary or weekly wage. Common experience indicates that the tenant in such cases seldom makes or is expected to make repairs even of the minor type covered by the common law duty * * * It would seem that the lessor is in the better position, from the viewpoint of economic situation and interest, to make repairs, and that the tenant ought to have no duty in the absence of a specific covenant.
In recent years those courts which have considered the question have uniformly rejected the applicability of caveat emptor to residential leases and have implied a warranty of habitability and fitness for use of the premises on principles of contract law.[11] The warranty is the implied effect intended by the parties to the lease agreement. Marini v. Ireland, 56 N.J. 130, 265 A. 2d 526, 533 [15] (1970). "It affirms the fact that a lease is, in essence, a sale as well as a transfer of an estate in land and is, more important, a contractual relationship." Lemle v. Breeden, 51 Haw. 426, 462 P.2d 470, 474 [1-3] (1969); Javins v. First National Realty Corporation, 138 U.S. App.D.C. 369, 428 F.2d 1071 (1970); Jack Spring, Inc. v. Little, 50 Ill.2d 351, 280 N. E.2d 208 (1972).
Considerations which justify reappraisal of common law principles of landlord and tenant in favor of an implied warranty of habitability in residential leases include 1) the contemporary housing shortage and resultant inequality in bargaining power between the landlord and tenant (Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1079; Lemle v. Breeden, supra, 462 P.2d l. c. 474 [1-3]; Chapter 99 RSMo 1969); 2) housing codes which impose repair, maintenance and other standards of habitability upon landlords (§ 441.510 et seq., RSMo Supp. 1973; § 20, Code of General Ordinances of Kansas City, Missouri; Pines v. Perssion, 14 Wis.2d 590, 111 N.W.2d 409, 412 (1961); Jack Spring, Inc. v. Little, 50 Ill.2d 351; 280 N.E.2d 208, 217 [10, 11] (1972)); 3) the common experience that the landlord has superior knowledge of the condition of the premises, including any latent defects, and that the housing requirements and violations are usually known or made known to the landlord (Kline v. Burns, 276 A.2d 248, 251 (N.H.1971); 4) a residential lessee is a purchaser of "a well known package of services" who must rely on the skill and honesty of the supplier to assure the quality of such services, and thus a residential tenant is entitled to the benefit of consumer *72 protection law (Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1075; Lemle v. Breeden, supra, 462 P.2d l. c. 474).
The Supreme Court of Wisconsin in Pines v. Perssion, 14 Wis.2d 590, 111 N. W.2d 409 (1961), found an implied covenant of habitability necessary in order for the lease to be consistent with the housing laws. A single family dwelling was leased to a group of college students. When the students moved in, they found the premises uninhabitable, and after an unsuccessful attempt to repair the premises themselves, they moved out and brought suit to recover their deposit. Although the students had inspected the house before renting it, the court pointed out that they had no way of knowing that the plumbing, heating and wiring were defective, l. c. 412-413:
Legislation and administrative rules. . . building codes and health regulations, all impose certain duties on a property owner with respect to the condition of his premises. Thus, the legislature has made a policy judgmentthat it is socially (and politically) desirable to impose these duties on a property owner  . . . 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.
The Supreme Court of Hawaii in Lemle v. Breeden, 51 Haw. 426, 462 P.2d 470 (1969) was presented with a short-term lease for a furnished water-front house. After finding the house was infested nightly with rats, the tenants abandoned and sued to recover their deposit. The court did not hold for the tenant on the traditional grounds of constructive eviction or the short-term furnished dwelling exception to the caveat emptor rule, but rather applied an implied warranty of habitability in residential leases. In rejecting the short-term furnished house exception as a basis for its decision, the court referred to the traditional rationale by which the exception was justifiedthat it is the intent of the tenant to obtain immediate habitability. The court then asserted, l. c. 473:
Yet it is clear that if the expectations of the tenant were the operative test, the exception would soon swallow up the general rule . . . We think that the exception itself is artificial and that it is the general rule of caveat emptor which must be re-examined.
In Javins v. First National Realty Corporation, 138 U.S.App.D.C. 369, 428 F.2d 1071 (1970), the landlord sought to evict a tenant for nonpayment of rent. The tenant asserted the defense that numerous housing code violations had arisen on his premises after the commencement of the tenancy. The court sustained the defense and held that, l. c. 1072, 1074, 1075, 1076, 1077, 1080:
[A] warranty of habitability, measured by the standards set out in the Housing Regulations for the District of Columbia, is implied by operation of law into leases of urban dwelling units covered by these Regulations and that breach of this warranty gives rise to the usual remedies for breach of contract.
. . . . . .
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.
. . . . . .
Modern contract law has recognized that the buyer of goods and services in an industrialized society must rely upon the skill and honesty of the supplier to assure that goods and services purchased are of adequate quality. In interpreting most contracts, courts have sought to protect the legitimate expectations of the buyer and have steadily widened the *73 seller's responsibility for the quality of goods and services through implied warranties of fitness and merchantability.
. . . . . .
Implied warranties of quality have not been limited to cases involving sales.. . . Courts have begun to hold sellers and developers of real property responsible for the quality of their product. For example, builders of new homes have recently been held liable to purchasers for improper construction on the ground that the builders had breached an implied warranty of fitness. . . . (W)e believe that the consumer protection cases discussed above require that the old rule be abandoned in order to bring residential landlord-tenant law into harmony with the principles on which those cases rest.
. . . . . .
Our approach to the common law of landlord and tenant ought to be aided by principles derived from the consumer protection cases . . . In a lease contract, a tenant seeks to purchase from his landlord shelter for a specified period of time. The landlord sells housing as a commercial business man and has much greater opportunity, incentive and capacity to inspect and maintain the condition of his building. Moreover, the tenant must rely upon the skill and bona fides of his landlord at least as much as a car buyer must rely upon the car manufacturer.
Thus we are led by our inspection of the relevant legal principles and precedents that the old common law rule imposing an obligation upon the lessee to repair during the lease term was really never intended to apply to residential urban leaseholds. Contract principles established in other areas of the law provide a more rational framework for the apportionment of landlord-tenant responsibilities; they strongly suggest that a warranty of habitability be implied into all contracts for urban dwellings.
The social realities, legislative policies and judicial disposition to re-examine an outworn common law doctrine which have prompted these courts to imply a warranty of habitability in residential leases obtain also in Missouri. The Missouri Legislature in 1939 enacted the Housing Authorities Law, Chapter 99 RSMo 1969, which authorized the improvement and construction of dwelling units to relieve the "shortage of safe or sanitary dwelling accommodations available at rents which persons of low income can afford". Thereafter, the apparent legislative recognition of the fact, commonly known, that even with such governmental assistance, new construction was not keeping pace with the obsolescence and deterioration of the existing housing inventory in the cities, resulted in the enactment in 1969 of the Enforcement of Minimum Housing Code Standards Act, §§ 441.500-441.640, RSMo Supp.1973. This statute has as its purpose the coercive repair, by the landlord or from his property, of conditions harmful to the life, health and safety of occupants of a dwelling unit resulting from violations of the housing code. If within a reasonable time after notice the landlord fails to repair such a deficiency, a receiver, appointed upon the petition of the code enforcement agency of a municipality or the requisite number of tenants, is authorized to collect rent and encumber the property to meet the cost of abatement of the housing code violations. Such statutes have been effective in extending the life of residential housing accommodations which otherwise would have lapsed into blight.[12]
The Enforcement of Minimum Code Standards statute effectively 1) recognizes the minimum standards for occupancy of municipal housing codes as standards for *74 the habitability of residential dwellings, 2) alters the common law no-repair rule by coercing repairs by the landlord or from his property to restore the tenant's occupancy to the minimum housing code standards for life, health and safety and 3) reads into every residential lease the minimum standards for occupancy of the applicable municipal housing code.
The earliest housing codes, adopted at the turn of the century were exercises in paternalism. They were aimed not at habitability but at preventing tenements from becoming sources of communicable disease. The sanction for non-compliance was a benign vacate order. If a building became so dilapidated as to be unfit for occupancy, the code enforcement agency condemned the building and forced the tenants to move. This procedure was followed during the period of favorable "vacancy ratio", when a dispossessed tenant could readily find other accommodations.[13] The serious housing shortage brought about by the influx of population to the cities, spurred by rapid industrial growth, resulted in the elimination of the vacate order. As a consequence, housing codes adopted stricter requirements of habitability and repair with provision for criminal prosecution of violators.[14]
The Housing Code of Kansas City, which adopts the minimum standards for occupancy (Article II), requires repair or other correction of a dwelling unfit for habitation (§ 20.5) and places the onus of compliance on the landlord (§ 20.34)a duty unknown at common lawunder threat of fine (§ 20.10), evinces a purpose to maintain the habitability of dwellings throughout the period of occupancy, and thus to preserve them for the housing market. It is a purpose consonant with the design of the Housing Authorities Law, §§ 99.010 to 99.230, RSMo 1969[15], to provide habitable dwellings for persons of low incomes, and of the Land Clearance for Development Authority Law, §§ 99.300 to 99.660, RSMo 1969, for the reclamation and rehabilitation of blighted neighborhoods. The Enforcement of Minimum Housing Code Standards Act, §§ 441.500 to 441.640, coerces repairs by landlords to meet minimum standards of habitability and thus alters the common law. The Act expressly adopts the maintenance provisions, and therefore the purposes, of applicable housing codes in furtherance of state legislative policy. By adopting these standards, the Legislature has clearly made a judgment that the landlord does not agree to lease merely space, but habitable space. The insight of Judge Cardozo given in a related context is particularly appropriate, Altz v. Leiberson, 233 N.Y. 16, 134 N.E. 703, l. c. 704 (1922):
The Legislature must have known that unless repairs in the rooms of the poor were made by the landlord, they would *75 not be made by any one. The duty imposed became commensurate with the need. The right to seek redress is not limited to the city or its officers. The right extends to all whom there was a purpose to protect.
It is consistent with these legislative policies that in every residential lease there be an implied warranty by the landlord that the dwelling is habitable and fit for living at the inception of the term and that it will remain so during the entire term. The warranty of the landlord is that he will provide facilities and services vital to the life, health and safety of the tenant and to the use of the premises for residential purposes. It is an obligation which the landlord fulfills by substantial compliance with the relevant provisions of an applicable housing code. Jack Spring, Inc. v. Little, supra, 280 N.E.2d l. c. 217 [10, 11]; Kline v. Burns, supra, 276 A.2d l. c. 251 [1]; Marini v. Ireland, supra, 265 A.2d l. c. 534 [15-19].
We are drawn to this conclusion also by the compelling analogy of another development in the law. In Missouri the rule of caveat emptor has steadily given way to a warranty of fitness for use implied by law, without any agreement, in sales transactions. The history of this demise is given in Smith v. Old Warson Development Company, 479 S.W.2d 795 (Mo. banc 1972). In Smith, the court determined that an implied warranty of fitness is read into a contract for the sale of a new home by a vendor-builder. The court adopted the opinion of the (then) St. Louis Court of Appeals, l. c. 799 [4] and 801 [12-15]:
Although considered to be a "real estate" transaction because the ownership of land is transferred, the purchase of a residence is in most cases the purchase of a manufactured productthe house. The land involved is seldom the prime element in such a purchase, certainly not in the urban areas of the state. (Emphasis added.)
. . . . . .
The ordinary "consumer" can determine little about the soundness of the construction but must rely upon the fact that the vendor-builder holds the structure out to the public as fit for use as a residence, and being of reasonable quality. (Emphasis added.)
. . . . . .
Common sense tells us that a purchaser under these circumstances should have at least as much protection as the purchaser of a new car, a gas stove, or a sump pump, or a ladder.
. . . . . .
"The caveat emptor rule as applied to new houses is an anachronism patently out of harmony with modern home buying practices."
The reasoning of this decision is also a postulate of those courts which have rejected caveat emptor in favor of an implied warranty of habitability in residential leases. Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1076; Lemle v. Breeden, supra, 462 P.2d l. c. 473; Mease v. Fox, supra, 200 N.W.2d l. c. 795. It is a persuasive augury that, if presented with the question, the Supreme Court of Missouri would determine, as we now do, that a warranty of habitability is implied by operation of law in every residential lease.
We adopt the view that a lease is not only a conveyance but also gives rise to a contractual relationship between the landlord and tenant from which the law implies a warranty of habitability and fitness by the landlord. Under contract principles a tenant's obligation to pay rent is dependent upon the landlord's performance of his obligation to provide a habitable dwelling during the tenancy. Lemle v. Breeden, supra, 462 P.2d l. c. 475 [6, 7]; Javins v. First National Realty Corporation, supra, 428 F.2d 1082 [7-10]. A more responsive set of remedies are thus made available to the tenant, the basic remedies *76 for contract law, including damages, reformation and rescission. Kline v. Burns, supra, 276 A.2d l. c. 252 [2]; Lemle v. Breeden, supra, 462 P.2d l. c. 475 [6, 7].
The materiality of a breach of warranty claimed by a tenant shall be determined by factors, among others, of the nature of the deficiency or defect, its effect on the life, health or safety of the tenant, length of time it has persisted and the age of the structure. Minor housing code violations which do not affect habitability will be considered de minimis. Also, the violation must affect the tenant's dwelling unit or the common areas which he uses. The tenant is under an obligation to give the landlord notice of the deficiency or defect not known to the landlord and to allow a reasonable time for its correction. The contract principle that a person may not benefit from his own wrong will exonerate a landlord for a defect or deficiency caused by a tenant's wrongful conduct. Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1082, note 62 [7-10]; Hinson v. Delis, 26 Cal.App.3d 62, 102 Cal.Rptr. 661, 666 [3-8]; Mease v. Fox, supra, 200 N.W.2d l. c. 796 [5].
In this action, the tenant-appellant sufficiently pleads a residential lease, the warranty of habitability implied from that contractual relationship, substantial violations of the municipal housing code materially affecting her life, health and safety in breach of the implied warranty, reasonable notice of the defects to the landlord, and refusal of the landlord to restore the premises to habitability. At the time the tenant pleaded in the circuit court, she had already relinquished possession. The affirmative defenses of the tenant-appellant do not seek restoration to a habitable dwelling but are in the nature of counterclaims, alternatively pleaded, for exoneration from rent on the theory of illegality of contract or for set-off in damages against the rent for breach of the implied warranty of habitability.
Where there has been a material breach of implied warranty, the tenant's damages are reasonably measured by the difference between the agreed rent and the fair rental value of the premises as they were during occupancy by the tenant in the unhealthful or unsafe condition. Kline v. Burns, supra, 276 A.2d l. c. 252 [5]; Pines v. Perssion, supra, 111 N.W.2d l. c. 413. After a tenant vacates, he is unaffected by the condition of the premises "and that factor loses relevance in the damage equation. For the balance of the term, (the) tenant has lost the benefit of his bargain, assuming he had an advantageous lease. He is therefore entitled to recover at that time for the value of the lease for the unexpired term, that is, the then difference between the fair rental value of the premises if they had been as warranted and the promised rent, computed for that period. 11 Williston on Contracts, § 1404, at p. 562 (3d ed. 1968)." Mease v. Fox, supra, 200 N.W.2d l. c. 797 [6, 7].
The implied warranty of habitability remedy developed, in measure, as response to a chronic and prolonged housing shortage, particularly for those of low income. Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1079. Common law constructive eviction, (based upon a fiction which the implied warranty remedy discards) could be claimed only by a tenant who abandoned the premises within a reasonable time. Abandonment was required to maintain the fiction of an eviction and thus the breach of the dependent covenant of quiet enjoyment. The effect of the abandonment requirement was to prevent a tenant from remaining in possession without paying rent. Dolph v. Barry, supra, 148 S.W. l. c. 198-200 [4]. Constructive eviction has proved an insufficient remedy for those most likely to have resort to it, low income tenants. The dilemma it raises for them is that they must continue to pay rent and endure the conditions of untenantability or abandon the premises and hope to find another dwelling which, in *77 these times of severe housing shortage, is likely to be as uninhabitable as the last.
This dilemma is avoided by recognizing that the modern lease is a bilateral contract so that the tenant's obligation for rent is dependent upon the landlord's performance of his responsibilities, among them, his implied warranty of habitability. Breach of this duty justifies retention of possession by the tenant and withholding of rent until habitability has been restored. A tenant who retains possession, however, shall be required to deposit the rent as it becomes due, in custodia legis pending the litigation. See and compare Javins v. First National Realty Corporation, supra, 428 F.2d l. c. 1083 note 67 [14, 15]; Hinson v. Delis, supra, 102 Cal.Rptr. l. c. 666 [9]. This procedure assues the landlord that those rents adjudicated for distribution to him will be available to correct the defects in habitability, and will also encourage the landlord to minimize the tenant's damages by making tenantable repairs at the earliest time. Also, for good cause and in a manner consistent with the ultimate right between the parties, a trial court will have discretion to make partial distribution to the landlord before final adjudication when to deny it would result in irreparable loss to him. We conclude also that this procedure is that most compatible with policy of our Legislature, of the Housing Code of Kansas City and of the implied warranty of habilitability remedy itself that there be preserved and maintained an adequate supply of habitable dwellings.
For all these reasons, we determine that the answer of the tenant-appellant sufficiently pleads an implied warranty of habitability and its breach, an issue properly asserted as defense and counterclaim to the landlord-respondent's claim for rent.
The tenant-appellant contends also that the circuit court erred in striking her affirmative defense of illegality of lease. She pleads that the lease agreement upon which the claim for rent rests was made with the landlord's knowledge and intent that the premises be used for human habitation in substantial violation of the Kansas City Housing Code, so that the lease is an agreement void, illegal and unenforceable from which no obligation for rent can arise.
In Missouri, as elsewhere, it is generally recognized that a contract or transaction prohibited by law is void. State ex rel. American Surety Co. of New York v. Haid, 325 Mo. 949, 30 S.W.2d 100, 103 [2] (1930). Such contracts are based upon illegal consideration and cannot be enforced either at law or in equity. Twiehaus v. Rosner, 362 Mo. 949, 245 S.W.2d 107, 111 [6] (1952). Agreements violating municipal ordinances are illegal to the same extent as agreements violating enactments of the legislature. 17 C.J.S. Contracts § 208. "`All persons who contract with reference to a subject-matter within the limits of a municipality as to which there are police regulations . . . are charged with knowledge of and are presumed to know the provisions of the regulations and to have entered into such contracts with reference thereto . . . and such provisions become an integral part of the contract." Lazare v. Hoffman, 444 S.W.2d 446, 450 [1] (Mo.1969). A police regulation is one which promotes "order, safety, health, morals and general welfare". Marshall v. Kansas City, 355 S.W. 2d 877, 883 [10] (Mo. banc 1962). The Kansas City Housing Code which establishes minimum standards for occupancy and habitability is such a police regulation. Thus, the parties to a lease transaction to which such a housing code appertains "`must be conclusively presumed to know the relevant law'". Sachs Steel & Supply Co. v. St. Louis Auto Parts & S. Co., 322 S.W.2d 183, 186 [2-5] (Mo. App.1959).
Leases are generally subject to the rule applicable to illegality of contracts. 49 Am.Jur.2d, Landlord and Tenant, § 41.
*78 The Kansas City Housing Code provides, § 20.16:

It shall be unlawful for any person to use or occupy, or for any owner or other person deemed to be the owner, as herein defined, to permit any dwelling unit to be used or occupied as a place for human habitation unless the same complies with the rules and regulations of this article. (Emphasis supplied.)
and § 20.34:
Every premise, dwelling and every part thereof shall be maintained in good order and repair fit for human habitation by the owner or his agent.
and § 20.10:
Any person violating any of the provisions of this chapter . . . shall be subject to fine.
These provisions expressly prohibit an owner from permitting occupancy of a dwelling unit which is unfit for human habitation because of violations of the housing code. These regulations in terms forbid the lease bargain pleaded by the tenant and fix a penalty to it. The general rule is that any act forbidden by a legislative enactment, if passed for the protection of the public and which provides for a penalty, cannot be the foundation of a valid contract. Longenecker v. Hardin, 130 Ill.App.2d 468, 264 N.E.2d 878, 880 [6] (1970). The housing code obviously intends to render void the act it prohibits.
Other courts, presented with this question, have held such leases to be illegal contracts and unenforceable. In Brown v. Southall Realty Co., 237 A.2d 834 (D.C. App.1968), the landlord knew at the time of the letting of the dwelling that substantial housing code violations existed. When the tenant's rent became delinquent, the landlord sued for rent and possession. In defense the tenant asserted the illegality, and hence unenforceability, of the lease. The court agreed, l. c. 836-837:
It appears that the violations known by. . . (the landlord) to be existing on the leasehold at the time of the signing of the lease agreement were of a nature to make the "habitation" unsafe and unsanitary. . . The lease contract was, therefore, entered into in violation of the Housing Regulations requiring that they be safe and sanitary and that they be properly maintained.
. . . . . .
"[T]he general rule is that an illegal contract, made in violation of the statutory prohibition designed for police or regulatory purposes, is void and confers no right upon the wrongdoer."
. . . . . .
To uphold the validity of this lease agreement, in light of the defects known to be existing on the leasehold prior to the agreement . . . would be to flout the evident purposes for which (the housing regulations) were enacted. . . (and which) do indeed "imply a prohibition" as to render the prohibited act void.
See, also, Shephard v. Lerner, 182 Cal. App.2d 746, 6 Cal.Rptr. 433 (1960); Longenecker v. Hardin, supra, 264 N.E.2d l. c. 880 [6]. While the holding in Brown spoke in terms of the landlord's knowledge of violations at the time of letting, our law imposes no such requirement. Haggerty v. St. Louis Ice Mfg. & Storage Co., 143 Mo. 238, 44 S.W. 1114, 1116 (1898); Hall v. Bucher, 240 Mo.App. 1239, 227 S.W.2d 96, 98 [2] (1950).
The law will leave parties to an illegal agreement in the position in which they put themselves. State v. County of Camden, 394 S.W.2d 71, 78 [10, 11] (Mo.App.1965). The affirmative defense of the tenant-appellant, which pleads that the landlord-respondent leased to her premises in a condition of substantial violation of the housing code pleads a sufficient illegality of lease as a defense to the landlord's action for rent.
*79 The tenant-appellant does not seek recoupment of her performance under the illegal lease, nor any other affirmative relief, but only to defeat the landlord's claim for rent due and unpaid under the lease. We need not determine, therefore, whether the tenant was in pari delicto and if so whether considerations of public policy or equity require that relief be granted as against the illegal contract. Gardine v. Cottey, 360 Mo. 681, 230 S.W.2d 731, 740 [13] (banc 1950); Twiehaus v. Rosner, supra, 245 S.W.2d l. c. 112, 114 [10].
While the law denies the landlord who has leased premises in substantial violation of the housing code the consideration of his illegal bargain, sound public policy dictates that such a landlord may recover the reasonable value of the premises in its condition during occupancy. The same public policy which recognizes the implied warranty of habitability as a means of preserving housing for the rental market will deny a tenant the use and occupancy at no cost of a sub-habitable dwelling and thus deprive a landlord of his basic, and perhaps only, resource for restoration of the premises to habitability. The only court which has considered the question has allowed, as we do, recovery to a landlord for the reasonable value of the premises during occupancy by a tenant who entered into possession under a lease void and illegal because the premises were in substantial violation of the housing regulations. William J. Davis, Inc. v. Slade, 271 A.2d 412 (D.C.App.1970). This result proceeded from the "generally accepted view . . . that entry upon a premises under a void and unenforceable lease creates a tenancy at will" (Diamond Housing Corporation v. Robinson, 257 A.2d 492, 495 [7, 8] (D.C.App.1969), and since the law has accorded such a status, "[t]his tenancy, unlike the tenancy attempted by the lease, is legal" and the landlord is entitled to its reasonable value. Davis v. Slade, supra, 271 A.2d l. c. 416 [6]. The unenforceable lease which gives rise to a tenancy at will under the "generally accepted view", however, is one which is made void by a formal defectsuch as noncompliance with the requirements of the Statute of Fraudsand not where the consideration for the lease, the performance itself, is illegal and prohibited. Thompson on Real Property, § 1018; 6 A.L.R.2d 685, Annotation, Tenancy Under Void Lease. We prefer to base our decision openly on the hard reality that if, under existing conditions, landlords were deprived of all rents because of noncompliance with housing codes there would be far fewer low income housing units availablelandlords would find it to their economic advantage to abandon their properties rather than spend their separate resources to restore them to habitability. See, Samuelson v. Quinones, 119 N.J.Super. 338, 291 A.2d 580, 583 (1972).
Upon remand, the court will allow the landlord-respondent, if he should choose, to file a reply to the affirmative defense of illegality of contract to allege a claim for the reasonable value of the tenant's occupancy after May 6, 1969. We conclude also that the affirmative defense of illegality of lease is inconsistent with the affirmative defense of breach of the implied warranty of habitability of that lease. The first defense asserts the unenforceability of the contract and the second that a breach of a term of that contract is enforceable and should yield damages. The proof of one defense necessarily disproves the other, so the defenses are inconsistent. Payne v. White, 288 S.W.2d 6, 9 [7] (Mo.App.1956). A litigant may not pursue to judgment defenses which at once approbate and reprobate, affirm and disaffirm, a contract. Berger v. Mercantile Trust Company, 352 S.W.2d 644, 650 [6] (Mo.1961). Upon remand, the tenant-appellant will be put to her election between these defenses and will be permitted to follow only one of them to judgment.
*80 The judgment is reversed and remanded for proceedings consistent with our directions.
DIXON, C. J., and SWOFFORD and WASSERSTROM, JJ., concur.
PRITCHARD, J., concurs in result in separate concurring opinion filed.
PRITCHARD, Judge (concurring in result).
I concur in the result of the main opinion. It is sufficient to rely upon the more recent cases extensively cited, quoted and footnoted therein, and the statutes and ordinances cited. Those cases have long ago uniformly abrogated the common law doctrine of caveat emptor in the legal relationship between a landlord and his tenant, assuming that such old rule is the basis, which is not clear, that the trial court employed in striking appellant's affirmative defenses.
NOTES
[1]  The Housing Code, Chapter 20 of the Code of General Ordinances of Kansas City, Missouri, was repealed on October 15, 1971 and a new title adopted. The Property Maintenance Code, as Chapter 20 is now designated, encompasses the substance of the predecessor Housing Code, and in Section 20.2 asserts with renewed emphasis: "The purpose of this code is to provide minimum requirements for the protection of life, limb, health, property, safety, and welfare of the general public and the owners and occupants of residential and nonresidential buildings."
[2]  The other violations of the Housing Code alleged were lack of window screening, absence of bathroom venting, loose and insecure front porch column, defective trap under the kitchen sink, broken eaves, improper basement drainage and broken and defective basement steps. The provisions of the Housing Code violated were alleged to be sections 20.17, 20.19, 20.27, 20.29, 20.33 and 20.34.
[3]  The defense of illegality, incorporated by reference, also asserted that the defendant had requested, and the plaintiff promised but failed, to abate these conditions; that finally in May of 1969, defendant refused to make further payment of rent until the plaintiff complied, but plaintiff refused to do so throughout the remainder of defendant's occupancy. After inspection of the premises by the Housing Section of the City Health Department, on May 29, 1969, the Director of Health ordered plaintiff to correct these violations and when plaintiff failed to comply, on July 15, 1969, the Director issued first a preliminary order and then a final order requiring plaintiff to correct or abate the violations.
[4]  2 Pollock & Maitland, The History of English Law 131 (2d ed. 1923); Javins v. First National Realty Corporation, 428 F.2d 1071, 1077 (D.C.App.1970); Quinn & Phillips, The Law of Landlord-Tenant; A Critical evaluation of the Past With Guidelines for the Future, 38 Forham L. Rev. 225, 227-8 (1969).
[5]  Legal scholarship suggests that the doctrine of independence of covenants in the landlord-tenant law is an historical accident, that it developed before the contract principle of mutually dependent obligations was established. Lesar, Landlord and Tenant Reform, 35 N.Y.U.L.Rev. 1279 (1960); Williston, Contracts, § 890 at 585-8 (3rd ed. W. Jaeger 1962).
[6]  In O'Neil v. Flanagan, 64 Mo.App. 87 (1895) the tenant was not discharged from his obligation to pay rent although the building was destroyed by fire. In Burnes v. Fuchs, 28 Mo.App. 279 (1887) the obligation to pay rent was not discharged although the premises were in such deplorable condition as to be condemned by municipal authorities.
[7]  Hart v. Windsor, 12 M & W 68, 152 Eng.Rep. 1114, 1122 (1843); 1 American Law of Property, Secs. 3.47-3.58 at 271-284 (Casner ed. 1952).
[8]  1 American Law of Property, Sec. 3.50 at 278 (Casner ed. 1952).
[9]  See, also, Dyett v. Pendleton, 8 Cow. 727 (N.Y.1827) where the doctrine of constructive eviction was first articulated, l. c. 7.30, on the "universal principle in all cases of contract, that a party who deprives another of the consideration on which his obligation was founded, can never recover damages for its non-fulfillment".
[10]  Corbin on Contracts, § 686 (1960 ed.); Williston on Contracts, § 890 (3rd ed. Jaeger); Thompson on Real Property, § 1110 (1959 replacement).
[11]  Pines v. Perssion, 14 Wis.2d 590, 111 N.W.2d 409 (1961); Lemle v. Breeden, 51 Haw. 426, 462 P.2d 470 (1969); Marini v. Ireland, 56 N.J. 130, 265 A. 526 (1970); Javins v. First National Realty Corporation, 138 U.S.App.D.C. 369, 428 F.2d 1071 (1970); Amanuensis, Ltd. v. Brown, 65 Misc.2d 15, 318 N.Y.S.2d 11 (1971); Kline v. Burns, 276 A.2d 248 (N.H.1971); Mease v. Fox, 200 N.W.2d 791 (Iowa 1972); Hinson v. Delis, 26 Cal.App.3d 62, 102 Cal.Rptr. 661 (1972); Jack Spring, Inc. v. Little, 50 Ill.2d 351, 280 N.E.2d 208 (1972). See, also, 40 A.L.R.3rd 646, AnnotationModern Status of Rules as to Existence of Implied Warranty of Habitability or Fitness for Use of Leased Premises.
[12]  Gribetz and Grad, Housing Code Enforcement: Sanctions and Remedies, 66 Colum.L.Rev. 1254 at 1272-74 (1966).
[13]  E. g., Articles II, IV & V, Revised Ordinances of Kansas City (1898) and Article III, § 727, Revised Ordinances of St. Louis (1887). Such ordinances were construed to impose upon a landlord an obligation to the public authorities only. Thus, it was held in Burnes v. Fuchs, 28 Mo.App. 279 (1887), that the breach of a municipal ordinance which charged the owners of a dangerous building with the duty of repair was not available to a tenant as a defense to an action for rent. The court's holding, although only dictum, has been influential, l. c. 282:

We may add that the ordinance of the city of St. Louis, which charges the owners of dangerous buildings with the obligation to repair, can have no influence in the decision of this question. As between the owner and the city, the obligation under such a police regulation may well rest upon the owner; and yet, as between the owner and his tenant, the rule of the common law will prevail, which casts the obligation upon the landlord.
[14]  Gribetz & Grad, supra, note 12 at 1260-62.
[15]  The Housing Code was repealed by the City Council in 1971 and the Property Maintenance Code which has succeeded it is specifically referenced to the provisions of § 99.010 of the Revised Statutes of Missouri.
