
521 So.2d 24 (1988)
Jimmy BROWN, d/b/a Brown's Ready Mix
v.
MOUNTAIN LAKES RESORT, INC.
86-1324.
Supreme Court of Alabama.
February 5, 1988.
John C. Gullahorn of Gullahorn & Hare, Albertville, for appellant.
Ralph Smith, Jr., Guntersville, for appellee.
BEATTY, Justice.
Appeal by Jimmy Brown, d/b/a Brown's Ready Mix, from a judgment in favor of Mountain Lakes Resort, Inc., in the latter's action for a declaratory judgment under a construction contract. We affirm.
Mountain Lakes Resort, Inc. ("Mountain Lakes"), contracted with Herman Lovell, d/b/a M & H Home Repair, for Lovell to *25 do certain construction work. Lovell was to furnish all labor, materials, and equipment for the job and was to receive $37,550 for his work. During the performance of this contract, Lovell ordered materials from Brown's Ready Mix, but did not pay for them, or for certain materials from other suppliers, whereupon Mountain Lakes refused to make any further payments to Lovell.
Brown's Ready Mix, after notifying Mountain Lakes of the amount owed to it, filed a lien on the real property of Mountain Lakes, which, under Code of 1975, § 35-11-210, extended "only to the amount of any unpaid balance due the contractor by the owner."
Thereafter, Mountain Lakes filed a declaratory judgment action, seeking to have the trial court declare "the rights of the respective parties ... under the contract." Brown's Ready Mix, one of the parties, answered, counterclaimed against Mountain Lakes, and cross-claimed against Lovell. The plaintiff, Mountain Lakes, answered the counterclaim of Brown's Ready Mix with a general denial.
During the ensuing trial, Mountain Lakes sought to elicit testimony as to whether Lovell was an unlicensed general contractor. This evidence was objected to by Brown's Ready Mix on the ground that such a defense would constitute an affirmative defense under Rule 8(c), A.R.Civ.P., and that this defense had not been specially pleaded. At that time, the trial court stated that the matter would not be considered if it was an affirmative defense. At that time, additionally, plaintiff, Mountain Lakes, offered plaintiff's Exhibit G as evidence, which was duly admitted. This exhibit was the business license of M & H Home Repair issued by DeKalb County for the year 1985-86, the only license offered by Lovell as his authorization to engage in business as a general contractor. At the conclusion of the trial, the trial court found that the validity of the contract had been placed in issue by the complaint, which sought a declaration of the contract rights; that the issue of proper licensing had been raised; that Lovell was a general contractor as defined by statute; that the costs of construction exceeded $20,000; and that Lovell was not licensed as required by law. Having so found, the trial court found that the contract between Mountain Lakes and Lovell was null, void, and unenforceable, and, therefore, that no unpaid balance under the contract was due Lovell from plaintiff, and, thus, that there was no unpaid balance that could be recovered by Brown's Ready Mix.[1] See § 35-11-210.
The issue presented on appeal is whether the defense that Lovell, d/b/a M & H Home Repair, was not a licensed general contractor, as he was required to be by Code of 1975, § 34-8-1 et seq., was an affirmative defense that was required under Rule 8(c), A.R.Civ.P., to be pleaded thereunder, and whether the failure to affirmatively plead that defense was a failure to place it in issue, thus foreclosing the court's consideration of it in arriving at a judgment.
The requirements of the licensing provisions of § 34-8-1 are penal in nature and express a firm public policy of this state to guard our citizens "against incompetent contractors for certain-type structures, and also to better assure properly constructed structures which [are] free from defects and dangers to the public." Cooper v. Johnston, 283 Ala. 565, 567, 219 So.2d 392 (1969), quoted in Hawkins v. League, 398 So.2d 282 (Ala.1981). Thus, contracts of unlicensed general contractors have been held null and void as a violation of that public policy. Cooper v. Johnston, supra.
Rule 8(c), A.R.Civ.P., on pleading affirmative defenses, reads:
"In pleading to a preceding pleading, a party shall set forth affirmatively accord and satisfaction, arbitration and award, assumption of risk, contributory negligence, discharge in bankruptcy, duress, estoppel, failure of consideration, fraud, illegality, injury by fellow servant, laches, *26 license, payment, release, res judicata, statute of frauds, statute of limitations, waiver, and any other matter constituting an avoidance or affirmative defense." (Emphasis added.)
Thus, the question becomes whether the defense in question falls within the meaning of the terms "illegality" or "any other matter constituting an avoidance or affirmative defense" so as to make a failure to plead it a waiver, thus foreclosing its consideration.
On that issue, it was recognized by the late eminent Chief Justice Anderson in Shearin v. Pizitz, 208 Ala. 244, 246, 94 So. 92 (1922), that:
"It is the rule ... in Alabama and a few other jurisdictions to not enforce a contract in violation of the law and to deny the plaintiff the right to recover upon a transaction contrary to public policy, even if the invalidity of the contract or transaction be not specially pleaded and is developed by the defendant's evidence."
In that case, the defense pleaded the general issue, not a special plea of illegality, and this Court held it to be a sufficient plea under which to prove that defense. The same result was reached in National Life & Accident Ins. Co. v. Middlebrooks, 27 Ala.App. 247, 170 So. 84 (1936), in holding void a contract of insurance taken out by one having no insurable interest:
"Perhaps we should here observe that it is the settled law of this state that the defendant (appellant here) `may under the general issue impeach the validity of the contract sued on by proof of facts which show that the contract as a whole is void because [it is] contrary to public policy.' Fidelity-Phenix Fire Ins. Co. of New York v. Murphy, 226 Ala. 226, 146 So. 387, 389. Or, as stated by Mr. Chief Justice Anderson for the Supreme Court in his opinion in the case of Shearin v. Pizitz, 208 Ala. 244, 94 So. 92, `It is the rule * * * in Alabama and a few other jurisdictions to not enforce a contract in violation of the law and to deny the plaintiff the right to recover upon a transaction contrary to public policy, even if the invalidity of the contract or transaction be not specially pleaded and is developed by the defendant's evidence.'"
That is precisely the posture of this case. Mountain Lakes pleaded a general denial and developed the evidence of Lovell's contravention of the statutory licensing requirements. Considering the fact that the requirements of the statute are penal in nature, reflecting a strong public policy as recognized by the legislature in favor of the public at large, we find that, as those earlier cases held, this illegality was placed in issue by the defendant's general denial which itself put into question the validity of the contract. Surely such contracts can find no sanction, and thus be enforceable, simply because of a failure to plead them specially, when their validity is attacked by a plea of general denial. To hold otherwise would, as is obvious, subvert a strong public policy intended to protect our citizens, by a procedural rule. We cannot interpret Rule 8(c) in such a manner as to create an injustice to one of the public for whom the protection of the statute was created. See Rule 1(c), A.R.Civ.P.
Let the judgment be affirmed.
AFFIRMED.
TORBERT, C.J., and MADDOX, ALMON and HOUSTON, JJ., concur.
NOTES
[1]  The trial court did award judgment to Brown's Ready Mix against Lovell, d/b/a M & H Home Repair.
