
130 Ill. App.2d 468 (1970)
264 N.E.2d 878
A. Willard Longenecker, d/b/a Chicago Management Company, Plaintiff-Appellee,
v.
Herbert H. Hardin and Ether L. Hardin, Defendants-Appellants.
Gen. No. 54,401.
Illinois Appellate Court  First District, Fourth Division.
October 30, 1970.
*469 *470 Ron Fritsch, of Chicago, for appellants.
Alan Kawitt, of Chicago, for appellee.
MR. PRESIDING JUSTICE STAMOS delivered the opinion of the court.
Plaintiff recovered a judgment in the amount of $355 and costs against defendants for past due rent. Defendants appeal, and contend that the court erred in striking their two affirmative defenses.
On October 26, 1967, the parties executed a lease for the rental of an apartment from November 1, 1967, through October 31, 1968, for $115 a month.
In the latter part of April, 1968, plaintiff initiated a forcible entry and detainer action against defendants for possession of the apartment and on May 10, 1968, the court entered judgment for possession but stayed the issuance of the writ of execution until May 25, 1968, on which day defendants vacated the premises.
Later in the year, plaintiff initiated another action, judgment by confession, as provided for in the lease and alleged that the sum of $470 was due and unpaid for rents, and that plaintiff was also entitled to $14.10 interest and $80.12 in attorneys fees for a total of $564.22. Defendants upon being served with summons to confirm the judgment responded and interposed two affirmative defenses.
Defendants' first affirmative defense was that the parties agreed to cancel the lease as evidenced by the written expression on the face of the lease which provided, "May 10, 1968, lease cancelled by agreement, Chgo. Mgmt. Co., by Moe M. Forman, its atty." Defendants alleged that plaintiff by his attorney promised to relinquish, waive, surrender and release all rights accruing to him under the lease, in return for defendants' promise to vacate the premises within 15 days and to forbear any contest of plaintiffs' action for possession. Defendants further allege that they performed in conformance with their part of the bargain.
Defendats' second affirmative defense was that the lease was invalid and unenforceable in light of sections 78-13 and 78-17 of the Municipal Code of the City of
*471 Chicago. Section 78-13 provides:
"No person shall occupy as owner-occupant, nor shall any person let or hold out to another for occupancy, any dwelling or family unit which does not comply with the requirements of section 78-13.1 through 78-13.12 of this chapter."
Section 78-17 provides:
"No person shall occupy as owner-occupant or shall let or hold out to another for occupancy any dwelling or family unit, for the purpose of living therein, which is not safe, clean, sanitary and fit for human occupancy, and which does not comply with the particular requirements of sections 78-17.1 through 78-17.8 of this chapter."
Defendants specifically alleged that the premises were in violation of sections 78-13.1 (Water closet), 78-13.6 (Maintenance of sanitary facilities), 78-13.8 (Heat to be furnished, 78-13.11 (Hot water to be furnished), 78-17.1 (Foundations, exterior walls and roofs  maintenance), 78-17.2 (Floors, interior walls and ceilings  maintenance), 78-17.3 (Windows, doors and hatchways  maintenance), 78-17.5 (Stairways and porches  maintenance), and 78-17.7 (Facilities, equipment, chimneys  maintenance).
Plaintiff moved to strike both affirmative defenses. The court granted plaintiff's motion and the cause proceeded to trial. Plaintiff was awarded judgment in the amount of $355 and costs, representing the rent due for the months of March, April and May, 1968, and the unpaid portion of the rent due from February. Defendants appeal from this judgment.
Defendants initially contend that their first affirmative defense was improperly stricken. However, plaintiff maintains that this first affirmative defense was properly stricken because: (1) an attorney retained to prosecute a single action for possession has no authority to compromise his client's rights as to past or future rent due under the leasing agreement and (2) there was no consideration for the extinguishment of the past due rent.
*472 [1, 2] Plaintiff correctly recites an abstract proposition of law regarding the implied authority of a lawyer retained to prosecute an action for possession, but defendants allege that counsel, in fact, did act within the scope of his authority in the case at bar in entering into this agreement on behalf of his client. We hold that defendants should have been afforded the opportunity to adduce evidence on this issue.
[3] With regard to plaintiff's contention as to the failure of consideration, defendants' promise to vacate the premises within 15 days and to forbear any contest of plaintiff's action for possession was sufficient consideration to support plaintiff's promise to surrender and release defendants from all past due rent. Bloomquist v. Johnson, 107 Ill. App. 154.
Therefore, we conclude that the court erred in striking defendants' first affirmative defense.
Defendants next contend that their second affirmative defense was improperly stricken. However, plaintiff maintains that this second affirmative defense was properly stricken because: (1) defendants were barred by the doctrine of laches, (2) defendants were precluded by a provision of the lease from asserting violations of the Municipal Code of the City of Chicago, and (3) such alleged violations would not relieve a tenant from the obligation to pay rent while the tenant remained in possession.
[4] Initially, we note that plaintiff failed to raise his contention of laches in the court below. Therefore, it will not be considered by this court for the first time on appeal.
[5] Plaintiff also argues that the lease contained the following provision, which allegedly deprives defendants of any standing to assert that the premises were in violation of the cited sections of the Municipal Code of the City of Chicago:
"Condition of Premises. Lessee has examined said premises and appurtenances prior to execution hereof, and is satisfied with the physical condition thereof, and his execution hereof shall be conclusive evidence *473 of his acknowledgment thereof in good order and repair, except as otherwise specified hereon (there were no exceptions stated, however) and agrees that no representation as to condition or repair has been made by Lessor or Lessor's Agent not contained herein, and that no promise to decorate, alter, repair, or improve, either before or at the execution hereof, not contained herein, has been made by Lessor or his agent."
This provision cannot preclude the interposition of the doctrine of illegality of the lease. In Estate of Smythe v. Evans, 209 Ill. 376, 70 NE 906 (1904), at page 383, the court said:
"The great weight of authority is that where a party comes into court seeking to enforce a contract which is against public policy or is prohibited by public law, the court will refuse to aid either party and will leave them where they have placed themselves, and in refusing to enforce such contracts the court does not act for the benefit, or for the preservation of the alleged rights, of either party, but in the maintenance of its own dignity, the public good and the laws of the State." Cases Cited).
[6] Furthermore, the court should have considered the issue of illegality even if it had not been specifically raised, as it was, in defendants' pleading. In Huszagh v. City of Oakbrook Terrace, 41 Ill.2d 387, 243 NE2d 831 (1968) at page 389, the court expressed the prevailing rule:
"Where a court is called upon to enforce a contract, the matter of its illegality may be inquired into whether or not it is set up as a defense in the answer." (Cases Cited.)
Plaintiff's next point is that violations of the Housing Code will not relieve a tenant from the obligation to pay rent while the tenant remains in possession. This argument is based upon the doctrine of constructive eviction. However, the allegations of defendants' second *474 affirmative defense are not directed to the doctrine of constructive eviction but rather to the invalidity of the leasing agreement itself in light of the city ordinances.
[7] The effect of statutory prohibitions in contractual relationships was dealt with in Ideal Bldg. Material Co. v. Benson Concrete Co., 273 Ill. App. 519 (1934) wherein the court stated at page 525;
"The general rule appears to be that any act forbidden by statutory law, if passed for the protection of the public and which provides for a penalty, cannot be the foundation of a valid contract. It is not essential that the act provided directly that such agreement be void, but it becomes so by reason of the fact that it is in violation of a prohibited act and is, therefore, illegal and unenforceable in and of itself. An act may be rendered illegal either by express prohibition or the imposition of a penalty as in the case at bar."
Section 78-11 of the Municipal Code of the City of Chicago declares the purposes of the Housing Code and Specific Findings of the Chicago City Council.[*] The *475 purposes of the Code were also discussed in Gula v. Gawel, 71 Ill. App.2d 174, 218 NE2d 42 (1966) and at page 183, the court stated:
"We have examined the Chicago Housing Code in detail and in our opinion it is a public safety measure. The City Council declared its purpose to be the protection of the `public health, safety, comfort, morals and welfare of the people of the city of Chicago' (section 78-11), and no argument has been advanced here (nor in the case at bar) to challenge the findings of the Council that substandard dwellings affect public health and safety. The provisions of the Housing Code concern themselves to a large extent with the condition of premises leased to tenants, and the condition of such premises has an obvious connection with the health and safety of the tenant-occupant. A tenant is clearly within the class of persons designed to be benefitted and protected by the Code."

*476 "Further, the Housing Code represents a significant change from common-law standards. At common law, there was no prohibition against letting a tumble-down house. (1 Tiffany, Landlord and Tenant, sec 86 at 557 (1910)); Koenigshofer v. Shumate, 68 Ill. App.2d 474, 216 NE2d 195 (1966)."
Violations of Chapter 78 render the party liable for penalties as provided for in section 78-20.
Therefore, the provisions of the Chicago Housing Code fall within that class of statutory law outlined in Ideal, supra.
Such violations of statutory law have been held to invalidate a lease like the one in Heineck v. Grosse, 99 Ill. App. 441 (1902). In that case, the court held that a lease executed in violation of an ordinance prohibiting the occupancy of part of a sidewalk for private purposes is invalid and could not be made the basis of an action for recovery of rent. At page 444, the court stated:
"Moreover, the lease is in direct violation, so far as it provides for the occupancy of a portion of the sidewalk, of the municipal ordinances above set out, and is therefore invalid. Being invalid as to a part of the lease, because of its violation of the city ordinances, it can not be the basis of a recovery in this suit. Estate of Ramsey v. Whitbeck, 183 Ill. 550-65, and cases cited: Shortall v. Fitzsimons & C. Co., 93 Ill. App. 231-4, and cases cited."
Similarly, in Western Cold Storage Co. v. Estate of Kaufman, 204 Ill. App. 477 (1917) the court held that a contract for storage charges upon decayed and unwholesome fruit and vegetables was unenforceable because its terms violated the city ordinances which prohibited the storing of condemned produce and provided a penalty therefor.
In Brown v. Southall Realty Co., 237 A2d 834 (1968), the District of Columbia Court of Appeals held that where at the time of execution of the lease the premises were in violation of the Housing Code rendering habitation unsafe and unsanitary, the lease was void and the tenant was absolved of liability for rent. The District of Columbia Housing Code in that case provided:

*477 "No persons shall rent or offer to rent any habitation, or the furnishings thereof, unless such habitation and its furnishings are in a clean, safe and sanitary condition, in repair, and free from rodents or vermin."
We note that this ordinance is similar to sections 78-13 and 78-17 of the City of Chicago Municipal Code.
[8] Therefore, we find that the trial court erred in striking the second affirmative defense. Defendants should have the opportunity to present evidence to show that the premises were in substantial violation of an ordinance cited by defendants.
Therefore, the judgment and the order striking defendants' affirmative defenses are reversed and the cause remanded for proceedings not inconsistent with the views herein expressed.
Reversed and remanded.
DRUCKER and ENGLISH, JJ., concur.
NOTES
[*]   Housing Code  Regulations for Buildings Used for Housing in Chicago.

(Declaration of policy.)
78-11. The purpose of this ordinance is to protect public health, safety, comfort, morals and welfare of the people of the city of Chicago, by enacting a housing code which establishes for all buildings used for housing:
(a) Minimum standards for cooking, heating and sanitary equipment necessary and expedient to promote health, suppress disease and protect safety of occupants of such buildings, and of neighboring properties;
(b) facilities for ventilation, light, space and means of egress which promote health and preserve safety;
(c) minimum standards of maintenance and responsibilities of owners, operators and occupants of dwellings for such maintenance which promote health and safety and aid in the enforcement of such standards;
(d) minimum standards essential to health, safety and welfare which are uniform in application to all dwellings whenever constructed so that with the resulting uniformity, simplicity and certainty, owners, operators and tenants are better able to determine the applicability of the law to them and the laws applicable to housing are administratively more convenient to enforce.
the city council finds that
(a) there exist in the city numerous dwellings which are substandard in one or more important features of structure, equipment, maintenance and occupancy;
(b) such conditions adversely affect public health and safety;
(c) such conditions contribute to the rapid deterioration and declining desirability of many residential areas of our city and tend to produce blight and slums;
(d) such conditions conflict with and destroy programs of this city under the Urban Community Conservation Act, as amended, and other acts of the State of Illinois designed to prevent slums and conserve residential areas;
(e) adequate protection of public health, safety, comfort and welfare and the maintenance of a workable program for prevention of slums and conservation of our city require the establishment and enforcement of minimum housing standards applicable to all dwelling units in this city;
(f) healthful and sanitary conditions in relation to space, use and arrangement of rooms generally prevail in single-family dwellings occupied by an owner and his family.
