
334 S.C. 30 (1999)
512 S.E.2d 106
PLUM CREEK DEVELOPMENT COMPANY, INC., Petitioner,
v.
The CITY OF CONWAY, A Municipal Corporation, Respondent.
No. 24886.
Supreme Court of South Carolina.
Heard December 3, 1998.
Decided January 25, 1999.
Rehearing Denied February 19, 1999.
*32 John P. Henry and Philip C. Thompson, both of The Thompson Law Firm, P.A., of Conway, for petitioner.
W. Cliff Moore, III, and Andrew F. Lindemann of Ellis, Lawhorne, Davidson & Sims, P.A., of Columbia, for respondent.
BURNETT, Justice:
We granted Plum Creek Development Company, Inc.'s (Plum Creek's) petition for a writ of certiorari to review the decision of the Court of Appeals in Plum Creek v. The City of Conway, 328 S.C. 347, 491 S.E.2d 692 (Ct.App.1997). We affirm as modified.
In November 1991, Plum Creek acquired property for a residential development. Respondent The City of Conway (City) refused to provide water and sewer service to the development unless it was annexed.
In 1992, Plum Creek petitioned the lower court for a writ of mandamus to require City to provide water and sewer service for the development without annexation. Plum Creek claimed it was entitled to utility service as an assignee of an easement agreement and as a third-party beneficiary of City's agreement with the Grand Strand Water & Sewer Authority (the Authority). In June 1993, the master-in-equity issued a writ of mandamus, finding neither the easement nor the City's agreement with the Authority required annexation as a condition precedent to utility service. City appealed. It did not move to stay the enforcement of the writ during the pendency *33 of its appeal.[1] This Court affirmed. Plum Creek Development Co. et al. v. The City of Conway, 94-MO-183 (S.C.Sup. Ct. filed July 15, 1994).
Shortly after the Court's affirmance, Plum Creek filed an action for damages against City alleging breach of the same contract and breach of the same easement agreement which were the basis of Plum Creek's mandamus proceeding. The complaint alleged City's unwarranted refusal to provide the utility service for two years resulted in Plum Creek incurring substantial monetary damages, including, among others, losing its major investor, losing a favorable real estate market, and incurring costs associated with redesigning and replanning its development.
Concluding res judicata does not bar a subsequent action for damages after a judgment granting a writ of mandamus, the circuit court denied City's motion for summary judgment. The circuit court granted Plum Creek's motion for summary judgment as to liability, finding the prior order granting the writ of mandamus finally decided City was required to provide water and sewer service to Plum Creek. City appealed.
Holding res judicata precluded Plum Creek's action for damages, the Court of Appeals reversed and remanded for entry of summary judgment for City. Plum Creek v. The City of Conway, supra.

ISSUE
Does a judgment granting a writ of mandamus preclude a subsequent action for damages under principles of res judicata?
A. Did the Court of Appeals err by holding the subject matter in Plum Creek's mandamus action was the same as in its subsequent action for damages?
B. Does Rule 65(f)(2), SCRCP, give a plaintiff an option as to whether to seek damages at the same time it seeks a writ of mandamus?

*34 C. Does res judicata bar Plum Creek from bringing a second action for damages when it could not have anticipated the full extent of its damages at the time it initiated the mandamus proceeding?
D. Should the Court adopt the res judicata principles applied to declaratory judgment actions for mandamus?
E. Should the Court adopt an exception to res judicata to permit a party who has been granted a writ of mandamus to bring a subsequent action for damages?

DISCUSSION

A.
Plum Creek argues a judgment granting a writ of mandamus does not preclude a subsequent action for damages under principles of res judicata. We disagree.
Res judicata is the branch of the law that defines the effect a valid judgment may have on subsequent litigation between the same parties and their privies. Res judicata ends litigation, promotes judicial economy and avoids the harassment of relitigation of the same issues.
J. Flanagan, South Carolina Civil Procedure p. 642 (1996).
Res judicata bars subsequent actions by the same parties when the claims arise out of the same transaction or occurrence that was the subject of a prior action between those parties. Sub-Zero Freezer Co. v. R.J. Clarkson Co., 308 S.C. 188, 417 S.E.2d 569 (1992). Under the doctrine of res judicata, "[a] litigant is barred from raising any issues which were adjudicated in the former suit and any issues which might have been raised in the former suit." Hilton Head Center of South Carolina, Inc. v. Public Service Comm'n of South Carolina, 294 S.C. 9, 11, 362 S.E.2d 176, 177 (1987). To establish res judicata, the defendant must prove the following three elements: (1) identity of the parties; (2) identity of the subject matter; and (3) adjudication of the issue in the former suit. Riedman Corp. v. Greenville Steel Structures, Inc., 308 S.C. 467, 419 S.E.2d 217.(1992); Sealy v. Dodge, 289 S.C. 543, 347 S.E.2d 504 (1986).
*35 In its brief to the Court of Appeals, Plum Creek agreed City established the first and third elements of res judicata.[2] It claims, however, because it seeks a different remedy in the present action, monetary damages, than it did in the mandamus proceeding, a writ of mandamus, the subject matter element of res judicata has not been established. We disagree.
The subject matter in Plum Creek's mandamus proceeding and damage action is the same.[3] Both the mandamus proceeding and the damages action clearly arise from the same factual basisCity's refusal to provide water and sewer service to the development unless it was annexed. Both proceedings concern the same contract and easement agreement. The only difference between the two proceedings is the remedy sought by Plum Creek. A different remedy, however, does not alter the fact that the claims are identical in both the mandamus action and current damage action. Evans v. Creech, 187 S.C. 371, 197 S.E. 365 (1938) (prayer for relief is not a test of the identity of the cause of action); see also 46 Am.Jur.2d Judgments § 536 (1994) ("[a] claim for damages is a claim for relief rather than an assertion of a different cause of action for purposes of determining the applicability of res judicata."); 50 C.J.S. Judgment § 756 (1997) ("[i]f the other elements of an estoppel are present, a mere difference in the relief sought in the subsequent action will not operate to nullify the effect of a judgment as res judicata.").[4] We conclude res judicata applies.
*36 Plum Creek correctly asserts a petition for writ of mandamus or other writ is not a cause of action but a form of remedy or relief. See Note to Rule 65, SCRCP. Consequently, Plum Creek maintains since its proceeding for mandamus was not a "cause of action," its second action could not be the same cause of action as its first. We disagree.
While a writ of mandamus is not a cause of action, there must be underlying facts which support issuance of the writ. Where those underlying facts or subject matter of the mandamus proceeding and a subsequent proceeding are identical, and the other two elements exist, res judicata applies. 50 C.J.S. Judgment § 749 (1997) (for purposes of res judicata, "cause of action" is not the form of action in which a claim is asserted but, rather the "cause for action, meaning the underlying facts combined with the law giving the party a right to a remedy of one form or another based thereon."). Accordingly, the fact that a writ of mandamus is a remedy, not a cause of action, is irrelevant for res judicata purposes.

B.
Plum Creek argues although it could have litigated its damages in the mandamus action, it has the option of either seeking damages at the same time it seeks mandamus or seeking damages at later time without violating the principles of res judicata.[5] Plum Creek contends the permissive nature of Rule 65(f)(2), SCRCP, provides this option. We disagree.
Rule 65(f)(2), SCRCP, provides: "Damages; Costs; Fees. A claim for any other relief to which a party may be entitled in the action may be joined with a claim for writ of mandamus, *37 habeas corpus, or other remedial writ, in accordance with these rules, including a claim for damages ...". (emphasis added).
Prior to the South Carolina Rules of Civil Procedure, a petition for writ of mandamus was initiated by a petition for a rule to show cause, rather than by a summons and complaint. See Doty v. Reed, 212 S.C. 231, 47 S.E.2d 451 (1948) (plaintiff petitioned for rule to show cause for mandamus); Evans v. Creech, supra (plaintiff filed petition and Court issued rule to show cause why mandamus should not be granted). Accordingly, the predecessor to Rule 65(f)(2), SCRCP, provided as follows: "In case a verdict shall be found for the person suing such writ [of mandamus] ... he shall recover his damages and costs as he might have done in a civil action." S.C.Code Ann. § 15-57-30 (1977) (emphasis added).[6] The "mandatory" language of Section 15-57-30 specified damages could be recovered "as in a civil action," even though the action was initiated by a petition for a rule to show cause; it did not, however, govern the timing of an action for damages.
Similarly, Rule 65(f)(2), SCRCP, provides damages may be recovered in a mandamus action. The rule does not, however, govern the timing of an action for damages. The term "may" does not provide a plaintiff with the option of seeking damages at the same time it seeks mandamus or in a subsequent action.

C.
Plum Creek argues because it could not have known the full extent of its damages at the time it sought mandamus, res judicata does not bar it from maintaining a second action for damages. Plum Creek relies on Moseley v. Welch, 218 S.C. 242, 62 S.E.2d 313 (1950). We disagree.
In Moseley v. Welch, in a prior action decided unfavorably to appellants, a lower court had held parents were not entitled to send their children to school in a particular district unless they owned property and paid taxes in the district. Thereafter, *38 appellants acquired real estate and paid taxes in a certain school district and then intervened in a pending action, arguing they were entitled to send their children to school in the district. The Court concluded res judicata did not bar appellants' action because new facts, the acquisition of property and payment of taxes in the new school district, had altered the legal rights of the parties.
Unlike the appellants in Moseley v. Welch, Plum Creek's legal position has not changed since the issuance of the writ of mandamus. Plum Creek cannot file a new action based on the same breach of contract and breach of easement agreement simply because its damages significantly and unexpectedly increased after City failed to abide by the writ. 46 Am.Jur.2d Judgments § 567 (1994) ("Where, after the rendition of a judgment, subsequent events occur, creating a new legal situation or altering the legal rights or relations of the litigants, the [initial] judgment may thereby be precluded from operating as an estoppel."); see also Restatement (Second) Judgments § 25, comment c (1982) ("... if a plaintiff who has recovered a judgment against a defendant in a certain amount becomes dissatisfied with his recovery and commences a second action to obtain increased damages, the court will hold him precluded; his claim has been merged into the judgment and may not be split."). As noted by the Court of Appeals, Plum Creek's remedy for City's failure to comply with the mandamus order was to petition the lower court for compensatory contempt. Curlee v. Howle, 277 S.C. 377, 386, 287 S.E.2d 915, 919 (1982) ("Compensatory contempt is a money award for the plaintiff when the defendant has injured the plaintiff by violating a previous court order. The goal is to indemnify the plaintiff directly for harm the contemnor caused by breaching the injunction.").

D.
Plum Creek contends a subsequent action for damages should be allowed after a successful mandamus action for the same reason a subsequent action for damages following a successful declaratory judgment action is permitted. We disagree.
*39 In Robison v. Asbill, 328 S.C. 450, 492 S.E.2d 400 (Ct.App. 1997), the Court of Appeals held where a party only seeks declaratory relief in a declaratory judgment proceeding, he is not barred from seeking damages in a subsequent action. Recognizing a declaratory judgment action declares the rights and duties or the status of the parties but does not involve coercive relief,[7] the Court of Appeals held res judicata does not bar a party from seeking damages as a form of coercive relief in a second action based on the same claim as the first, even though the right to damages had accrued before the declaratory judgment action began. See 22A Am.Jur.2d Declaratory Judgments § 240 (1988).
Contrary to declaring parties' respective rights and duties in a declaratory judgment action, a writ of mandamus is coercive. Willimon v. City of Greenville, 243 S.C. 82, 132 S.E.2d 169 (1963) (primary purpose of mandamus is to enforce an established legal right and corresponding imperative duty imposed by law); Godwin v. Carrigan, supra (1955) (mandamus is employed to compel performance, when refused, of a ministerial duty); 55 C.J.S. Mandamus § 3 (1998) (mandamus is used to compel action and to coerce the performance of an existing duty); 52 Am.Jur.2d Mandamus § 1 (1970) (mandamus is essentially a coercive writ). By issuing a writ of mandamus, the trial judge orders a public official to perform a ministerial duty. See Redmond v. Lexington County School Dist. Four, 314 S.C. 431, 445 S.E.2d 441 (1994). If the public official fails to comply with the writ, the plaintiff can petition the court for an order holding the official in contempt. See Discussion C. Accordingly, unlike an order which solely declares a parties' respective rights and duties, damages to coerce a public official to perform in accordance with the terms of the writ of mandamus are unnecessary.

E.
Plum Creek argues the Court should adopt an exception to res judicata to permit a party who has been granted mandamus to bring a subsequent action for damages arising out of the subject matter of the mandamus proceedings. We decline to adopt such an exception. *40 We find it appropriate to emphasize Plum Creek is not left without a remedy for City's persistent failure to abide by the writ of mandamus. Plum Creek may still initiate a compensatory contempt proceeding against City.[8]
AFFIRMED AS MODIFIED.
TOAL, Acting C.J., MOORE, WALLER, JJ., and Acting Associate Justice COSTA M. PLEICONES, concur.
NOTES
[1]  The filing of a notice of appeal does not automatically stay a writ of mandamus. Dorchester County School Dist. Three v. Dorchester County Council, 289 S.C. 475, 347 S.E.2d 93 (1986).
[2]  The parties are identical and the issue of Plum Creek's right to utility service without annexation had been previously adjudicated.
[3]  As noted by Professor Flanagan, South Carolina courts use various tests in determining whether a claim should have been raised in a prior suit: 1) when there is identity of the subject matter in both cases; 2) where the cases involve the same primary right held by the plaintiff and one primary wrong committed by the defendant; 3) when there is the same evidence in both cases; and recently 4) when the claims arise out of the same transaction or occurrence. South Carolina Civil Procedure, pp. 649-50. Under any of these tests, Plum Creek could have sought damages at the same time it sought mandamus.
[4]  Plum Creek asserts the Court of Appeals overlooked Griggs v. Griggs, 214 S.C. 177, 51 S.E.2d 622 (1949), in holding both actions involved the same subject matter. In Griggs, the Court held res judicata did not bar the defendant from pleading adverse possession where in the first action as plaintiff she had alleged breach of deed agreement. The Court noted different facts and evidence were necessary to support the different causes of action, adverse possession and breach of deed agreement. Here, however, Plum Creek's causes of action in each suit are the same; it simply seeks different remedies.
[5]  It is undisputed Plum Creek could have sought monetary damages at the same time it sought a writ of mandamus. Rule 65(f)(2), SCRCP ("[a] claim for any other relief to which a party may be entitled in the action may be joined with a claim for writ of mandamus ..."); see Drawdy v. Town of Port Royal, 308 S.C. 462, 419 S.E.2d 215 (1992); Godwin v. Carrigan, 227 S.C. 216, 87 S.E.2d 471 (1955); see also, 73 A.L.R.2d 903 (1960).
[6]  Under the common law, damages were not recoverable in a mandamus proceeding. 55 C.J.S. Mandamus § 375 (1998). In South Carolina, damages have been recoverable in mandamus proceedings since 1712 when the General Assembly adopted the English Statutes Made of Force. 1712 Acts 569.
[7]  See S.C.Code Ann. § 15-53-20 (1977).
[8]  There is no statute of limitations on contempt proceedings and City certainly has not been prejudiced by any delay. See State v. Bowers, 270 S.C. 124, 241 S.E.2d 409 (1978).
