
601 N.W.2d 360 (1999)
Patrick SANFORD, Appellant,
v.
Jerome MANTERNACH, Larry Brimeyer, John Thalacker, John Sissel and State Of Iowa, Appellees.
No. 97-1769.
Supreme Court of Iowa.
October 13, 1999.
*361 Philip B. Mears of Mears Law Office, Iowa City, for appellant.
Thomas J. Miller, Attorney General, and William H. Hill, Assistant Attorney General, for appellees.
Considered by McGIVERIN, C.J., and LARSON, NEUMAN, SNELL, and TERNUS, JJ.
TERNUS, Justice.
The plaintiff, Patrick Sanford, was formerly an inmate of a minimum security facility in Iowa. He sued the State and prison officials, claiming damages from the imposition of excessive discipline for his violation of prison rules. The district court granted the State's motion to dismiss and entered summary judgment for the *362 individual defendants. Upon Sanford's appeal, we affirm the dismissal of his claim against the State, but reverse the adverse summary judgment ruling and remand for further proceedings.

I. Background Facts and Proceedings.

The facts in this case are undisputed. In 1994, Sanford was an inmate of the Luster Heights minimum security facility in Anamosa, Iowa. Shortly before his scheduled release, he received two disciplinary reports for theft. The disciplinary committee found him guilty of both charges and sanctioned him with a total of twenty days of disciplinary detention, 360 days in disciplinary detention I, and a loss of 1000 days of good-conduct time.
Lacking success in his administrative challenges to these decisions, Sanford filed petitions for postconviction relief, which were consolidated for trial. He challenged his convictions for reasons not pertinent here, and also alleged that his sanctions were excessive, arbitrary, and capricious. The district court upheld Sanford's convictions, but ruled that the loss of 1000 days of good-conduct time was excessive. The district court remanded the cases to the Iowa Department of Corrections (IDOC) for review and imposition of new sanctions not inconsistent with the court's ruling. Upon its review, the IDOC reduced Sanford's loss of good-conduct time to 465 days. Sanford's record was credited accordingly.
The unusual circumstances giving rise to the present civil suit result from the timing of the disciplinary charges and postconviction relief actions as it relates to Sanford's discharge date. Prior to the thefts in 1994, Sanford was scheduled to be discharged on May 28, 1994. Due to the sanctions imposed for his rule violations, he was not discharged until October 6, 1995. The district court's ruling on his postconviction relief petitions was issued after Sanford was discharged. When prison authorities credited him with the good-conduct time they restored upon reconsideration of his sanctions, his official discharge date was changed to February 6, 1995.
Sanford filed this action to recover damages for the time he spent in prison between February 6, 1995, the date he claims he should have been discharged, and the date of his actual discharge, October 6, 1995. He has sued the prison officials who imposed and upheld his disciplinary sanctions: the administrative law judges, Jerome Manternach and Larry Brimeyer; the warden, John Thalacker; and the assistant warden, John Sissel. Sanford has alleged they deprived him of a constitutionally protected liberty interest by imposing excessive sanctions for his rule infractions. See 42 U.S.C. § 1983. Sanford has also sued the State, claiming the State breached a duty under Iowa Code section 903A.3(1) (1993) to have internal guidelines established for determining the loss of good-time credits.
The individual defendants filed a motion for summary judgment. In their motion, they asserted several reasons that Sanford's claim against them should be dismissed: (1) Sanford was not entitled to postconviction relief because his claims were moot due to his release from prison and, therefore, that relief should not be used as the basis for a damages claim; (2) any error in Sanford's discipline was remedied by the reconsideration and reduction of his sanctions; (3) Sanford is precluded from bringing a claim for damages because the underlying convictions and sanctions were not reversed or invalidated; (4) an inmate's interest in good-conduct time is not a liberty interest protected by the Fourteenth Amendment; and (5) the individual defendants are entitled to qualified immunity.
The district court specifically rejected the first two arguments alleging mootness and the prior remediation of any error. The court did, however, hold that a prisoner's claim under § 1983 was not cognizable unless the plaintiff could demonstrate that *363 his conviction or sentence had been previously invalidated. See Heck v. Humphrey, 512 U.S. 477, 486-87, 114 S.Ct. 2364, 2372, 129 L.Ed.2d 383, 394 (1994). Concluding that Sanford's disciplinary convictions and sanctions had not been reversed or invalidated, but merely remanded for reconsideration, the district court held that Sanford was precluded under Heck from bringing a claim pursuant to § 1983. The court did not consider the defendants' remaining arguments based on the absence of a liberty interest in good-conduct time and qualified immunity.
The State filed a motion to dismiss, alleging that it owed no duty to Sanford and that section 903A.3(1) did not create a private cause of action for the recovery of damages. Applying the four-factor test used in Marcus v. Young, 538 N.W.2d 285, 288 (Iowa 1995), the district court concluded that the legislature did not intend to create a private remedy under chapter 903A and, therefore, the plaintiff had failed to state a claim upon which relief could be granted.
The plaintiff appealed the court's rulings. The arguments on appeal mirror those made in the district court with one exception. The individual defendants have not asserted on appeal that they are entitled to qualified immunity. We will discuss the remaining issues separately.

II. Standard of Review.

A. Summary judgment. Review of a ruling on a summary judgment motion is for correction of errors of law. See Continental Ins. Co. v. Bones, 596 N.W.2d 552, 555 (Iowa 1999). We determine whether there are any genuine disputes with respect to material facts and whether the moving party is entitled to judgment as a matter of law. See Iowa R. Civ. P. 237(c). Because the facts pertinent to the issues raised in the summary judgment motion are undisputed, our only task on appeal is to decide whether the district court correctly applied the law when it granted the defendants' motion.
B. Motion to dismiss. The supreme court reviews the district court's granting of a motion to dismiss for errors of law. See Iowa Tel. Ass'n v. City of Hawarden, 589 N.W.2d 245, 250 (Iowa 1999). The ruling must rest on legal grounds. See id. The plaintiff's failure to state a claim upon which relief can be granted is properly raised in a motion to dismiss. See Iowa R. Civ. P. 88(a) (1998). We view the petition in the light most favorable to the plaintiff, and will uphold dismissal only if the plaintiff's claim could not be sustained under any state of facts provable under the petition. See Below v. Skarr, 569 N.W.2d 510, 511 (Iowa 1997).

III. Summary Judgment Ruling § 1983 Claim.

A. Is the plaintiff's claim moot? The defendants claim that Sanford's § 1983 claim for damages is moot because he was discharged prior to the adjudication of his postconviction relief actions. They argue that any relief Sanford received as a result of those actions was "erroneously granted" because Sanford had already been released. Therefore, the defendants assert, Sanford should not be allowed to use that relief as a basis for his claim for damages. Their authority for this conclusion is our decision in a prison disciplinary case, Wilson v. Farrier, 372 N.W.2d 499, 501 (Iowa 1985), wherein we held that a postconviction relief action is moot if an inmate has already been paroled or discharged.
Although the defendants state that the present action is moot, their argument and authority are directed to the mootness of Sanford's original postconviction relief actions. They claim that those actions were moot when they were decided and, therefore, the district court should not have entered a ruling in the postconviction relief cases. The fact is, however, that the district court did enter a ruling and the State did not appeal that ruling. Thus, the defendants' argument in this case is actually *364 a collateral attack on that prior judgment. See Brown v. Tank, 230 Iowa 370, 375, 297 N.W. 801, 803 (1941) ("`[A] collateral attack upon a judgment is an attack made by or in an action or proceeding that has an independent purpose other than the impeaching or overturning of the judgment, although impeaching or overturning the judgment may be necessary to the success of the action ....'") (quoting 31 Am.Jur. Judgments § 611, at 205 (now found at 47 Am.Jur.2d Judgments § 906, at 377-78 (1995))).
Our prior case law is clear that a judgment is not subject to collateral attack except on jurisdictional grounds. See Fetters v. Degnan, 250 N.W.2d 25, 30 (Iowa 1977). The defendants here do not claim that the district court in the postconviction relief actions lacked subject matter jurisdiction or personal jurisdiction. They simply assert that the prior judgment was erroneous because Sanford's claims were moot. But mere error in a judgment is not reviewable in a collateral proceeding. See Marshfield Homes, Inc. v. Eichmeier, 176 N.W.2d 850, 851 (Iowa 1970); see also 46 Am.Jur.2d Judgments § 498, at 760 (1994) (stating an error in the judgment does not deprive the judgment of finality or conclusiveness). Accordingly, we agree with the district court that the defendants' mootness argument is without merit.
B. Does Sanford have a protected liberty interest in good-time credits? The Due Process Clause of the Fourteenth Amendment provides that no State shall "deprive any person of life, liberty or property, without due process of law." U.S. Const. amend. XIV, § 1; see also Wolff v. McDonnell, 418 U.S. 539, 556, 94 S.Ct. 2963, 2974, 41 L.Ed.2d 935, 951 (1974) (stating that the Due Process Clause applies to prisoners). Section 1983 provides a statutory cause of action for a person who claims such a deprivation:
Every person who, under color of any statute, ordinance, regulation, custom, or usage, of any State or Territory or the District of Columbia, subjects, or causes to be subjected, any citizen of the United States or other person within the jurisdiction thereof to the deprivation of any rights, privileges, or immunities secured by the Constitution and laws, shall be liable to the party injured in an action at law, suit in equity, or other proper proceeding for redress.
42 U.S.C. § 1983. In order to establish that he has suffered a deprivation of his due process rights, however, a plaintiff must first establish that he has a liberty interest of constitutional dimension. See Olim v. Wakinekona, 461 U.S. 238, 250, 103 S.Ct. 1741, 1748, 75 L.Ed.2d 813, 823 (1983). Thus, the initial question that must be answered is whether Sanford has a liberty interest in his earned good-time credits that is protected by the Fourteenth Amendment.
This court has frequently stated that a liberty interest is created by Iowa's law providing for good-time credits. See, e.g., Marshall v. State, 524 N.W.2d 150, 152 (Iowa 1994) ("This court has long recognized that minimum requirements of procedural due process must be observed before good time earned by an inmate can be forfeited."); LuGrain v. State, 479 N.W.2d 312, 315 (Iowa 1991) ("Iowa law permits an inmate to earn good conduct time credits.... That being the case, the inmate has a constitutionally protected liberty interest in those credits."); Picard v. State, 339 N.W.2d 368, 373 (Iowa 1983) ("Minimum requirements of procedural due process must be observed before good time earned by an inmate can be forfeited."). Notwithstanding these cases, the Eighth Circuit Court of Appeals recently suggested a contrary conclusion in Moorman v. Thalacker, 83 F.3d 970, 973 (8th Cir.1996), relying in part on the United States Supreme Court's decision in Sandin v. Conner, 515 U.S. 472, 115 S.Ct. 2293, 132 L.Ed.2d 418 (1995). The defendants rely heavily on these two cases to support their argument that Sanford has no liberty interest in his good-conduct time. Therefore, we will reconsider our prior decisions *365 on this issue in light of the Sandin and Moorman opinions.
Our analysis begins with Wolff v. McDonnell, wherein the United States Supreme Court first considered whether an inmate's interest in good-time credits was constitutionally protected. The Court held in Wolff that, where a state has created a right to good-conduct time, that right is embraced within the liberty interest protected by the Fourteenth Amendment. 418 U.S. at 557, 94 S.Ct. at 2975, 41 L.Ed.2d at 951. Under those circumstances, a prisoner who has been deprived of good-time credits without due process of law may properly bring a claim for damages under § 1983. See id. at 554-55, 94 S.Ct. at 2974, 41 L.Ed.2d at 949-50. The Court concluded that the State of Nebraska had created a right to good-conduct time that was revocable only upon the prisoner's serious misconduct, and that a prisoner's interest in good-conduct time had "real substance." Id. at 557, 94 S.Ct. at 2975, 41 L.Ed.2d at 951. Therefore, the Court held, the prisoner was entitled to the protection of the minimum procedures required by the Due Process Clause. Id.
Although there are intervening United States Supreme Court cases on this issue, we next examine the Court's most recent opinion on this topic, Sandin v. Conner. In Sandin, the inmate, Conner, complained that he was denied due process after a prison disciplinary committee had denied his request to present witnesses at a disciplinary hearing. 515 U.S. at 475-76, 115 S.Ct. at 2296, 132 L.Ed.2d at 424-25. The discipline at issue in Sandin was the prisoner's segregation for misconduct. Id. at 486, 115 S.Ct. at 2301, 132 L.Ed.2d at 431. The issue for the Court's decision was whether the State of Hawaii had created a liberty interest in an inmate to remain free from disciplinary segregation. Id. at 474-75, 115 S.Ct. at 2295-96, 132 L.Ed.2d at 424. The Court discussed that, in the years since Wolff was decided, the Court had shifted its focus to an inquiry "based on the language of a particular regulation, and not the nature of the deprivation," to determine whether a state had created a liberty interest. Id. at 479-83, 115 S.Ct. at 2298-300, 132 L.Ed.2d at 426-29. The Court disapproved of this change and rejected an analysis based on the mandatory versus discretionary language of the relevant state statute or regulation, and held that the principles established in Wolff should govern any inquiry into whether a liberty interest had been created by the state. Id. at 483, 115 S.Ct. at 2300, 132 L.Ed.2d at 429.
Consequently, in considering Conner's claim, the Court focused on "the nature of the deprivation" rather than on the "language of a particular regulation." Id. at 481-87, 115 S.Ct. at 2298-302, 132 L.Ed.2d at 428-32. The Court observed that liberty interests "will be generally limited to freedom from restraint which ... imposes atypical and significant hardship on the inmate in relation to the ordinary incidents of prison life." Id. at 484, 115 S.Ct. at 2300, 132 L.Ed.2d at 430. Applying this test to Conner's claim, the Court held that he did not have a liberty interest in being free from segregated confinement. Id. at 487, 115 S.Ct. at 2302, 132 L.Ed.2d at 432. The Court relied on two factors in reaching this conclusion. First, the discipline imposed on Conner did not result in an atypical or significant hardship because it did "not present a dramatic departure from the basic conditions of Conner's indeterminate sentence," nor did it "exceed similar, but totally discretionary, confinement in either duration or degree of restriction." Id. at 485-86, 115 S.Ct. at 2301, 132 L.Ed.2d at 431. Secondly, "Conner's situation [did not] present a case where the State's action will inevitably affect the duration of his sentence." Id. at 487, 115 S.Ct. at 2302, 132 L.Ed.2d at 432.
Before turning to the facts before us, we briefly consider the Moorman case cited by the State. In Moorman, the United States Court of Appeals for the Eighth Circuit stated that to consider good-time credits as liberty interests "the state must *366 have created a mandatory scheme which necessarily affects the duration of a prisoner's sentence." 83 F.3d at 973 (emphasis added). The court concluded, in dicta, that "given its highly discretionary nature, it is unclear that Iowa's statutory scheme creates a liberty interest in good time." Id. (emphasis added). We respectfully disagree with the mandatory/discretionary analysis employed by the court of appeals to reach this conclusion because this analytical framework is simply not appropriate under Sandin.
We now consider whether Sanford has a liberty interest, using the principles set forth in Sandin and Wolff. It is important at this juncture to precisely identify the right that Sanford asserts as the basis for his liberty interest. Sanford's claim is grounded on his right to a reduction in his sentence based on the good-conduct time that he has already earned, as opposed to a right to earn good-time credits in the first instance. See Cardenas v. Wigen, 921 F.Supp. 286, 292 (E.D.Pa.1996) (distinguishing between loss of good-time credits, which lengthens an inmate's sentence, and discipline that only detrimentally affects an inmate's ability to earn good-time credits). Compare Hamlin v. Vaudenberg, 95 F.3d 580, 584 (7th Cir.1996) (holding that inmate "sufficiently alleged a protectible property interest because his lost good time credits may very well have `affected the duration of his sentence'"), with Alley v. Angelone, 962 F.Supp. 827, 834 (E.D.Va. 1997) (holding inmate has no liberty interest in earning good-conduct allowance). But see State v. Grimme, 274 N.W.2d 331, 336 (Iowa 1979) ("Even a prisoner's interest in earning good time credit is a protected liberty.") (dicta). We start our analysis of Sanford's claim with a review of the relevant Iowa statutes.
Iowa Code chapter 903A provides for the reduction of a prisoner's sentence under various circumstances. One of the situations addressed in this statute is an inmate's eligibility "for a reduction of sentence of one day for each day of good conduct." Iowa Code § 903A.2. Any good-conduct time earned may be forfeited by the inmate for the violation of an institutional rule at the discretion of an administrative law judge; the amount of time to be forfeited is "based upon the severity of the violation." Id. § 903A.3(1). Pursuant to these statutes, Sanford accrued good-conduct time that was later forfeited by institutional authorities as part of sanctions subsequently ruled to be excessive.
We conclude that Sanford had an interest of "real substance," see Wolff, 418 U.S. at 557, 94 S.Ct. at 2975, 41 L.Ed.2d at 951, in the reduction of his sentence for good-conduct time. Unlike the situation in Sandin where the inmate's segregated confinement did not affect the duration of the prisoner's sentence, the forfeiture of good-time credits here directly affected the duration of Sanford's imprisonment. Unlike Sandin, the discipline here did not simply affect the type of restriction imposed on the inmate, it affected whether there was any restriction on the inmate. Consequently, we think the nature of the interest here is fundamentally different from the interest considered in Sandin. See generally id. at 547, 94 S.Ct. at 2970, 41 L.Ed.2d at 946 (noting that the Nebraska statute governing prisoner misconduct provides for "two kinds of punishment[:] ... the forfeiture or withholding of good-time credits, which affects the term of confinement, [and] confinement to a disciplinary cell, [which] involves alteration of the conditions of confinement" (emphasis added)).
Additionally, we conclude an Iowa inmate's interest in the reduction of his sentence for good-conduct time is no different from the Nebraska inmate's interest in good-time credits found to be of constitutional magnitude in Wolff. Although it is true that the Nebraska statute according good-time credits is couched in more mandatory language than the comparable Iowa statute, this distinction is not controlling under Sandin. Compare Neb.Rev.Stat. § 831,107 (Cum.Supp.1972) ("The chief *367 executive officers of a facility shall reduce, for parole purposes, for good behavior and faithful performance of duties while confined in a facility the term of a committed offender as follows:...." (Emphasis added.)), with Iowa Code § 903A.2 ("each inmate of an institution under the Iowa department of corrections[] is eligible for a reduction of sentence of one day for each day of good conduct of the inmate" (emphasis added)). Nor do we think this aspect of the statutes, dealing with the accrual of good time, is relevant to the right under consideration here, the forfeiture of good-time credits that have already accrued. Therefore, this dissimilarity in the Nebraska and Iowa statutes is of no significance.
We also recognize that the statutory provisions for forfeiture of good-time credits are not precisely the same under the Nebraska and Iowa statutes. Nebraska allowed good-time credits to be forfeited "[i]n cases of flagrant or serious misconduct." Neb.Rev.Stat. § 83185 (1971). In contrast, the Iowa law allows forfeiture "[u]pon finding that an inmate has violated an institutional rule"; the severity of the violation merely affects the amount of time forfeited. Iowa Code § 903A.3(1). We initially note that even under Iowa's scheme, an inmate's good-conduct time is protected from forfeiture in the absence of the inmate's misconduct. In that respect, the Nebraska and Iowa statutes are alike; they differ only with respect to the degree of misconduct that can result in forfeiture of good-time credits. Secondly, although Nebraska's limitation on the forfeiture of good-time credits can be interpreted as an acknowledgment by the state of the importance of these credits, the absence of such a limitation on the forfeiture of good-conduct time in Iowa does not diminish the importance to the inmate of the reduction in sentence that accompanies the accrual of good-conduct time. In other words, our focus is on the nature of the inmate's interest, not the state's assessment of that interest. Cf. Gotcher v. Wood, 66 F.3d 1097, 1100 (9th Cir.1995) (holding that a written disclaimer in correctional institution's policies that it did not intend to create a liberty interest could not emasculate the inmate's "right of `real substance'" in good-time credits). When viewed from the inmate's perspective, his interest in not forfeiting good-conduct time is substantial and significant regardless of the degree of misconduct that might result in forfeiture. See Orozco v. Day, 281 Mont. 341, 934 P.2d 1009, 1016 (1997) (holding that Montana had created a liberty interest in good time under a statute that allowed forfeiture of good-time allowances "[i]n the event of ... a violation of the rules prescribed by the department [of corrections] or warden").
For the foregoing reasons, we conclude that the nature of an inmate's interest in sentence reduction for good-conduct time is the same here as it was under the Nebraska statute considered in Wolff. Inmates' interests are of "real substance" under both statutory schemes because the forfeiture of good-time credits affects the duration of the inmates' sentences. See Whitlock v. Johnson, 982 F.Supp. 615, 617-18 (N.D.Ill.1997) (holding that inmate had a constitutionally protected interest in the loss of earned good-time credits, stating that Sandin "essentially reconfirmed that a liberty interest is implicated ... if `the State's action will inevitably affect the duration of his sentence'"); Burnell v. Coughlin, 975 F.Supp. 473, 475 (W.D.N.Y. 1997) (finding liberty interest in loss of good-time credits, citing Sandin for the proposition that "a restraint which `inevitably affect[s] the duration of [an inmate's] sentence' creates a liberty interest"); Haff v. Cooke, 923 F.Supp. 1104, 1119 (E.D.Wis. 1996) (holding that inmate's loss of good time required due process, without any examination of terms of state statute); Nelson v. McBride, 912 F.Supp. 403, 406 (N.D.Ind.1996) (holding, without an examination of Indiana statute, that good-time credits were a liberty interest, citing Sandin for the principle that a "liberty interest is present where action of the state will *368 inevitably affect the duration of the inmate's sentence"); Orozco, 934 P.2d at 1016 (holding that a liberty interest was created where "the good time provisions... directly affect the duration of inmates' confinement"). Consequently, the United States Supreme Court's opinion in Wolff is dispositive of the issue before us. Accordingly, we hold that Sanford has a liberty interest in his good-conduct time that is protected by the Due Process Clause of the Fourteenth Amendment.
C. Was any error in the disciplinary proceeding remedied in the postconviction relief action? The defendants claim that Sanford ultimately received due process because his discipline was corrected upon review by prison officials. They rely on a series of cases decided by the Eighth Circuit Court of Appeals: Ragan v. Lynch, 113 F.3d 875 (8th Cir.1997); Wycoff v. Nichols, 94 F.3d 1187 (8th Cir.1996); and Harper v. Lee, 938 F.2d 104 (8th Cir.1991).
In Harper, the Court of Appeals for the Eighth Circuit considered the claim of a prison inmate who had been disciplined after a hearing at which he was denied the opportunity to introduce certain documents. 938 F.2d at 104. The record showed that on appeal of his discipline to prison authorities, his case was remanded for a new hearing. Id. at 105. At the second hearing, he was allowed to put the contested documents into evidence, but was again found guilty. Id. The inmate then brought a § 1983 action for damages. Id. The district court ruled that the inmate had been denied due process. Id. On appeal to the Eighth Circuit, the court of appeals held that any error in not allowing the prisoner to introduce the disputed evidence was remedied by the second hearing at which the prisoner was allowed to put the documents into evidence. Id. at 105. As a result, the court concluded, the inmate "experienced no harm as a result of the initial denial of his right [to due process]." Id. at 105-06; accord Benadum v. Scurr, 320 N.W.2d 578, 580 (Iowa 1982).
In Wycoff, the prisoner was disciplined for a rule violation and lost good-time credits. 94 F.3d at 1188. On administrative appeal, his conviction was reversed and his good-time credits restored. Id. Nevertheless, the inmate commenced a § 1983 action for damages. Id. Relying on its decision in Harper, the court of appeals affirmed the district court's summary judgment ruling against the inmate. Id. at 1189-90. The court held that the prison's reversal of the disciplinary case and restoration of all good-time credits cured any due process violation that had occurred at the initial hearing. Id.
The Ragan case presented the Court of Appeals for the Eighth Circuit with a similar set of facts. In Ragan, the inmate lost good-conduct time in a disciplinary proceeding, but in a postconviction relief action, his conviction was reversed and his good-conduct time restored. 113 F.3d at 876. In a subsequent § 1983 action for damages, the district court granted summary judgment to the defendants. Id. This ruling was affirmed on appeal, the court of appeals ruling that the prisoner had suffered no injury and that, even if he did, any harm had been remedied by the expungement of his disciplinary record and the return of his good-time credits. Id. at 876-77.
We agree with the district court that these cases are distinguishable from the case at hand. In all three cases any damage to the inmate was remedied. In Harper, the due process violation was procedural and had been corrected in the second hearing. 938 F.2d at 104-05. Although the Wycoff and Ragan cases involved substantive deprivations, in other words, the inmate claimed the disciplinary decision itself was flawed, nothing in those decisions indicates that the inmates' discharge dates were delayed by the discipline that was subsequently reversed. See generally Edwards v. Balisok, 520 U.S. 641, 645, 117 S.Ct. 1584, 1587, 137 L.Ed.2d 906, 913 (1997) (noting the distinction between a claim for the denial of procedural due process *369 and a claim for the erroneous deprivation of a liberty interest).
Unfortunately, that is not the case here. Any relief obtained by Sanford in the postconviction relief process came too latehe had already spent time in prison that he allegedly would not have spent had the excessive discipline not been imposed. Consequently, the paper transaction of changing the prison records to indicate a new discharge date did not remedy the allegedly improper denial of Sanford's liberty interest in his good-time credits. Cf. Cespedes v. Coughlin, 956 F.Supp. 454, 472-74 (S.D.N.Y.1997) (holding that inmate suffered no harm where his good-time credits were restored "before they could affect the overall length of his sentence of incarceration," but acknowledging that if the "loss of credit [had] resulted in his serving a longer overall sentence of incarceration, [the][c]ourt would be compelled to find that a liberty interest protected by the Due Process Clause is implicated"). Therefore, we reject the defendants' argument that the postconviction relief actions remedied any harm incurred by Sanford.
D. Is Sanford precluded from bringing this claim because his convictions and sanctions were not reversed? The individual defendants successfully argued in the district court that Sanford could not pursue a claim for damages because his underlying disciplinary report had not been reversed or remanded. Because the defendants rely primarily on the Supreme Court's decision in Heck v. Humphrey, we start our discussion with a review of the holding in that case.
In Heck, the United States Supreme Court considered a § 1983 claim for damages based on the petitioner's voluntary manslaughter conviction. 512 U.S. at 478-79, 114 S.Ct. at 2368, 129 L.Ed.2d at 389. The manslaughter conviction was still on appeal when the damages claim was filed. Id. The Court held that
in order to recover damages for allegedly unconstitutional conviction or imprisonment, or for other harm caused by actions whose unlawfulness would render a conviction or sentence invalid, a § 1983 plaintiff must prove that the conviction or sentence has been reversed on direct appeal, expunged by executive order, declared invalid by a state tribunal authorized to make such determinations, or called into question by a federal court's issuance of a writ of habeas corpus.... Thus, when a state prisoner seeks damages in a § 1983 suit, the district court must consider whether a judgment in favor of the plaintiff would necessarily imply the invalidity of his conviction or sentence; if it would, the complaint must be dismissed unless the plaintiff can demonstrate that the conviction or sentence has already been invalidated.

Id. at 486-87, 114 S.Ct. at 2372, 129 L.Ed.2d at 394 (emphasis added). Finding that the petitioner's damages claim challenged the legality of his conviction, the Court concluded that dismissal of the action was indicated because the petitioner had not established that his conviction had been invalidated. Id. at 490, 114 S.Ct. at 2374, 129 L.Ed.2d at 396. The Supreme Court subsequently applied this rationale in the context of a state prisoner's § 1983 suit alleging due process violations in a disciplinary hearing that resulted in the loss of good-time credits. See Edwards, 520 U.S. at 646-48, 117 S.Ct. at 1588-89, 137 L.Ed.2d at 914-15.
In applying these principles to Sanford's claim, the district court held that Sanford's § 1983 action must fail because his disciplinary reports were remanded for reconsideration of the sanctions, but were not "reversed" or "invalidated" as required by Heck. We initially note that one of the arguments made in Sanford's postconviction relief actions was that the sanctions imposed upon him were excessive, arbitrary and capricious. The postconviction relief court found that the loss of good-conduct time imposed on Sanford was excessive. Based on this finding, the court remanded for a redetermination of the appropriate *370 sanction "not inconsistent with this opinion." Although the postconviction relief court did not use the words "reverse" or "invalid," we think the essence of the court's ruling was that the good-time sanctions assessed against Sanford were invalid and could not stand. Cf. State v. Young, 292 N.W.2d 432, 435 (Iowa 1980) (observing that a sentence in excess of that authorized by statute is illegal); State v. Hopp, 190 N.W.2d 836, 837 (Iowa 1971) (holding that a sentence that exceeded the statutory maximum was "void and invalid"). The court's failure to employ the same verbiage used in Heck does not change the nature of the court's holding. Thus, we think Sanford's sanctions were clearly invalidated in the prior action.
That conclusion does not, however, entirely dispose of the defendants' argument because the defendants claim that Sanford must also show that his underlying convictions were reversed or invalidated. We disagree. The logic behind Heck is to prevent collateral attacks on judgments. 512 U.S. at 484-86, 114 S.Ct. at 2371-72, 129 L.Ed.2d at 393. Sanford's damages claim does not rest on the invalidity of his underlying convictions; it rests on the invalidity of the sanctions imposed. Those sanctions have been invalidated. Thus, the claim made in this § 1983 action does not exceed the scope of Sanford's success in the postconviction relief actions. Consequently, the test of Heck, as well as the underlying rationale of that decision, have been satisfied. Therefore, we reject the defendants' argument that the disposition of Sanford's postconviction relief actions precludes his claim for damages.
E. Summary and conclusion. Sanford has alleged the deprivation of a constitutionally protected liberty interest in the reduction of his sentence for good-time credits. This claim is not moot simply because the State arguably could have asserted a mootness defense in the underlying postconviction relief actions. Such a defense was not raised in those actions and to consider it now would be an impermissible collateral attack on the postconviction relief judgment. The injury alleged by Sanford was not remedied in the postconviction relief actions by the technical restoration of forfeited good-conduct time because Sanford had already served his elongated sentence when the correction was made. Finally, Sanford has satisfied the prerequisite that his underlying sanctions, which form the basis for his § 1983 suit, have been invalidated. We hold that the district court erred in granting summary judgment to the individual defendants.

IV. Tort Claim Against the State.

Sanford's claim against the State is brought pursuant to Iowa Code chapter 669, the Iowa Tort Claims Act. This act permits an injured party to recover damages for the negligent or wrongful acts of state employees "`where the state, if a private person, would be liable to the claimant for such damage.'" Magers-Fionof v. State, 555 N.W.2d 672, 674 (Iowa 1996) (quoting Iowa Code § 669.2(3)(a)). The act does not itself create a cause of action. See id. It "`merely recognizes and provides a remedy for a cause of action already existing which would have otherwise been without remedy because of the common law immunity.'" Id.(quoting Engstrom v. State, 461 N.W.2d 309, 314 (Iowa 1990)). Thus, our first inquiry must be whether Sanford has a recognized tort claim against state employees for the deprivation of good-conduct time.
In order to recover under a tort claim, the plaintiff must establish that the defendant owed a duty to the plaintiff that was violated. See Van Essen v. Farmers Coop. Exch., 599 N.W.2d 716, 719 (Iowa 1999); Magers-Fionof, 555 N.W.2d at 674. We look to "legislative enactments, prior judicial decisions, and general legal principles as a source for the existence of a duty." Van Essen, 599 N.W.2d at 718.
*371 Here, the plaintiff asserts that the State owes a duty to inmates not to negligently impose excessive disciplinary sanctions. He claims that chapter 903A establishes such a duty for the benefit of inmates because it provides that the IDOC should establish guidelines for assessing discipline and a loss of good-conduct time. See Iowa Code § 903A.4. (At the time of Sanford's discipline, the IDOC had no guidelines with respect to the appropriate discipline for a rule infraction of the type of which he was convicted.) Sanford points out that Iowa Code chapter 822 authorizes postconviction relief proceedings wherein an inmate can challenge the unlawful forfeiture of good-conduct time. See id. § 822.2(6).
Even if Sanford is correct that chapter 903A creates a duty, an issue we do not decide, that does not necessarily mean that he has a cause of action for violation of that duty. The violation of a statutory duty gives rise to a tort claim only when the statute, explicitly or implicitly, provides for such a cause of action. See Marcus, 538 N.W.2d at 288. In Marcus, we applied a four-factor test to determine whether a private cause of action could be implied from a statute. Id. The test we adopted is as follows:
1. Is the plaintiff a member of the class for whose benefit the statute was enacted?
2. Is there any indication of legislative intent, explicit or implicit, to either create or deny such a remedy?
3. Would allowing such a cause of action be consistent with the underlying purpose of the legislation?
4. Would the private cause of action intrude into an area over which the federal government or a state administrative agency holds exclusive jurisdiction?
Id. (citing Cort v. Ash, 422 U.S. 66, 78, 95 S.Ct. 2080, 2088, 45 L.Ed.2d 26, 36-37 (1975)). The district court applied this test and concluded that a private cause of action was not contemplated by the legislature when it enacted chapter 903A. We think the court was correct.
Considering the first factor, whether the plaintiff is within the class for whose benefit the statute was enacted, we note that chapter 903A allows a reduction in an inmate's sentence for good conduct. See Iowa Code § 903A.2. That reduction may be forfeited, however, for infractions of prison rules. Id. § 903A.3(1). Section 903A.4 directs the IDOC to develop guidelines for the accrual and forfeiture of good-time credits. We think that one of the purposes of this section, in addition to providing guidance to prison officials implementing chapter 903A, is to protect inmates from arbitrary, inconsistent or excessive disciplinary sanctions. Therefore, Sanford, as an inmate at the time of his discipline, is a member of the class for whose benefit the statute was enacted.
The second factor requires consideration of the legislature's intent to create a private cause of action. The plaintiff has pointed to no language in chapter 903A expressly giving inmates a claim for damages when the statute is violated. He relies instead on chapter 822, the postconviction relief statute, noting that it provides inmates with a judicial remedy for the wrongful loss of good-conduct time. See Iowa Code ch. 822. Sanford argues that the recognition of a tort remedy "is not a significant extension" of chapter 822. But that is not the issue; the issue is one of legislative intent. See M.H. By and Through Callahan v. State, 385 N.W.2d 533, 537 (Iowa 1986) ("When a statute does not expressly authorize private suits it is a matter of legislative intent whether there is an implied cause of action."). Chapter 822 simply does not provide, either explicitly or implicitly, for the recovery of money damages. See Iowa Code § 822.2(7) (listing relief that may be granted by the district court). We refuse to extend the statute beyond its terms by implying a private cause of action on behalf of inmates. See Marcus, 538 N.W.2d at 289 ("legislative intent is expressed by omission *372 a well as by inclusion, and the express mention of one thing implies the exclusion of others not so mentioned").
We do not discuss the third and fourth factors of the Marcus test. Even if the recognition of a tort claim would be consistent with chapter 903A and would not intrude into an area over which the IDOC has exclusive jurisdiction, the lack of any indication that the legislature intended to create such a cause of action is fatal to the plaintiff's case. Therefore, we hold that the trial court correctly granted the State's motion to dismiss because the plaintiff failed to state a claim upon which relief could be granted.

V. Disposition.

We affirm the district court's dismissal of Sanford's claim against the State. We reverse the district court's summary judgment ruling dismissing the § 1983 claim against the individual defendants, and remand the case for further proceedings on that claim.
AFFIRMED IN PART, REVERSED IN PART, AND REMANDED.
