
718 So.2d 669 (1998)
Ex parte STATE of Alabama ex rel. STATE OF OHIO and P.C.
(In re STATE of Alabama ex rel. STATE OF OHIO and P.C. v. E.B.M.).
1962017.
Supreme Court of Alabama.
January 16, 1998.
*670 J. Coleman Campbell and Lois Brasfield, asst. attys. gen., Department of Human Resources, for petitioners.
Randy Winborn of Yates, Mitchell, Bernauer, Winborn & Morton, Florence, for respondent.
HOUSTON, Justice.
In State ex rel. State of Ohio v. E.B.M., 718 So.2d 665 (Ala.1996) (which adequately sets out the facts in this case), this Court reversed the Court of Civil Appeals' January 5, 1996, decision in State ex rel. State of Ohio v. E.B.M., 718 So.2d 663 (Ala.Civ.App.1996). We held that in order for one to bring an action seeking child support payments under the Uniform Reciprocal Enforcement of Support Act ("URESA"), Ala.Code 1975, § 30-4-80 et seq., it is not necessary that a separate paternity action be filed under the Alabama Uniform Parentage Act ("UPA"), Ala.Code 1975, § 26-17-1 et seq. Specifically, we held that § 26-17-10(d), Ala.Code 1975, a part of the UPA, allows a court to determine paternity through a URESA action so long as the provisions of the UPA are followed and applied. Ex parte State ex rel. State of Ohio v. E.B.M., supra, 718 So.2d at 666; Ex parte State of California, 669 So.2d 884 (Ala.1995). We remanded the case for the Court of Civil Appeals to determine whether the trial court's finding for the alleged father was clearly erroneous.
On remand, the Court of Civil Appeals, again without addressing the trial court's finding, held that under § 26-17-6(a), the five-year limitations period barred the natural mother from bringing a URESA/UPA action for the purposes of determining the father/child relationship and challenging the presumed father's paternity and, thus, that the trial court's finding was not plainly and palpably erroneous. Ala.Code 1975, §§ 26-17-5(a)(1), 26-17-6(a). In support of its holding, the Court of Civil Appeals cited State ex rel. E.K.D. v. M.R.W., 662 So.2d 910 (Ala.Civ.App.1994) ("M.R.W."). In M.R.W., the alleged father moved to dismiss a paternity action filed against him, based on the five-year statute of limitations in § 26-17-6(a). The Court of Civil Appeals correctly held that the five-year limitations period applies in an action brought to determine the existence of the father-and-child relationship when a child has a presumed father, as set forth in § 26-17-5(a)(1). In that case, however, the alleged father affirmatively pleaded the statute of limitations. 662 So.2d at 911. In S.L.C. v. State ex rel. J.J.S., 667 So.2d 120 (Ala.Civ.App.1995) ("S.L.C."), however, the Court of Civil Appeals stated that even though the alleged father had raised the statute of limitations defense in his amended answer, he had failed to specifically state in his pleadings or arguments before the trial court that the limitations period was five years and that the specific Code section was § 26-17-6(a). The Court of Civil Appeals concluded that because the trial court had not ruled on this issue, the Court of Civil Appeals could not address the statute-of-limitations defense. 667 So.2d at 122.
The defense of the statute of limitations must be affirmatively pleaded, and if an answer does not include an affirmative defense, that defense is deemed to have been waived. See Rule 8(c), Ala.R.Civ.P.; Johnson *671 v. Life Ins. Co. of Alabama, 581 So.2d 438 (Ala.1991). However, there are exceptions to this rule. Rule 15(b), Ala.R.Civ.P., requires trial courts "to be liberal in granting permission to amend [pleadings] when justice so requires." Even as late as trial, if evidence relating to an unpleaded defense is introduced without objection, Rule 15(b) requires that the pleadings be treated as if that defense had been raised in the pleadings. Johnson v. Life Ins. Co. of Alabama, supra, at 441.
From what is before us, it appears that the statute of limitations was not raised at the trial level, nor on appeal. Appellate courts will not consider an issue that was not properly raised or pleaded in the trial court. Smiths Water Authority v. City of Phenix City, 436 So.2d 827 (Ala.1983) (citations omitted); S.L.C., supra; see 5 Am.Jur.2d Appeal and Error § 726 (1962 & Supp.1991). Whereas it is well settled that an appellate court will affirm the trial court's judgment if the court has reached the right result, even if it reached that result for the wrong reason, see Bennett v. Bennett, 454 So.2d 535 (Ala. 1984), that rule is not applicable where the trial court's judgment is based on an affirmative defense that was neither pleaded nor argued. See 5 Am.Jur.2d Appeal and Error § 727. Because the defense of the statute of limitations was not presented to the trial court, that defense was waived. Therefore, the Court of Civil Appeals erred in affirming the trial court's judgment based on the Court of Civil Appeals' determination that the action was barred by the five-year statute of limitations of the UPA.
The judgment of the Court of Civil Appeals is reversed and the case is remanded for that court to determine whether the trial court's finding for the alleged father was plainly and palpably erroneous.
REVERSED AND REMANDED.
HOOPER, C.J., and MADDOX, SHORES, KENNEDY, COOK, BUTTS, and SEE, JJ., concur.
ALMON, J., concurs in the result.
