The plaintiff seeks to recover approximately $18,000 paid by him over a period of nine years to the Department of Public Welfare as support for a child he subsequently discovered was not his.
In July, 1990, the plaintiff filed this action against the Department of Public Welfare and the Department of Revenue (departments) alleging unjust enrichment. The departments’ motion to dismiss was denied on December 13, 1990. Once discovery was complete, in October, 1991, the action lay dormant until the plaintiff filed a request for a trial date on June 13, 1994.
*379On August 11, 1994, the departments moved for summary judgment, arguing: (1) lack of subject matter jurisdiction; (2) recovery was barred by the holding of Department of Revenue v. W.Z., 412 Mass. 718 (1992); and (3) the plaintiff had failed to prosecute with reasonable diligence. A Superior Court judge allowed the departments’ motion for summary judgment for the reasons set forth in their motion and memorandum. After a timely appeal we transferred the case here on our own motion. We affirm.
On January 9, 1980, the plaintiff signed an agreement in which he acknowledged that he was the father of the child in question and agreed to pay thirty dollars per week in child support. Because the child and the mother were on public assistance, the Department of Public Welfare was subrogated to the child’s right to support. G. L. c. 18, § 21 (1994 ed.). Two years later, on September 24, 1982, the plaintiff signed a second, notarized acknowledgment of paternity. He also signed another document again agreeing to pay the Department of Public Welfare a weekly amount of thirty dollars toward the child’s support.
On April 20, 1988, after the enactment of G. L. c. 209C (1994 ed.), the Department of Revenue filed a civil paternity and support action against the plaintiff. In the course of this action, the plaintiff, the mother, and the child submitted to blood tests, which showed that the plaintiff was not the father of the child. The Department of Revenue then dismissed its G. L. c. 209C action and discontinued the plaintiff’s wage assignment.
The plaintiff then requested from the Department of Revenue a refund of the child support monies that he had paid to the Department of Public Welfare since January, 1980, or alternatively, an administrative hearing on the matter. The Department of Revenue denied both requests on July 13, 1989, and the present lawsuit ensued.
The issue raised in this case is closely analogous to the question presented in Department of Revenue v. W.Z., 412 Mass. 718 (1992).2 In that case the defendant pleaded guilty *380in a civil nonsupport action and was adjudicated the father of a child later determined not to be his.
Our decision in Department of Revenue v. W.Z. relied on principles of issue preclusion as barring the defendant from contesting his paternity as to past payments. Id. at 721. Although there can be no issue preclusion without a final judgment (Restatement [Second] of Judgments § 13 [1982]), it is nevertheless true that the plaintiff here made these payments voluntarily without taking advantage of the opportunity to contest the fact of his paternity. We must therefore decide whether in this equitable action the result should be different where a person voluntarily acknowledged his paternity without a criminal complaint for nonsupport, G. L. c. 273, § 15 (1994 ed.), or a civil action to establish and enforce support, G. L. c. 209C, § 5, having been brought against him. We conclude that this is a distinction without a difference.
By choosing not to contest paternity and agreeing to a sum for support the plaintiff avoided the possibility of having to pay more if a nonsupport action were brought against him. This is similar to an obligation assumed by a party to an action as part of an out-of-court settlement. See Strand v. Herrick & Smith, 396 Mass. 783, 786 (1986). Such an agreement is valid regardless of the actual viability of one party’s claim as long as both sides believe in the viability of the claim. Margolies v. Hopkins, 401 Mass. 88, 91 (1987). Evidence discovered after such a settlement is made does not invalidate the settlement as long as the parties acted in good faith at the time the agreement was made. See id.
Thus, by freely admitting his paternity, the plaintiff avoided legal proceedings which would have adjudicated the matter and, in addition, he settled the amount of his support obligation. In these circumstances the plaintiff has failed to establish a claim that he is entitled to a return of the money paid.
Judgment affirmed.
We assume for the purposes of this discussion that the Superior Court had subject matter jurisdiction. The departments also argue that the claim is barred by sovereign immunity. This argument was not raised below, and as we affirm the motion for summary judgment on other grounds, we do not reach this issue.