
894 P.2d 943 (1995)
STATE ex rel. HARLEM IRRIGATION DISTRICT, Matt McCANN, Ralph Snide and Knute Kulbeck, Relators,
v.
MONTANA SEVENTEENTH JUDICIAL DISTRICT COURT, Blaine County, and the Honorable John McKeon, Presiding Judge, Respondents, and
Clinton Love and Rose Mary Love, Plaintiffs and Respondents.
No. 94-411.
Supreme Court of Montana.
Submitted on Briefs February 16, 1995.
Decided May 4, 1995.
Rehearing Denied May 25, 1995.
Robert D. Morrison, Morrison Law Firm, Whitefish, for relators.
David L. Irving, Glasgow, for respondent.
TRIEWEILER, Justice.
The plaintiffs, Clinton Love and Rose Mary Love, filed an amended complaint in the District Court for the Seventeenth Judicial District in Blaine County in which they alleged several claims against the defendants, the Harlem Irrigation District and its commissioners, based on the District's refusal to provide water to the Loves. Pursuant to Rule 12(c), M.R.Civ.P., the District moved for judgment on the pleadings, based in part on the doctrine of res judicata. The District Court denied the motion and the District petitioned this Court to reverse the District Court by the exercise of supervisory control. We accepted original jurisdiction pursuant to Rule 17(a), M.R.App.P., and in the exercise of supervisory control, reverse the order of the District Court.
The Irrigation District raises the following dispositive issue: Does the doctrine of res judicata preclude litigation of the issues raised in the Loves' amended complaint?

FACTUAL BACKGROUND
The Harlem Irrigation District is a public corporation, comprised of elected commissioners, which is responsible for managing a water irrigation system in Blaine County. The Loves owned property located in the Irrigation District. Based on its contention that they failed to pay their share of the taxes required for the operation of the Irrigation District, the commissioners have terminated the Loves' irrigation water on several occasions since 1983.
*944 In August 1983, the Loves filed a complaint, given Blaine County Cause No. 8195, in which they alleged that the District and two of its commissioners were liable for lost crops and punitive damages as a result of the termination of the Loves' water supply. That complaint was consolidated with another complaint, No. 8342, in which the same allegations were made against a third commissioner. The Loves alleged that the defendants acted "willfully, maliciously and were guilty of wanton disregard of the rights of the Plaintiffs and in violation of Montana Law and the bylaws of the District... ." The Irrigation District moved for summary judgment, and on November 9, 1989, the District Court granted its motion based on sovereign immunity. This Court affirmed that judgment based on its interpretation of former § 2-9-211, MCA (1989). Love v. Harlem Irrigation Dist. (1990), 245 Mont. 443, 802 P.2d 611 (Love I).
After our decision in Love I, the Loves filed another complaint on May 20, 1991, as Blaine County Cause No. DV 91-31, and an amended complaint on April 7, 1992. In Count One of their amended complaint, the Loves alleged that the District's denial of water in 1983, 1988, and 1989 violated contractual and statutory duties owed to the Loves.
In Count Two, they alleged that the Irrigation District's actions were "arbitrary, careless and negligent," as well as "willful and malicious acts of negligence." Count Two claimed that the District's conduct violated the implied covenant of good faith and fair dealing.
In Count Three, they alleged that the District's actions constituted actual or constructive fraud, and in Count Four they claimed that the District's acts deprived them of property without due process, in violation of 42 U.S.C. § 1983.
As in their first complaint, the Loves claimed damages for crop loss and the right to recover punitive damages. In addition, they alleged damage to their property.
The District moved for judgment on the pleadings pursuant to Rule 12(c), M.R.Civ.P., based in part on the doctrine of res judicata. The District Court denied the Irrigation District's motion.
In response to the Irrigation District's petition for supervisory control, we accepted original jurisdiction pursuant to Rule 17(a), M.R.App.P, in order to prevent extended and needless litigation.

DISCUSSION
Does the doctrine of res judicata preclude litigation of the issues raised in the Loves' amended complaint?
The District Court held that based on Boucher v. Dramstad (D. Mont. 1981), 522 F. Supp. 604, the doctrine of res judicata bars a subsequent cause of action if the following three criteria are satisfied: (1) if "the prior judgment was rendered by a court of competent jurisdiction;" (2) if "the decision was a final judgment on the merits;" and (3) if "the same cause of action and the same parties or their privies were involved in both cases." See Boucher, 522 F. Supp. at 606.
The court reasoned that in Love I, summary judgment was granted based on immunity provisions of former § 2-9-111, MCA (1989), and as a result, the court held that there had been no prior judgment on the merits. The court stated that even if the present claims were the same as those previously litigated, the second requirement in Boucher was not satisfied. The court added (also in reliance on Boucher) that res judicata should not apply because it would be manifestly unfair to the Loves. See Boucher, 592 F. Supp. at 607.
The Irrigation District argues that this Court does not follow the three-part test from Boucher and that this court's res judicata analysis does not involve a case-by-case consideration of fundamental fairness. While our discussions of the doctrine of res judicata do (in a different form) consider all of the elements discussed in Boucher, we have not yet had occasion to reject the application of that doctrine based on considerations of fairness. We have held:
The doctrine of res judicata states that a final judgment on the merits by a court of competent jurisdiction is conclusive as to causes of action or issues thereby litigated, *945 as to the parties and their privies, in all other actions in the same or any other judicial tribunal of concurrent jurisdiction.
Meagher County Water Dist. v. Walter (1976), 169 Mont. 358, 361, 547 P.2d 850, 852 (citing 46 Am.Jur.2d Judgments § 394).
In addition to the elements inferred from the previous definition, we have held that the doctrine includes the following four elements: (1) the subject matter of each action must be the same; (2) the parties or their privies of each action must be the same; (3) the issues must be the same and relate to the same subject matter; and (4) the capacities of the persons must be the same in reference to the subject matter and to the issues between them. Whirry v. Swanson (1992), 254 Mont. 248, 250-51, 836 P.2d 1227, 1228; Filler v. Richland County (1991), 247 Mont. 285, 291, 806 P.2d 537, 541; Wellman v. Wellman (1983), 205 Mont. 504, 507, 668 P.2d 1060, 1061.
Therefore, we do not agree that our own criteria for the application of the doctrine would not require a final judgment on the merits. However, neither do we agree that because the Loves' first suit was dismissed by summary judgment, based on § 2-9-111, MCA (1989), there was no prior judgment on the merits.
In Smith v. Schweigert (1990), 241 Mont. 54, 59, 785 P.2d 195, 198, we held that summary judgment is a decision on the merits because it is a conclusive determination of a legal issue presented by the facts of a case. In Mills v. Lincoln County (1993), 262 Mont. 283, 285, 864 P.2d 1265, 1267, we reaffirmed this holding, even though the summary judgment in the prior decision had been based on immunity pursuant to the pre-1991 amendment of § 2-9-111, MCA. Based on our decision in Mills, we hold that the District Court's dismissal of the Loves' original claims was a final judgment on the merits for purposes of applying the res judicata bar.
The Loves contend that the Boucher court's refusal to apply that doctrine based on considerations of fundamental fairness should guide our decision in this case because their claim, like the claim in Boucher, is based in part on 42 U.S.C. § 1983. However, as pointed out in Boucher, the United States Circuit Courts of Appeal are not in agreement on the question of whether res judicata bars a § 1983 action in federal court where the constitutional claims could have been raised in an earlier state court proceeding, but were not. Boucher, 522 F. Supp. at 606. That court recognized that the Ninth Circuit has held that such a failure bars a subsequent § 1983 action in federal court. Boucher, 522 F. Supp. at 606 (citing Scoggin v. Schrunk (9th Cir.1975), 522 F.2d 436).
Although the Boucher decision did not apply the bar, based on the court's concern for manifest unfairness, its decision was based on the unique facts of that case. We are not presented with the same considerations in this case and conclude, as we did in Whirry, that we are not here presented with facts which would justify rejection of the doctrine of res judicata based on principles of fundamental fairness. We hold that the doctrine of res judicata does bar § 1983 claims in Montana's courts when the constitutional claims could have been raised in an earlier proceeding, but were not.
The Loves also claim that new theories of recovery, and new facts alleged in their amended complaint in this case, preclude the application of res judicata. However, applying our four-part test, we conclude otherwise.
The underlying subject matter which formed the basis for the complaints in Love I and the current litigation are the same. In Love I, the Loves claimed that the Irrigation District shut off their water in violation of their rights, Montana law, and the District's bylaws. The amended complaint filed in this case claimed that the District's alleged failure to provide water violated contractual obligations, statutory duties, bylaws, 42 U.S.C. § 1983, the covenant of good faith and fair dealing, and constituted fraud. The underlying subject matter in the amended complaint in this case was the District's failure to provide water. The same subject matter that gave rise to the initial claim was the basis for the additional causes of action.
Both actions were brought by the Loves against the Irrigation District and its individual *946 members. Therefore, the parties or their privies are the same.
The third element is whether the issues in the two cases are the same and whether they relate to the same subject matter. The Loves contend that because new theories of recovery are alleged, the issues are not the same.
However, the doctrine of res judicata bars not only issues that were actually litigated, but also those that could have been litigated in a prior proceeding. Mills, 864 P.2d at 1267. A party should not be able to litigate a matter that the party already had the opportunity to litigate; public policy dictates that there must be some end to litigation. Sheffield Ins. Co. v. Lighthouse Properties (1992), 252 Mont. 321, 324, 828 P.2d 1369, 1371; First Bank v. Fourth Judicial Dist. Court (1987), 226 Mont. 515, 519-20, 737 P.2d 1132, 1134-35. Once a party has had an opportunity to present a claim, the judgment in a previous case is final as to the issues that were raised, as well as those that could have been raised. See Burgess v. Montana (1989), 237 Mont. 364, 366, 772 P.2d 1272, 1273. This notion arises from public policy designed to prevent endless piecemeal attacks on previous judgments. Wellman v. Wellman (1982), 198 Mont. 42, 46, 643 P.2d 573, 575. We conclude that the theories of recovery alleged in this cause of action could have been litigated in the prior proceeding.
The Loves, in another attempt to distinguish Love I from the current case, claim that the only damages claimed in Love I were for lost crops in 1983, and for punitive damages. In this case, they claim damage for 1983, 1988, 1989, and the years affected thereafter, as well as costs of reconditioning the land. However, their prior complaint was not dismissed until November 9, 1989. The same damages could have been alleged by amendment of their complaint in the Love I litigation, or they could have claimed damages, as they have in this case, for 1983 and years affected thereafter. Additional damages, like new theories, could have been alleged in the previous proceeding. Further, had they succeeded in their original action, they could have sought equitable relief which would have avoided the damage now complained of.
Finally, the fourth requirement is satisfied. The Loves were the plaintiffs, and the Irrigation District, as well as its individual commissioners, were the defendants in both actions. The capacities of the parties involved have not changed in relation to the subject matter and the issues in the litigation. See First Bank, 737 P.2d at 1135.
The petition for supervisory control is granted. The order of the District Court which denied the Irrigation District's motion for judgment on the pleadings based on the doctrine of res judicata, pursuant to Rule 12(c), M.R.Civ.P., is reversed and this case is remanded to the District Court for entry of judgment for the defendants.
TURNAGE, C.J., concur.
