
910 A.2d 1243 (2006)
Randall MEIER
v.
TOWN OF LITTLETON and another.
No. 2005-399.
Supreme Court of New Hampshire.
Argued: May 17, 2006.
Opinion Issued: November 3, 2006.
*1244 Upton & Hatfield, LLP, of Concord (David P. Slawsky on the brief and orally), for the plaintiff.
Devine, Millimet & Branch, P.A., of Manchester (Donald E. Gardner and Donald L. Smith on the brief, and Mr. Gardner orally), for defendant Town of Littleton.
Kelly A. Ayotte, attorney general (Stephen G. LaBonte, attorney, on the brief and orally) for defendant State of New Hampshire.
BRODERICK, C.J.
The plaintiff, Randall Meier, appeals a ruling of the Superior Court (Burling, J.) dismissing his suit against the defendants, the Town of Littleton (town) and the State of New Hampshire (State), on grounds of res judicata. We reverse and remand.
The facts are not in dispute. Raymond P. Zolton, individually and as the executor of his wife's estate, sued all the parties in this case to recover for his personal injuries and for the death of his wife. The suit arose from a traffic accident in which Randall Meier struck the Zoltons with his truck while they were crossing Main Street in Littleton at a crosswalk that was allegedly improperly designed. Meier filed a brief statement asserting several defenses, including that: "[t]he carelessness, *1245 recklessness and negligence of a person or persons other than [him were] the sole proximate cause of the plaintiffs' damages, if any."
The case settled before trial, and all parties stipulated that the docket be marked: "Neither party. No costs. No interest. No further action for the same cause." In exchange for the settlement, Zolton executed releases in favor of all the defendants, but neither the town nor the State requested Meier to execute a release in its favor.
Shortly after the docket markings were filed, Meier initiated this action against the town and the State, his former co-defendants. He claimed to have suffered damages  emotional harm and loss of income  as a result of the negligence of the town and the State in creating the deficient crosswalk the Zoltons were using at the time of the accident. He does not seek indemnification or contribution for the settlement he paid Zolton. The town, joined by the State, moved to dismiss Meier's suit on grounds of res judicata. The trial court granted the motion, and this appeal followed.
Meier argues that res judicata does not apply because the claims he raises in this case could only have been raised in the prior case (hereinafter Zolton) as cross-claims, and in New Hampshire, cross-claims are permissive rather than compulsory. He contends that by enforcing the res judicata bar in this case, we would, in effect, be instituting a compulsory cross-claim rule.
The applicability of res judicata is a question of law we review de novo. Berthiaume v. McCormack, 153 N.H. 239, 244, 891 A.2d 539 (2006). Res judicata precludes the litigation in a later case of matters actually decided, and matters that could have been litigated, in an earlier action between the same parties for the same cause of action. In re Juvenile 2004-637, 152 N.H. 805, 808, 888 A.2d 422 (2005). For the doctrine to apply, three elements must be met: (1) the parties must be the same or in privity with one another; (2) the same cause of action must be before the court in both instances; and (3) a final judgment on the merits must have been rendered in the first action. Id.
While the docket markings in Zolton are not a final judgment on the merits for the purpose of applying collateral estoppel, see Waters v. Hedberg, 126 N.H. 546, 549, 496 A.2d 333 (1985), they are a final judgment for the purpose of applying res judicata, see Cathedral of the Beechwoods v. Pare, 138 N.H. 389, 391, 639 A.2d 1098 (1994). Therefore, resolution of this case turns upon two issues: whether this case and Zolton are actions between the same parties and whether the two cases are for the same cause of action. See In re Juvenile, 152 N.H. at 808, 888 A.2d 422.
The record before us reveals that this case and Zolton are not actions between the same parties. The plaintiff and the defendants in this case were all parties to Zolton, but that case was between Zolton and all of the parties to this case, while this case is between one Zolton defendant and his two codefendants. In an opinion both parties rely upon, and we find persuasive, the United States Court of Appeals for the Sixth Circuit explained:
Michigan recognizes that for res judicata to apply, both actions must involve the same parties or their privies. The same parties means adversarial parties. Generally, codefendants are not adversaries for the purposes of res judicata, even though a codefendant could have filed a cross-claim against the other defendant. Adverse parties have been defined as those who, by the pleadings, are arrayed on opposite sides. Opposite sides in this *1246 sense is not restricted to the plaintiffs against the defendants, since codefendants having a controversy inter se may come within such a classification.
Executive Arts v. City of Grand Rapids, 391 F.3d 783, 795 (6th Cir.2004) (emphasis added; brackets and quotations omitted). In Executive Arts, the court held that because "the City and Executive Arts [former co-defendants and current adversaries] did not have any controversy between themselves when the first decision was rendered . . . there can be no claim preclusion." Id. (footnote omitted).
As in Executive Arts, there is no evidence that the plaintiff and defendants in this case were actual adversaries in Zolton. There is little doubt that each Zolton defendant preferred that its co-defendants bear as much of the liability as possible for Zolton's damages and that all three Zolton defendants negotiated toward that end during settlement discussions. However, the town and the State have not shown (or argued) that they and Meier were ever formally arrayed on the opposite side of any issue in the Zolton pleadings. See Executive Arts, 391 F.3d at 795.
Not only are this case and Zolton not actions between the same parties, they are not for the same cause of action. The term "cause of action" is defined as the right to recover, regardless of the theory of recovery. McNair v. McNair, 151 N.H. 343, 353, 856 A.2d 5 (2004). The right to recover adjudicated in Zolton was Zolton's right to damages from the three parties whose alleged negligence caused Zolton's injuries and his wife's death. The right to recover at issue in this case is Meier's right to recover from the two parties whose alleged negligence caused his emotional distress and economic losses. Those two rights  Zolton's right to recover from Meier, the town and the State, and Meier's right to recover from the town and the State  are not the same. Hence, they are different causes of action.
Our cases do contain language suggesting a somewhat more expansive definition of "cause of action." For example, we have stated that "the term [cause of action] connotes facts which give rise to one or more relations of right-duty between two or more persons." Eastern Marine Const. Corp. v. First Southern Leasing, 129 N.H. 270, 275, 525 A.2d 709 (1987) (brackets and quotation omitted). But Eastern Marine involved successive suits based upon different legal theories brought by the same plaintiff against the same defendant, id. at 272-73, 525 A.2d 709, not, as here, a suit making a claim that could only have been raised as a cross-claim in the previous suit. More recently, we stated that "[i]n determining whether two actions are the same cause of action for the purpose of applying res judicata, we consider whether the alleged causes of action arise out of the same transaction or occurrence." Appeal of Univ. System of N.H. Bd. of Trustees, 147 N.H. 626, 629, 795 A.2d 840 (2002). However, for the proposition quoted above, we cited the Restatement, which explains that "if more than one party has a right to relief arising out of a single transaction, each such party has a separate claim for purposes of merger and bar." Restatement (Second) of Judgments § 24 comment a at 198 (1982). That is the situation here; Zolton and Meier each had a potential right to relief arising from the Littleton traffic accident, and so each had a separate claim for purposes of res judicata. While "arising out of the same transaction or occurrence" is necessary to establish that two causes of action are the same, it is not sufficient, and we have never held it to be.
We conclude by addressing the defendants' two principal arguments contending *1247 that the causes of action in Zolton and this case are the same. First, the town argues that our decision in Osman v. Gagnon, 152 N.H. 359, 876 A.2d 193 (2005), requires us to hold that res judicata applies in this case. We disagree. In Osman, a homeowner's breach of contract claim against a flooring contractor was barred because that claim could have been raised as a defense to the contractor's claim against the homeowner's former spouse for breach of the same contract. Id. at 362-63, 876 A.2d 193. In deciding Osman, we explained that a final judgment eliminates as a basis for future litigation every defense that was or might have been raised in the concluded litigation. Id. at 362, 876 A.2d 193. Meier's current claim that he was injured by the alleged negligence of the town and the State might have been a defense to Zolton's claim that he and his wife were injured as a result of Meier's negligence. However, in light of the Restatement view that every party with a right to relief from a single transaction has a "separate claim for purposes of merger and bar," Restatement (Second) of Judgments § 24 comment a at 198, we decline to extend the rule stated in Osman, in which the defense that might have been raised could have also been raised as a counterclaim, to the circumstances of this case, in which the defense that might have been raised could only have been raised as a permissive cross-claim.
Second, the town argues that a ruling in favor of Meier would impede judicial economy. Again, we disagree. There are facts unique to Meier's case. It is not clear that judicial economy would have been enhanced by requiring Meier to add his claims against the town and the State to a case that was already complicated by the presence of three different defendants and multiple theories of liability.
Because res judicata does not bar the plaintiff's suit against the town and the State, the trial court erred in granting the defendants' motion to dismiss. Accordingly, we reverse and remand.
Reversed and remanded.
DALIANIS, DUGGAN and HICKS, JJ., concurred.
