The opinion of the court was delivered by
Davis, J.:On December 6, 1996, this court decided KPERS v. Reimer & Koger Assocs., Inc., 261 Kan. 17, 927 P.2d 466 (1996) (KPERS I), which involved two actions filed by the Kansas Public Employees Retirement System (KPERS) against various defendants for its investment losses in Sharoff Food Service, Inc., (Sharoff) and Tallgrass Technologies Corporation (Tallgrass). This appeal involves a cross-claim between two defendants in the action regarding KPERS’s losses in Tallgrass. We affirm the trial court’s dismissal of the cross-claim but for different reasons than are advanced by the trial court.
A brief statement of the facts, as well as some procedural history, is helpful to crystalize the issues we are called upon to decide in this appeal. KPERS filed two separate actions against Reimer & Koger and other defendants for losses suffered from its investment in Sharoff, approximately $9 million, and from its investment in Tallgrass, approximatély $14.5 million. Reimer & Koger was an investment advisor and had the discretion to invest the KPERS money. Reimer & Koger employed the law firm of Gage & Tucker, L.C., to represent KPERS, draft documents, and otherwise assist Reimer & Koger in consummating the Tallgrass transaction.
In May 1994, the Kansas Legislature enacted the KPERS settlement statute, K.S.A. 1995 Supp. 74-4904a, which provides protection for a defending party who enters into a settlement agreement with KPERS and obtains judicial approval of the settlement. The settling defendant is discharged from “all liability for contribution or noncontractual indemnity” as to any other individual or entity. K.S.A. 1995 Supp. 74-4904a(1). See KPERS I, 261 Kan. at 22-23.
*112Pursuant to the above statute, Gage & Tucker, which had been granted leave by the court to intervene as a defendant in the Tail-grass case, settled with KPERS for its loss in Tallgrass for $2.5 million. The separate KPERS actions for losses in Sharoff and Tail-grass were consolidated before the Shawnee County District Court. Both cases were the subject of an interlocutory appeal to this court on the questions of whether Reimer & Koger s cross-claims against Gage & Tucker for contribution and noncontractual indemnity were discharged by the KPERS settlement statute, K.S.A. 1995 Supp. 74-4904a, and whether K.S.A. 1995 Supp. 74-4904a was constitutional. We answered yes to both questions. KPERS I, 261 Kan. at 28-44.
At the time the appeal we now consider was argued, this court had not yet decided KPERS I, 261 Kan. 17. Because our decision affected this appeal we, by order dated December 18, 1996, offered the parties an opportunity to submit additional written arguments. The parties filed supplemental briefs.
The cross-claim in this case filed by Reimer & Koger against Gage & Tucker consists of two counts. Each count alleges that Gage & Tucker was retained by Reimer & Koger to represent Reimer & Koger in connection with the Tallgrass investments.
In Count I, entitled “Negligence and Breach of Fiduciary Duty,” Reimer & Koger asserts two claims. First, Reimer & Koger alleges that if it is found liable to KPERS for any damage, then Gage & Tucker breached its duty of care and/or fiduciary duty to Reimer & Koger, and by that breach, caused or contributed to the damage to KPERS. On that basis, Reimer & Koger seeks indemnity and/ or contribution from Gage & Tucker for any judgment KPERS may obtain against Reimer & Koger. The second claim alleges legal malpractice sounding in tort against Gage & Tucker for loss of fees, income, and damages to Reimer & Koger’s reputation resulting from the KPERS termination of Reimer & Koger. This claim is asserted as follows:
“12. In addition to the foregoing indemnification and/or contribution claims, to the extent that the acts, omissions, negligence, and fault of Gage & Tucker are found to have caused any damage to KPERS, then such acts, omissions, negligence and fault caused and/or contributed to KPERS’ termination of R&K as an in*113vestment advisor and thereby caused R&K damages in the loss of fees, income and damage to reputation.”
In Count II, entitled “Breach of Contract,” Reimer & Koger also set forth two claims: First, Reimer & Koger stated that Gage & Tucker entered into a contract with Reimer & Koger to provide Reimer & Koger with sound and appropriate legal services in connection with tíre Tallgrass investments; if Reimer & Koger is adjudged to be Hable to KPERS, then Gage & Tucker has breached its contract with Reimer & Koger by failing to properly advise Reimer & Koger. Reimer & Koger seeks indemnification and/or contribution from Gage & Tucker for any amount it is adjudged to be hable to KPERS. Second, Reimer & Koger asserts a claim for legal malpractice sounding in breach of contract. In this legal malpractice claim, Reimer & Koger alleges that if Gage & Tucker’s breach of its contract with Reimer & Koger is found to have caused any damage to KPERS, then that breach caused and/or contributed to the KPERS termination of the investment agreement on May 24, 1991, thereby causing Reimer & Koger to lose fees and income and suffer damage to its reputation.
A careful reading of the cross-claim demonstrates that the tort claims set forth in Count I are repeated in Count II, with the exception that in Count II, the claims are alleged to be based upon a contract between Reimer & Koger and Gage & Tucker. However, the nature of the contractual claims set forth in Count II sound in tort rather than in contract. The essence of the action in Count II is not dependent upon the breach of specific provisions of a contract but rather is based upon a breach of duty imposed by law. Even though there is a contract between the parties, the action sounds in tort, based upon a breach of duty imposed by law. Malone v. University of Kansas Medical Center, 220 Kan. 371, 375, 552 P.2d 885 (1976); see Bonin v. Vannaman, 261 Kan. 199, 209-11, 929 P.2d 754 (1996); Hunt v. KMG Main Hurdman, 17 Kan. App. 418, 839 P.2d 45 (1992).
We said in Tamarac Dev. Co. v. Delamater, Freund & Assocs., 234 Kan. 618, 619-20, 675 P.2d 361 (1984), that the difference between a tort and contract action is that a breach of contract is a *114failure of performance of a duty arising or imposed by agreement; whereas, a tort is a violation of a duty imposed by law. In Tamarac Dev. Co., we concluded that the cause of action was based upon an oral contract calling for a specific result. Thus, the 3-year statute of limitations applied instead of the 2-year statute of limitations based upon negligence. 234 Kan. at 622-23.
We discussed the difference between tort and contract actions in legal malpractice cases in Pancake House, Inc. v. Redmond, 239 Kan. 83, 716 P.2d 575 (1986). That case involved an action filed against attorneys for negligence, breach of a fiduciary duty, and breach of implied contract. The plaintiff argued that its action was contractual and the 3-year statute of limitations applied. The defendants contended that the cause of action was tort-based and the 2-year statute of limitations had run. Our discussion in Pancake House, Inc., is instructive in this case:
“A breach of contract may be said to be a material failure of performance of a duty arising under or imposed by agreement. A tort, on the other hand, is a violation of a duty imposed by law, a wrong independent of contract. Torts can, of course, be committed by parties to a contract. The question to be determined here is whether the actions or omissions complained of constitute a violation of duties imposed by law, or of duties arising by virtue of the alleged express agreement between the parties. Malone v. University of Kansas Medical Center, 220 Kan. 371, 552 P.2d 885 (1976).
“Legal and medical malpractice generally constitute both a tort and a breach of contract. An action for liability of an attorney on the grounds of negligence for failure to discharge his professional duty to a client rests on the employment contract and therefore is contractual in nature. Where the act complained of is a breach of specific terms of the contract without any reference to the legal duties imposed by law upon the relationship created thereby, the action is contractual. Where the essential claim of the action is a breach of a duty imposed by law upon the relationship of attomey/client and not of the contract itself, the action is in tort. Bowman v. Doherty, 325 Kan. 870, 686 P.2d 112 (1984).
“. . . Kansas has held that where a legal duty is imposed by law, the cause of action is in tort. Where the malpractice involves failure to perform a contractual obligation, whether express or implied, the cause of action is in contract.” 239 Kan. at 85-86.
Count II of Reimer & Koger s cross-claim, while entitled breach of contract, alleges a general breach of duty imposed by law upon *115the relationship of attomey/client and not on the contract itself. Paragraphs 14 and 16 of the cross-claim in Count II state:
“14. R&K contracted with Gage & Tucker to provide sound and appropriate legal services to R&K in the course of R&K’s rendering investment advisory services to KPERS, and in particular relating to the Tallgrass investment.
“16. R&K specifically deny [sic] that it is hable to KPERS, as set forth in this defendant’s answer to KPERS’ petition. However, R&K states that if it is adjudged to be hable or to have caused any damages to plaintiff, such being expressly denied, then Gage & Tucker has breached its contract with R&K by failing to properly advise R&K and has therefore, by its breach of contract, caused or contributed to any KPERS’ damages adjudged against R&K.” (Emphasis added.)
We conclude that both of the claims set forth in Count II sound in tort and do not set forth contractual claims. As such, the claims set forth in Count II duplicate the tort-based claims set forth in Count I of the cross-claim of Reimer & Koger.
The tort-based claims for noncontractual indemnity and/or contribution asserted by Reimer & Koger against Gage & Tucker in its cross-claim have been discharged by the judicially approved settlement Gage & Tucker entered into with KPERS. See KPERS I, 261 Kan. at 34. The parties agreed in their supplemental briefs, and we conclude, that the cross-claims for noncontractual indemnity and/or contribution against Gage & Tucker have been discharged. Accordingly, the trial court’s dismissal of these claims must be affirmed.
The two remaining claims are tort-based legal malpractice claims seeking affirmative relief. The two legal malpractice claims duplicate one another. Gage & Tucker filed a motion before the trial court to dismiss these claims because they were barred by the applicable 2-year statute of limitations. Gage & Tucker advances the same argument on appeal.
We note that our decision in KPERS 1,261 Kan. 17, has no effect on Reimer & Koger’s tort-based legal malpractice claim against Gage & Tucker in that such claims do not seek contribution or indemnity. The legal malpractice claims are separate and distinct affirmative claims for the loss of fees, income, and damage to rep*116utation based upon Gage & Tucker’s part in the termination of Reimer & Koger as the KPERS investment advisor.
Any cross-claim that asserts an affirmative claim must be filed within the applicable period of the statute of limitations. U.S.D. No. 490 v. Celotex Corp., 6 Kan. App. 2d 346, Syl. ¶ 2, 629 P.2d 196, rev. denied 230 Kan. 819 (1981).K.S.A. 60-513 governs and provides for a 2-year limit for most actions not premised on a contract. Subsection (b) of this statute states in relevant part:
“[T]he causes of action listed in subsection (a) shall not be deemed to have accrued until the act giving rise to the cause of action first causes substantial injury, or, if the fact of the injury is not reasonably ascertainable until some time after the initial act, then the period of limitation shall not commence until the fact of injury becomes reasonably ascertainable to the injured party, but in no event shall an action be commenced more than 10 years beyond the time of the act giving rise to the cause of action.”
The phrase “substantial injury” in K.S.A. 60-513(b) has been construed to mean “actionable injury.” Roe v. Diefendorf, 236 Kan. 218, Syl. ¶ 2, 689 P.2d 855 (1984). In examining this statute in the context of a legal malpractice action, we explained:
“In general, a cause of action accrues, so as to start the running of the statute of limitations, as soon as the right to maintain a legal action arises. The true test to determine when an action accrues is that point in time at which the plaintiff could first have filed and prosecuted his action to a successful conclusion.” Pancake House, Inc., 239 Kan. at 87.
Gage & Tucker argues that Reimer & Koger suffered substantial injury when KPERS terminated its investment agreement with Reimer & Koger. Reimer & Koger assert that the cause of action does not accrue until the damages in the underlying action are fixed and the underlying action is finally concluded. However, the sole injury that Reimer & Koger bases its malpractice claim upon is the termination of the investment agreement. Paragraph 12 of the cross-claim states: *117Reimer & Koger alleges that the termination itself was partially caused by Gage & Tucker’s negligence. The injury caused by any malpractice on the part of Gage & Tucker became ascertainable at the moment of termination. The termination of the investment agreement occurred ón May 24, 1991, and this is the date the statute of limitations began to run.
*116“12. In addition to the foregoing indemnification and/or contribution claims, to the extent that the acts, omissions, negligence, and fault of Gage & Tucker are found to have caused any damage to KPERS, then such acts, omissions, negligence and fault caused and/or contributed to KPERS’ termination of R&K as an investment advisor and thereby caused R&K damages in the loss of fees, income and damage to reputation.”
*117The KPERS petition in this action was filed May 20, 1993. Reimer & Koger’s cross-claim was not filed until December 30,1994, more than 2 years from May 24,1991. However, if the cross-claim relates back to the date of the petition on May 20, 1993, the cross-claim would be filed within the 2-year statutory period. “The general rule is that a cross claim of any nature is barred as to affirmative relief, if such cross claim be barred by the statute of limitations at the time of the filing of plaintiff’s action.” Christenson v. Akin, 183 Kan. 207, 212-13, 326 P.2d 313 (1958). In this case, the cross-claim of Reimer & Koger based upon legal malpractice was not barred by the statute of limitations at the time KPERS filed its petition on May 20, 1993. However, this does not end our inquiry.
Rochester American Ins. Co. v. Cassell Truck Lines, 195 Kan. 51, Syl. ¶ 2, 402 P.2d 782 (1965), involved the question of whether a cross-claim filed by one defendant against its codefendant was barred by a 2-year statute of limitations. We first noted that in considering the effect of the running of the statute of limitations, there is a substantial distinction between a claim asserted as apure defense and one where affirmative relief is sought. We recognized that a demand pleaded by way of a setoff, counterclaim, or cross-claim is regarded as an affirmative action and, unlike a matter of pure defense, is subject to the operation of the statute of limitations. 195 Kan. at 56. In the case we now consider, the cross-claim for legal malpractice is an affirmative action by Reimer & Koger against Gage & Tucker for monetary damages flowing from termination of Reimer & Koger as the KPERS investment advisor.
In Rochester American Ins. Co., we held that the cross-claim was barred by the 2-year statute of limitations because it was filed more than 2 years after the statute had began to run. This was the case even though the initial petition in the case was filed within the 2-year period. We said:
*118“Where a defendant files a cross-claim seeking affirmative relief against other defendants in an action arising out of the same incident pleaded by the plaintiffs in their petitions, and where the original petitions were filed within the two-year period of the statute of limitations, but the cross-claim was not filed until after the two-year limitation period had run, it is held-. The cross-claim is barred by the statute of limitations.” 195 Kan. 151, Syl. ¶ 2.
Reimer & Roger’s cross-claim for legal malpractice was filed with the district court on December 20, 1994, more than 2 years after the statute of limitations began to run on May 24, 1991. As such, Reimer & Roger’s negligence-based claim for legal malpractice is barred by R.S.A. 60-513(b).
We have said that a trial court’s reason for its decision is immaterial if the ruling is correct for any reason. Dickerson v. Kansas Dept. of Revenue, 253 Kan. 843, Syl. ¶ 3, 863 P.2d 364 (1993). Accordingly, we affirm the trial court’s dismissal of Reimer & Roger’s cross-claim against Gage & Tucker.
Affirmed.