
435 A.2d 745 (1981)
W. Stanley REED
v.
Harry TRACY.
Supreme Judicial Court of Maine.
Argued September 16, 1981.
Decided October 13, 1981.
*746 Libhart, Ferris, Dearborn, Willey & Ferm, Wayne P. Libhart, N. Laurence Willey, Jr. (orally), Ellsworth, for plaintiff.
Markos & Roy, Peter R. Roy (orally), Ellsworth, for defendant.
Before McKUSICK, C. J., and GODFREY, NICHOLS, ROBERTS, CARTER, VIOLETTE and WATHEN, JJ.
WATHEN, Justice.
Plaintiff commenced this action on September 25, 1978 in Superior Court, Hancock County, pursuant to 14 M.R.S.A. § 6655 et seq., seeking to quiet title to a piece of land in McKinley, Maine. The defendant, Harry Tracy, claimed title to the disputed land (1) because his father, Lawrence Tracy, purchased the land for him with his money; (2) as heir-at-law of his father who obtained record title; or (3) by adverse possession. On July 14, 1980 hearing on the merits was held before a referee who found for plaintiff on all issues. On the day of the hearing before the referee defendant filed with the court a motion to dismiss for failure to state a claim, M.R.Civ.P. 12(b)(6).
A hearing on the motion to dismiss was held in Superior Court after receipt of the referee's report. The presiding justice denied the motion to dismiss, adopted the referee's findings, and granted judgment for the plaintiff thereon. Subsequently, defendant made timely motions for a new trial and to amend the judgment under M.R.Civ.P. 52(b), which were denied. This seasonable appeal challenges the denial of defendant's motions to dismiss, for a new trial, and to amend the judgment.
Defendant's motion to dismiss sought to bar the present action, alleging that the issues presented had been previously adjudicated. The motion alleged the existence of three prior suits involving the same issues and parties or persons in privity with them. We do not reach the merits of this argument because defendant has lost the right to assert error on this basis. At no time was the affirmative defense of res judicata pleaded by the defendant, as is required by M.R.Civ.P. 8(c). The defense of res judicata is waived where it is not raised by the pleadings. Boyd v. Boyd, Me., 421 A.2d 1356 (1980); see Huffman v. Pursue, 420 U.S. 592, 607 n.19, 95 S.Ct. 1200, 1209, 43 L.Ed.2d 482, 494 (1975); Santos v. Alaska Bar Ass'n, 618 F.2d 575 (9th Cir. 1980); 5 C. Wright & A. Miller, Federal Practice and Procedure § 1278 (1969). The subject suit was commenced in 1978, and the hearing before a referee was not held until 1980. Defendant had ample time to amend his answer to allege the affirmative defense of res judicata. The motion to dismiss was correctly denied since the issue of res judicata was not pleaded and was not properly before the trial court.
Our resolution of the first issue on appeal disposes of defendant's second contention: that the motions for amended judgment and a new trial were improperly denied. These two motions were based on alleged procedural defects in the hearing at which the motion to dismiss was denied. Since we have decided that the motion to dismiss could not have been granted in any case, procedural or evidentiary errors alleged to have been committed in hearing the motion can be of no consequence, and could not have been prejudicial to defendant. Therefore, we find that the trial court properly denied both motions.
The entry is:
Appeal denied.
Judgment affirmed.
All concurring.
