
179 N.W.2d 416 (1970)
Carl O. PERDUE and Alvina Perdue, Plaintiffs and Appellants,
v.
Evelyn J. KNUDSON, Defendant and Respondent.
Civ. No. 8521.
Supreme Court of North Dakota.
September 3, 1970.
*417 Ray H. Walton, Williston, for plaintiffs and appellants.
Bjella & Jestrab, Williston, for defendant and respondent.
STRUTZ, Judge (on reassignment).
The plaintiffs formerly were tenants of and farmed certain lands located in Williams County owned by the defendant. In the course of their relationship as landlord and tenants, the defendant gave to the plaintiffs a written option to purchase the leased premises. Some time thereafter, the *418 plaintiffs brought an action for specific performance of this option agreement, praying that the defendant be directed to convey the premises to the plaintiffs, and for such other and further relief as to the court might seem just and proper, and that the plaintiffs be granted general relief.
On May 5, 1965, after trial of the action, judgment was entered dismissing the plaintiffs' complaint. In its findings in that case, the trial court found that one of the considerations for the giving of the option by the defendant was the obligation on the part of the plaintiffs to make full accounting of crops raised by them on the defendant's land, and that the plaintiffs had failed to make such accounting. From the judgment entered dismissing their complaint for specific performance, and for other and general relief, the plaintiffs took no appeal.
Thereafter, on or about August 24, 1965, the plaintiffs commenced a second action against the defendant for damages for breach of contract. This action was based upon the same option agreement which had been involved in the specific-performance action. The defendant served and filed his answer to the plaintiffs' complaint and counterclaimed for damages.
Before the second case came on for trial, the defendant made a motion for summary judgment and the trial court, after considering such motion, entered its order dismissing the plaintiffs' complaint. The court failed, however, to make any disposition of the defendant's counterclaim which had been served with his answer in the second action.
On appeal from the summary judgment by the plaintiffs, this court held that when multiple claims for relief are involved, as is true when there is a counterclaim filed in an action, the trial court may direct the entry of final judgment on one or more, but fewer than all, of such claims only on the express determination that there is no just reason for delay, and upon the express direction for entry of judgment. See Rule 54(b), North Dakota Rules of Civil Procedure. Since the trial court had failed to make such determination, this court, on such former appeal, held that the summary judgment appealed from was not final and therefore not appealable. The case thereupon was remanded to the district court. Perdue v. Knudson, 154 N.W.2d 908 (N.D.1967).
Thus, until an order was entered dismissing the defendant's counterclaim or a determination was made by the court that there was no just reason for delay, the summary judgment of the trial court dismissing the plaintiffs' complaint was not final and was subject to revision at any time.
On January 18, 1968, judgment on remittitur pursuant to the direction of the Supreme Court was entered by the district court. Thereafter, on August 13, 1968, pursuant to motion by the defendant, the trial court entered its order dismissing the defendant's counterclaims. Judgment was entered on this order. This judgment, together with the summary judgment dismissing the plaintiffs' complaint, which previously had been entered, adjudicated all of the claims, rights, and liabilities of the parties to the action. Appeal to this court from the order and the judgment dismissing the defendant's counterclaims and from the summary judgment dismissing the plaintiffs' complaint thereupon was taken by the plaintiffs.
Although a number of questions are raised on this appeal, the plaintiffs urge two main issues:
1. Did the trial court abuse its discretion in allowing the defendant to interpose and file a second amended answer and counterclaim?
2. Did the trial court err in entering its order granting the defendant's motion for summary judgment?
The plaintiffs, in support of their contention that the district court abused its discretion by allowing the defendant to file a second amended answer and counterclaim which set up the defense of unclean *419 hands, point out that Rule 8(c), North Dakota Rules of Civil Procedure, requires that a party plead any and all matters which constitute an avoidance or an affirmative defense. They also point out that Rule 12(h) of the Rules of Civil Procedure provides that a party waives all defenses and objections which he does not so present. Therefore, say the plaintiffs, by failing to plead these defenses in his answer and first amended answer and counterclaim, the defendant had waived them and it was error for the trial court to permit him, as of February 16, 1966, to file a second amended answer and counterclaim setting forth these additional defenses.
The rules referred to by the plaintiffs do provide that all defenses which a party fails to urge in his pleadings, or by motion, are waived by him. However, in presenting their argument, the plaintiffs fail to consider Rule 15(a) of the North Dakota Rules of Civil Procedure. This rule provides that a party may amend his pleading once, as a matter of course, at any time before a responsive pleading is served or, if the action has not been placed upon the trial calendar, at any time within twenty days after it is served. However, the rule further provides that a party may amend his pleadings thereafter only by written consent of the other party or by leave of the court, and that such "leave shall be freely given when justice so requires." Clearly, this rule leaves the question of whether an amendment shall be permitted to pleadings in a particular case to the sound discretion of the trial court. We said, in C.I.T. Corporation v. Hetland, 143 N.W.2d 94 (N.D.1966):
" * * * The question of whether amendment shall be permitted is submitted to the informed, careful judgment and discretion of the trial court. Rule 15(a), N.D.R.Civ.P." Syllabus, Par. 10.
See also J. R. Watkins v. Vangen, 116 N.W.2d 641 (N.D.1962), where the answer to the amended complaint was served on January 23, 1958, and a motion for leave to file an amended answer was noticed for hearing and heard on September 6, 1961, one week before trial. No explanation for the delay was offered. In that case, this court held that the propriety of permitting an amendment to a pleading by leave of court, under Rule 15(a), rests within the sound discretion of the trial court, and that the trial court's decision will not be disturbed on appeal unless an abuse of discretion is shown.
Our Rule 15(a) is substantially the same as Rule 15(a) of the Federal Rules of Civil Procedure. 1A Barron and Holtzoff, Federal Practice and Procedure, Section 442, at 712, states:
"Rule 15(a) calls for liberality in allowing amendments, and the rules on amendments themselves are liberally construed by the courts, in order to insure, so far as possible, that cases are decided on their merits."
In the interest of justice, the present trend of decisions in the Federal courts is for a liberal construction of these rules authorizing amendment to pleadings. C.I.R. v. Finley, 265 F.2d 885 (10 Cir. 1959); Copeland Motor Co. v. General Motors Corp., 199 F.2d 566 (5 Cir. 1952); Freeman v. Continental Gin Company, 381 F.2d 459 (5 Cir. 1967); Hanson v. Hunt Oil Company, 398 F.2d 578 (8 Cir. 1968); Foman v. Davis, 371 U.S. 178, 83 S.Ct. 227, 9 L.Ed.2d 222 (1962); Gillespie v. United States Steel Corp., 379 U.S. 148, 85 S.Ct. 308, 13 L.Ed.2d 199 (1964).
Thus, while the rule provides no definite time for amendment of pleadings by leave of court, the matter of timeliness is largely within the court's discretion. We find no abuse of discretion by the trial court in permitting the defendant to file his second amended answer and counterclaim in this case. The plaintiffs have made no showing that they were in any way prejudiced by the court's order permitting such amendment.
*420 The next issue raised on this appeal is whether the trial court erred in granting the defendant's motion for summary judgment. Rule 56(b), North Dakota Rules of Civil Procedure, provides that a party against whom a claim is asserted may move, at any time, with or without supporting affidavits, for summary judgment in his favor as to all or any part thereof. Such motion will be granted only if, after taking the view of the evidence most favorable to the party against whom summary judgment is demanded, there is no genuine issue as to any material fact and the moving party is entitled to judgment as a matter of law. Temme v. Traxel, 102 N.W.2d 1 (N.D.1960); Mondy v. Gjesdal, 123 N.W.2d 33 (N.D.1963).
We now must determine whether, in the light of this rule, the defendant was entitled to summary judgment in this case. The record discloses that the plaintiffs had commenced their prior action for specific performance based upon the option agreement with the defendant. That action, after hearing, was dismissed by the trial court. The plaintiffs took no appeal from the judgment of dismissal, and it became final. However, in lieu of appealing from the adverse judgment, the plaintiffs started a new action for damages based upon the same option agreement. The defendant asserts that the suit for specific performance of the option agreement, which the trial court had refused to order the defendant to specifically perform, is res judicata to the bringing of the second action, and that under the rules the plaintiffs could have demanded and submitted evidence in the first action of any damages they might have suffered by reason of the defendant's failure to convey the premises; that all of the plaintiffs' claims not only could have been but should have been litigated in the first action for specific performance, which was dismissed by the trial court, and from which judgment of dismissal no appeal was taken; and that as a consequence of their failure to try, in the first action, all of their alleged claims arising out of the contract with the defendant, they now are barred from maintaining a second action for damages. Thus the second issue raised by the plaintiffs' appeal is whether the judgment dismissing plaintiffs' complaint for specific performance of the option agreement is res judicata, barring the bringing of the second action for damages based upon the same agreement.
Rule 2, North Dakota Rules of Civil Procedure, provides that there shall be one form of action known as a "civil action." Prior to the adoption of the North Dakota Rules of Civil Procedure, North Dakota had abolished, by statute, the distinction between actions at law and suits in equity. Under our statute, this court had held that equitable relief might be granted in a legal action and equitable defenses might be interposed therein. L. W. Wentzel Implement Co. v. State Finance Co., 63 N.W.2d 525 (N.D.1954).
Thus, even before the adoption of our rules of civil procedure, all actions for enforcing private rights or for redressing private wrongs arising out of the same cause of action had to be brought in one suit known as a "civil action," whether the issues raised by the suit were legal or equitable. The adoption of our rules of civil procedure in 1957 did not make any changes in this area. Under Rule 2, all actions still must be brought in one suit, whether the issues raised are legal or equitable or both.
Thus one civil action is to be used to secure any relief which a plaintiff may claim or to which he may be entitled from the defendant, growing out of the same facts. As against the parties to the action, the final judgment must grant all relief to which the plaintiff is entitled, whether or not he has demanded such relief in the pleadings. See Rule 54(c), N.D.R.Civ.P.
Each party may set forth or state any number of claims or defenses which he has or which he asserts he has, regardless of whether they are legal or equitable or both. Rule 8(e) (2), N.D.R.Civ.P.
Rule 18(a), North Dakota Rules of Civil Procedure, authorizes a plaintiff, in his *421 complaint or reply, and a defendant, in his answer setting forth a counterclaim, to join, either as independent or as alternative claims, as many claims, "either legal or equitable or both," as each may have against the opposing party.
Thus there can be no doubt that the plaintiffs were authorized, under our rules of civil procedure, to not only bring an action for specific performance in their first action but also to set forth any and all other claims, either legal or equitable, which they might have or claim to have against the defendant. The plaintiffs had the right to join any and all such claims in the original action for specific performance. Our question is: Were they compelled to do so, and, where they have failed to join all claims which they had, are such claims as were not urged now barred by the judgment in the first action?
The defendant points out that the plaintiffs actually did pray for more than specific performance in their first action, because they prayed that the court award them "such other and further relief as to the Court may seem meet and proper, and for general relief."
However, courts have generally held that the prayer for relief is of little or no consequence since the court is authorized to grant whatever relief the party shows himself entitled to receive. The question is not whether the plaintiff is entitled to the relief which he has demanded, but whether, under his pleadings and the evidence submitted, he is entitled to any relief, demanded or not.
This court had a somewhat similar situation before it in the case of Cokins v. Frandsen, 136 N.W.2d 377 (N.D.1965). In that case, the plaintiff brought an action for specific performance of a contract to sell certain real estate. The contract which the court ordered specifically performed had a clause providing for payment of taxes. In ordering specific performance, the trial court ordered payment of loss of profits but failed to make any provision for or mention of payment of taxes. Some time thereafter, the court entered an order providing that the defendant pay all real estate taxes involved in the controversy. The defendant appealed. On such appeal, we held that a judgment on the merits is conclusive between the same parties, not only as to every matter litigated but also as to every claim arising out of the same cause of action which might have been litigated.
This seems to be the general rule, in both Federal and State courts. Lawhorn v. Atlantic Refining Co., 299 F.2d 353 (5 Cir. 1962); Intertype Corporation v. Clark-Congress Corporation, 240 F.2d 375 (7 Cir. 1957); Hoff v. City of Mesa, 86 Ariz. 259, 344 P.2d 1013 (1959); City of Los Angeles v. Jameson, 165 Cal.App.2d 351, 331 P.2d 1014 (1958); Hizel v. Howard, 144 Colo. 15, 354 P.2d 611 (1960); Doyle v. United Finance Co., 97 Ga.App. 257, 102 S.E.2d 637 (1958); Jordan v. Stuart Creamery, Incorporated, 258 Iowa 1, 137 N.W.2d 259 (1965); Prawdzik v. Heidema Brothers, Inc., 352 Mich. 102, 89 N.W.2d 523 (1958).
Numerous other cases could be cited, all to the effect that a judgment is conclusive not only as to all matters put in issue but also as to all claims which, under the rules, might have been put in issue in the prior trial. Courts will not permit a litigant to try a part of his case and then, if he is disappointed with the outcome of the action, to have another day in court simply by alleging new claims or making a new demand for relief, when he could have made such demand in the prior action. In such case, the judgment in the first action is conclusive between the same parties as to all matters tried in that action or which, under the rules, might have been put in issue in the action previously tried, in which judgment was entered and from which judgment no appeal was taken.
The parties to this action are the same as those in the previous action. The plaintiffs' claims are based upon the same agreement, and the action is the same except that in this action the plaintiffs seek *422 to recover damages for failure of the defendant to convey, whereas in the former action they sought to compel the defendant to specifically convey the premises. Damages might have been demanded in the first action. Consequently, the judgment on the merits in the first action between the same parties constitutes a bar to the subsequent action based upon the same claim or claims or cause of action, not only as to matters in issue but as to all matters essentially connected with the subject of the action which might have been litigated in the first action.
For reasons set forth in this opinion, the judgment of the trial court is affirmed.
TEIGEN, C. J., ERICKSTAD and PAULSON, JJ., and CLIFFORD JANSONIUS, District Judge, concur.
HARVEY B. KNUDSON, Associate Justice, deeming himself disqualified, did not participate; CLIFFORD JANSONIUS, Judge of the District Court in the Fourth Judicial District, sitting in his stead.
