
332 S.E.2d 521 (1985)
James L. SARTIN, Jr. d/b/a United Construction
v.
Dewey G. CARTER and Gail M. Carter.
Dewey G. CARTER and wife, Gail M. Carter
v.
James L. SARTIN, Jr. d/b/a United Construction, United Construction Company, and Berwick Development Corporation.
No. 8415SC1277.
Court of Appeals of North Carolina.
August 6, 1985.
*523 Holt, Spencer, Longest & Wall by Frank A. Longest, Jr., for appellant James L. Sartin, Jr.
Nichols, Caffrey, Hill, Evans & Murrelle by Lindsay R. Davis, Jr. and Martha T. Peddrick, for appellees Dewey G. Carter and Gail M. Carter.
MARTIN, Judge.
The question presented by this appeal is whether the trial court erred in granting the Carters' motion for summary judgment, dismissing Sartin's claims in no. 80CVS1135 and his counterclaims in no. 80CVS1013. We hold that it did not. G.S. 1A-1, Rule 56(c) permits the granting of summary judgment "if the pleadings, depositions, answers to interrogatories, and admissions on file, together with the affidavits, if any, show that there is no genuine issue as to any material fact and that any party is entitled to a judgment as a matter of law."
Sartin first contends that the entry of summary judgment for the Carters was error because a genuine issue of fact exists with respect to the amount which he is entitled to recover for work performed while he was duly licensed. He argues that, unlike the unlicensed contractor in Brady v. Fulghum, 309 N.C. 580, 308 S.E.2d 327 (1983) who was found to have no right to recover under the construction contract entered by him, he is entitled to recover some amount under the contract because he was licensed when the contract was entered.
In Brady, the Supreme Court adopted the rule that a contract illegally entered into by an unlicensed general construction contractor is unenforceable by the contractor and cannot be validated by the contractor's subsequent procurement of a license. Id. at 586, 308 S.E.2d at 331. The court also addressed a contractor's right to recover in a situation such as the present one, stating as follows:
[I]f a licensed contractor's license expires, for whatever reason, during construction, he may recover for only the work performed while he was duly licensed. If, in that situation, the contractor renews his license during construction, he may recover for work performed before expiration and after renewal. If, by virtue of these rules, harsh results fall upon unlicensed contractors who violate our statutes [G.S. 87-1, et seq.], the contractors themselves bear both the responsibility and the blame.
Brady, 309 N.C. at 586, 308 S.E.2d at 332.
The materials submitted by the Carters in support of their motion affirmatively show that Sartin was licensed when he began construction on 10 October 1978, that his license expired on 31 December *524 1978 pursuant to G.S. 87-10, that he was not licensed at any time thereafter while performing under either the original contract or the settlement agreement, and that he was fully paid for the work performed between 10 October 1978 and 31 December 1978. The record contains no forecast of evidence by Sartin to the contrary. It appears from these undisputed facts that Sartin has been paid for all work performed while he was licensed. Thus, as a matter of law, he is not entitled to recover any further amounts for work performed in constructing the improvements for the Carters. See Brady, supra. For this reason, we find Sartin's argument meritless.
Sartin next contends that the Carters were not entitled to summary judgment on his claims because a genuine issue of fact exists concerning his right to recover under the "Agreement and Mutual Release" executed by the parties. He argues that this agreement is a compromise and settlement agreement and therefore operates as a merger of the antecedent claims included therein, and that the Carters, by signing the settlement agreement and accepting its benefits waived all other claims and defenses they may have had against him including the defense of his failure to comply with the licensing requirements.
Although the law favors the resolution of disputes through compromise and settlement, see Dixie Lines v. Grannick, 238 N.C. 552, 78 S.E.2d 410 (1953), it is the policy of the law to uphold and enforce compromise and settlement agreements only if they are fairly made and are not in contravention of some law or public policy. See 15A Am.Jur.2d Compromise and Settlement Sec. 5, at 777 (1976). If a settlement agreement is based on an antecedent claim or transaction which is undisputedly illegal or contrary to public policy, the agreement is considered invalid on the ground of illegality as well as a lack of consideration. 15A Am.Jur.2d Compromise and Settlement Sec. 28, at 800 (1976). Commonly, such agreements are said to be contrary to public policy instead of, or in addition to, being called illegal. Id. at note 53. Courts generally will not permit the law or any judicial machinery to be used in assisting the enforcement of such an agreement, nor will it permit a party to maintain an action founded on the agreement. 15A Am.Jur.2d Compromise and Settlement, Sec. 28, at 801. The usual effect of invalidation of a settlement agreement is to restore the parties to their antecedent positions. Id. at Sec. 40.
G.S. 87-13 makes it a misdemeanor for one to practice or attempt to practice general contracting in this state while not licensed in accordance with G.S. 87-1, et seq., or while using an expired license. The work performed by Sartin for the Carters for which he seeks recovery was performed while his license was expired and thus was performed illegally. Accordingly, it would be contrary to public policy to allow him to recover for such work. See Brady v. Fulghum, supra. Since Sartin's claims are based on illegal conduct and thus are contrary to public policy, the settlement agreement entered into by the parties based on those claims is invalid. Thus, Sartin can not recover under that agreement.
We conclude as a matter of law that Sartin has no right to recover any additional monies from the Carters for work performed by him, under the original contract or the "Agreement and Mutual Release," in constructing the residence. Therefore, the trial court correctly entered summary judgment for the Carters on Sartin's claims and counterclaims. We note, however, that although Sartin has no right to affirmatively recover on his claims and counterclaims, he may offset, as a defense against sums due the Carters, any amounts that would otherwise be due him under their agreements so as to reduce in whole or in part their claims against him. See Builders Supply v. Midyette, 274 N.C. 264, 162 S.E.2d 507 (1968); Helms v. Dawkins, 32 N.C.App. 453, 232 S.E.2d 710 (1977), overruled on other grounds, 311 N.C. 717, 319 S.E.2d 607 (1984).
Affirmed.
ARNOLD and PARKER, JJ., concur.
