
678 So.2d 765 (1996)
Donald F. PIERCE
v.
HAND, ARENDALL, BEDSOLE, GREAVES & JOHNSTON, a partnership.
HAND, ARENDALL, BEDSOLE, GREAVES & JOHNSTON, a partnership
v.
Donald F. PIERCE.
1940876, 1940919.
Supreme Court of Alabama.
May 10, 1996.
*766 James R. Pratt III of Hare, Wynn, Newell and Newton, Birmingham, Richard F. Ogle of Schoel, Ogle, Benton and Centeno, Birmingham, for appellant/cross appellee Donald F. Pierce.
A. Danner Frazer, Jr. of Frazer, Greene, Philpot & Upchurch, Mobile, for appellee/cross appellant Hand, Arendall, Bedsole, Greaves & Johnston.
SHORES, Justice.
This case involves a dispute between Donald F. Pierce and the law firm of Hand, Arendall, Bedsole, Greaves & Johnston ("Hand-Arendall"), of which Pierce was formerly a partner. After he withdrew from the firm, Pierce sued for a declaratory judgment, asking the court to define his rights to deferred compensation under Paragraph 13 of the partnership agreement. The trial court held that Pierce was not entitled to deferred compensation because, it held, Paragraph 13 was void. Pierce appealed; Hand-Arendall cross appealed, contending that DR 2-109, Alabama Code of Professional Responsibility, applicable when the contract was entered,[1] created an exception to the general prohibition against noncompetition covenants between professionals codified in § 8-1-1, Ala.Code 1975. We reverse and remand.
Pierce joined the Hand-Arendall firm in 1959 and became a partner on January 1, 1963. Pierce turned 60 on August 28, 1990. In December 1990 he announced his intention to withdraw from the firm effective December 26, 1990. He withdrew and began a new law firm under the name Pierce, Carr & Alford on January 1, 1991.
The Hand-Arendall partnership agreement was signed in 1977 and was amended *767 January 1, 1988. It contains as paragraph 13 the following provision:
"13. Retirement on or after Age Sixty: Upon reaching the age of sixty years, and at any time thereafter, a Partner may withdraw or retire from the Partnership by giving written notice to the partnership to such effect, but any such withdrawal or retirement shall be a retirement for the purposes of this Agreement. If any retired Partner discontinues the practice of law in Mobile, Baldwin and Washington Counties, Alabama and otherwise within fifty miles of Mobile (other than a practice restricted to his own and his family's interests), then so long as such discontinuance of his law practice continues, he and his estate shall be entitled to deferred compensation in an amount equal to what he would have received had he died at the time of his retirement. Such amount, other than his share of net profits, which shall be payable within ten days after his retirement, shall be payable in ten equal consecutive annual installments, the first of which shall be payable at the same time as his share of net profits. The Partnership may, by agreeing with the retired Partner or his estate, as the case may be, pay such deferred compensation over a shorter period of time...."
Hand-Arendall paid Pierce $17,452.83 as payment for his depreciated capital account and $21,843.39 as his distribution of net profits. Pierce claimed deferred compensation benefits in the amount of $225,000, pursuant to Paragraphs 11 and 13 of the partnership agreement. Hand-Arendall denied Pierce those benefits, on the grounds that he had not discontinued the practice of law in the Mobile area and had thus violated the terms of the agreement.
Pierce sued for a declaratory judgment, contending that the obligation not to compete in the Mobile area was void under § 8-1-1, Ala.Code 1975, as against public policy, but that paragraph 13 was otherwise legal. After a nonjury trial, the judge held:
"1) Paragraph 13 of the Partnership Agreement constitutes an impermissible restraint on Plaintiff's right to practice law.
"2) The conduct of the plaintiff renders his assertion to the right to financial recovery contrary to the established rules of equity. "3) Since Paragraph 13 of the Agreement is invalid, the plaintiff cannot recover under its provisions."
While there is a presumption of correctness for factual findings made by the trial court in a nonjury trial, there is no presumption of correctness for legal conclusions. Borland v. Sanders Lead Co., 369 So.2d 523, 526 (Ala.1979). We first consider whether the trial court misapplied the law in holding that Paragraph 13 of the partnership agreement constitutes an impermissible restraint on Pierce's right to practice law and that Paragraph 13 is invalid in its entirety.
As the trial court correctly stated, "Alabama recognizes a strong public policy favoring a general prohibition against contracts which restrain one from exercising a lawful profession, and non-compete covenants are routinely declared invalid by our courts." Section 8-1-1(a) provides that "every contract by which anyone is restrained from exercising a lawful profession, trade or business of any kind other than is provided by this section is to that extent void." The trial court expressly found that the noncompetition language in Paragraph 13 creates a significant economic disincentive that impermissibly restrains Pierce's right to practice law.[2] We agree. However, it does not follow, as the trial court held, that the entirety of Paragraph 13 is thus void and unenforceable under § 8-1-1.
It is clear from the wording of the statute itself and from the holdings of this Court that under § 8-1-11(a) a noncompetition contract provision is only "void" only to "that extent" prohibited by § 8-1-1(a). Mann v. Cherry, Bekaert & Holland, 414 So.2d 921, 924 (Ala.1982). The fact that a promise not to compete is included in a contract does not necessarily render void the entire contract. "The contract remains otherwise valid." Salisbury v. Semple, 565 So.2d 234, 236 (Ala.1990), citing Mann v. *768 Cherry, Bekaert & Holland, supra. In Mann, this Court considered a contract for the purchase and sale of an accounting practice; the contract contained mutual noncompetition covenants. The purchaser stopped making payments to the seller after concluding that the covenants not to compete rendered the contract void. This Court held that the buyer, who had received all he had bargained for, should not be allowed to use the unenforceability of the noncompetition clause to avoid his contractual obligations. Mann at 925.
In the case of Friddle v. Raymond, 575 So.2d 1038 (Ala.1991), two veterinarians entered into a buy-sell agreement that provided that Raymond, the seller, would not compete within six miles for three years. The agreement provided that if Raymond competed, he would forfeit the payments due him, treating the forfeiture as the payment of liquidated damages. This Court struck down the forfeiture provision as being an effort to circumvent the prohibitions of § 8-1-1(a). In the case before us, only the noncompetition provision in Paragraph 13 is void. The trial court misapplied the law in holding Paragraph 13 to be void in its entirety.
We next consider whether the trial court erred in holding that Pierce is equitably estopped from asserting his claim to deferred compensation under the partnership agreement. The purpose of the doctrine of equitable estoppel is to promote equity and justice in an individual case by preventing a party from asserting rights under a general rule of law when his own conduct renders the assertion of such rights contrary to equity and good conscience. Mazer v. Jackson Ins. Agency, 340 So.2d 770 (Ala.1976). The party asserting the doctrine of equitable estoppel may not predicate his claim on his own dereliction of duty or wrongful conduct. Draughon v. General Finance Credit Corp., 362 So.2d 880, 884 (Ala.1978).
This Court, in Mazer v. Jackson Ins. Agency, supra, set forth the basic elements necessary to support an equitable estoppel:
"The basic elements of equitable estoppel are stated in Dobbs, Remedies § 2.3 (1973):
`An estoppel ... has three important elements. The actor, who usually must have knowledge of the true facts, communicates something in a misleading way, either by words, conduct or silence. The other relies upon that communication. And the other would be harmed materially if the actor is later permitted to assert any claim inconsistent with his earlier conduct.'
"A more detailed statement of the elements generally required to support an equitable estoppel is given in 3 Pomeroy, Equity Jurisprudence § 805 (5th ed. 1941):
"`... 1. There must be conduct acts, language or silenceamounting to a representation or a concealment of material facts. 2. These facts must be known to the party estopped at the time of his said conduct, or at least the circumstances must be such that knowledge of them is necessarily imputed to him. 3. The truth concerning these facts must be unknown to the other party claiming the benefit of the estoppel, at the time when such conduct was done, and at the time when it was acted upon by him. 4. The conduct must be done with the intention, or at least with the expectation, that it will be acted upon by the other party, or under such circumstances that it is both natural and probable that it will be so acted upon.... 5. The conduct must be relied upon by the other party, and, thus relying, he must be led to act upon it. 6. He must in fact act upon it in such a manner as to change his position for the worse; in other words, he must so act that he would suffer a loss if he were compelled to surrender or forgo or alter what he has done by reason of the first party being permitted to repudiate his conduct and to assert rights inconsistent with it....'"
340 So.2d at 773. See General Elec. Credit Corp. v. Strickland Div. of Rebel Lumber Co., 437 So.2d 1240 (Ala.1983). The trial court failed to address these elements, although it cited Mazer as justification for its legal conclusion that Pierce was equitably estopped from recovering.
*769 This Court has carefully examined the record and finds it clear that the trial court did not correctly apply to the relevant facts the law of Alabama as it relates to the propriety of invoking the doctrine of equitable estoppel. The Hand-Arendall firm drafted the noncompetition provisions into the partnership agreement, which was signed by the parties in 1977. Thus, Hand-Arendall, the party asserting the doctrine of equitable estoppel, is predicating its claim on its own wrongful conduct. It is not permitted to do so. Draughon v. General Finance Credit Corp., supra. There is no evidence that there was any conduct on the part of Pierce amounting to a representation or a concealment of material facts or indicating that he knew of the invalidity of Paragraph 13 when he signed the partnership agreement in 1977. He was not a senior partner instrumental in drafting a restrictive agreement and imposing it on his fellow partners; he was merely one of 22 persons signing the agreement.[3] In fact, Pierce testified that at the time of the meetings with the other lawyers in October and November 1990 he still thought that Paragraph 13 was enforceable. Thus, the trial court erred in holding that Pierce was equitably estopped from asserting his rights under the partnership agreement.
We must then determine whether the trial court erred in concluding that Pierce was forbidden from seeking the deferred compensation, on the basis that he was in pari delicto, or equally culpable with Hand-Arendall in the creation of an illegal agreement. The trial court so held, acknowledging that Hand-Arendall had never raised the doctrine of in pari delicto, an affirmative defense, in its pleadings.[4] Instead, the trial court cited four cases that it said hold that the application of the doctrine of in pari delicto is "a matter peculiarly within the discretion of the trial court." We do not agree that those cases so hold. Rule 8(c), A.R.Civ.P., provides that any matter constituting an avoidance or affirmative defense must be pleaded in a timely manner or else it is deemed waived. Giles v. Ingrum, 583 So.2d 1287 (Ala.1991). This Court has stated that the doctrine of in pari delicto is an affirmative defense. Boykin v. Magnolia Bay, Inc., 570 So.2d 639 (Ala.1990); see also N. DeWayne Pope, "A Practitioner's Guide to Affirmative Defenses in Alabama," 57 Ala. Lawyer 86 (March 1996).
Finally, on its cross appeal, Hand-Arendall contends that DR 2-109, Alabama Code of Professional Responsibility, created an exception to the § 8-1-1 general prohibition of noncompetition covenants between professionals, and it contends that the trial court erred in holding that the partnership agreement does not truly concern retirement benefits in the manner contemplated by DR 2-109. DR 2-109(A) read, in pertinent part:
"A lawyer shall not be a party to or participate in a partnership or employment agreement with another lawyer that restricts the right of a lawyer to practice law after the termination of a relationship created by the agreement, except as a condition to payment of retirement benefits."
Does this disciplinary rule allow Hand-Arendall to escape payment of deferred compensation to this former partner? We reject the contention that it does so. First, as the trial court held, Paragraph 13 of the partnership agreement does not "truly concern retirement benefits in the manner contemplated" by DR 2-109(A); second, such a result would violate § 8-1-1, Ala.Code 1975.
While no Alabama precedent interprets similar noncompetition provisions in the context of DR 2-109, other jurisdictions have considered such economic-forfeiture-upon-competition provisions in the context of similar rules of professional conduct. Those jurisdictions, relying on a strong public policy against contracts that limit the right of professionals to compete, have prohibited law firms from relying on the forfeiture-upon-competition language of partnership agreements as an excuse not to pay deferred benefits such as those claimed in this case. Jacob v. Norris, McLaughlin & Marcus, 128 *770 N.J. 10, 607 A.2d 142 (1992); Cohen v. Lord, Day & Lord, 75 N.Y.2d 95, 551 N.Y.S.2d 157, 550 N.E.2d 410 (1989); Anderson v. Aspelmeier, 461 N.W.2d 598 (Iowa 1990); Spiegel v. Thomas, Mann & Smith, P.C., 811 S.W.2d 528 (Tenn.1991). The Supreme Court of New Jersey explained:
"Policy considerations also support our conclusion (that the benefits must be paid.) Unless we enforce the remainder of the Agreement and thereby require the firm to pay the compensation, improperly withheld by the unenforceable provision, firms will have no incentive to stop making restrictive covenants. Moreover, if the affected attorneys know they will not recover anything under such agreements, they will have no incentive to challenge illegal covenants."
Jacob v. Norris, McLaughlin & Marcus, supra, 128 N.J. at 34, 607 A.2d at 155.
In Cohen v. Lord, Day & Lord, supra, the New York Court of Appeals rejected the argument that departure compensation was the same as "retirement benefits" and, therefore, within the exception of the disciplinary rule:
"[T]o treat departure compensation as a retirement benefit would invert the exception into the general rule, thus significantly undermining the prohibition against restraints on lawyers practicing law."
75 N.Y.2d at 100, 550 N.E.2d at 412, 551 N.Y.S.2d at 159.
Hand-Arendall cites Miller v. Foulston, Siefkin, Powers & Eberhardt, 246 Kan. 450, 790 P.2d 404 (1990), in which the Supreme Court of Kansas held valid a provision in a partnership agreement under which an attorney who retired could receive retirement benefits only if he stopped practicing law. Miller is distinguishable from the case before us, because Miller concerns true retirement benefits, not deferred compensation as in the case before us. Id., 246 Kan. at 457-59, 790 P.2d at 410.
We agree with the reasoning of the New York Court of Appeals, and we affirm the trial court's holding that Paragraph 13 of the partnership agreement does not concern retirements benefits in the manner contemplated by DR 2-109(A). There is sound logic for such reasoning. Under Alabama partnership law, unless a partnership agreement provides otherwise, the withdrawal of a partner constitutes a dissolution of the partnership. § 10-8-90 et seq., Ala.Code 1975. Partnership agreements, such as the agreement in this case, avoid the automatic dissolution of a firm upon the withdrawal of a partner, by fixing the amount of deferred compensation the partner will be allowed upon withdrawal. Otherwise, the partnership would automatically dissolve upon the withdrawal of the partner, and he or she would be entitled to an accounting for the amount of his or her interest in the dissolved partnership. Cohen, 75 N.Y.2d at 102-03, 550 N.E.2d at 414, 551 N.Y.S.2d at 160.
For the reasons stated above, we hold: 1) Paragraph 13 of the partnership agreement is void only to the extent of the agreement not to complete, and the remainder of Paragraph 13 is valid, 2) the noncompetition agreement of Paragraph 13 does not come within the exception allowed by DR 2-109 and 3) Hand-Arendall has a contractual obligation to pay deferred compensation to Pierce under the terms set forth in the partnership agreement. The judgment of the trial court is reversed and the cause is remanded for proceedings consistent with this opinion.
REVERSED AND REMANDED.
HOOPER, C.J., and MADDOX, ALMON, HOUSTON, COOK, and BUTTS, JJ., concur.
NOTES
[1]  The substance of DR 2-109 is now dealt with at Rule 5.6, Alabama Rules of Professional Conduct.
[2]  Hand-Arendall attacks this holding in its cross-appeal.
[3]  See the New Jersey Supreme Court's discussion of the fact that equitable principles might bar a plaintiff's recovery in such a case if the plaintiff had been a senior partner instrumental in drafting the restrictive agreement. Jacob v. Norris, McLaughlin & Marcus, 128 N.J. 10, 607 A.2d 142, 155 (1992).
[4]  Footnote 8 to the trial court's order states this holding.
