OPINION
MARLAR, Bankruptcy Judge:INTRODUCTION
Charles Douglas Warfel (“debtor”) has appealed the bankruptcy court’s dismissal of his complaint to determine that a civil judgment for restitution was dischargeable *208in his chapter 71 bankruptcy case. The civil restitution judgment was owed to the City of Saratoga (“City”) and was originally imposed as a condition of the debtor’s probation in a criminal proceeding. We conclude that the civil restitution judgment was nondischargeable under § 523(a)(7), and affirm the dismissal of the debtor’s complaint.
FACTS
In April 1994, the City responded to a chemical fire at the debtor’s residence. On March 8, 1995, the debtor pled no contest to two misdemeanor violations of the City Code for unsafe storage of hazardous materials without a permit. He was sentenced to three years’ formal probation. As conditions to the probation, he was ordered to complete 100 hours of uncompensated community service, and to pay restitution to the City for the toxic clean-up, in the amount of $6,953.59.
In 1997, after failing to complete any of the community service hours or to pay the restitution, the debtor’s probation was modified to one year in jail. When the debtor’s probation expired on March 8, 1998, the Santa Clara County Superior Court ordered the debtor to complete the balance of the jail time, and, according to California law, ordered a civil judgment for the unpaid restitution. The restitution judgment was entered on April 14, 1999, in the amount of $6,856.73 plus 10% interest from March 8,1995.
The debtor filed a voluntary chapter 7 petition on September 9, 1999. He listed the City as an unsecured creditor. On September 13, 1999, the debtor filed an adversary complaint to determine whether the restitution was dischargeable. The debtor alleged that he had been unemployed for three years and could not satisfy the judgment and still maintain a minimal standard of living.
The City moved to dismiss the complaint. It attached the declaration of its attorney, Benjamin Fay, and a request for judicial notice of the Probation Order, the Superior Court Order After Remittitur, and the Civil Judgment on Order of Restitution.2 The debtor opposed the motion.3 Following a hearing, the bankruptcy court entered its order dismissing the complaint, and the debtor timely appealed.
ISSUE
The only substantive issue is whether, upon the expiration of the debt- or’s probation, a civil judgment that enforces the payment of restitution, imposed as a condition of such probation, is nondischargeable under § 523(a)(7).4
*209 STANDARD OF REVIEW
This appeal presents a mixed question of law and fact, which we review de novo. In re Bammer, 131 F.3d 788, 792 (9th Cir.1997). “A mixed question of law and fact occurs when the historical facts are established; the rule of law is undisputed, ie., [the elements of § 523(a)(7) ]; and the issue is whether the facts satisfy the legal rule.” Id.
The bankruptcy court’s dismissal of the debtor’s complaint, under Fed. R.Bankr.P. 7012(b)/Fed.R.Civ.P. 12(b)(6), is also subject to de novo review. In re Rogstad, 126 F.3d 1224, 1228 (9th Cir. 1997). “When considering a motion to dismiss for failure to state a claim, a court must take as true all allegations of material fact and construe them in a light most favorable to the nonmoving party.” In re Stoll, 252 B.R. 492, 495 (9th Cir. BAP 2000). “However, conclusory allegations of law and unwarranted inferences are not sufficient to defeat a motion to dismiss.” Pareto v. F.D.I.C., 139 F.3d 696, 699 (9th Cir.1998). The complaint should not be dismissed unless it appears beyond doubt that the plaintiff can prove no set of facts that would entitle him to relief. O’Loghlin v. County of Orange, 229 F.3d 871, 874 (9th Cir.2000).
DISCUSSION
Section 523(a)(7) provides that a debt is exempted from discharge “to the extent such debt is for a fine, penalty, or forfeiture payable to and for the benefit of a governmental unit, and is not compensation for actual pecuniary loss, other than a tax penalty.” Thus, the three requirements for a nondischargeable debt under this provision are:
(1) a “fine, penalty, or forfeiture”
(2) “payable to and for the benefit of a governmental unit”
(3) that is “not compensation for actual pecuniary loss.”
The debtor does not argue that the restitution judgment is “payable to and for the benefit of a governmental unit,” ie., the City. He contends, however, that the civil restitution judgment, which was entered after his criminal-probation and jail time had expired, was no longer a penal sanction and that its only purpose was pecuniary, ie., compensation to the City for its clean-up costs.
The debtor cites only one case to support his theory, Kelly v. Robinson, 479 U.S. 36, 107 S.Ct. 353, 93 L.Ed.2d 216 (1986). Interestingly, Kelly held that in chapter 7 cases a state court criminal restitution order is nondischargeable under § 523(a)(7).5 Kelly, 479 U.S. at 53, 107 S.Ct. 353. See also Penn. Dept. of Public Welfare v. Davenport, 495 U.S. 552, 564, 110 S.Ct. 2126, 109 L.Ed.2d 588 (1990) (unequivocally holding that criminal resti*210tution is a “debt” as defined by § 101 of the Bankruptcy Code).
In applying § 523(a)(7), the Supreme Court in Kelly held that: “[Interpretation of the Code also must reflect the basis for this judicial exception, a deep conviction that federal bankruptcy courts should not invalidate the results of state criminal proceedings. The right to formulate and enforce penal sanctions is an important aspect of the sovereignty retained by the States.” Kelly, 479 U.S. at 47, 107 S.Ct. 353; accord: In re Gruntz, 202 F.3d 1074, 1084 (9th Cir.2000); In re Soderling, 998 F.2d 730, 732-33 (9th Cir.1993). The Supreme Court also expressed concern that state court judges would be hampered in their ability to fashion appropriate “combinations of imprisonment, fines, and restitution most likely to further the rehabilitative and deterrent goals of state criminal justice systems” if such judgments were subject to discharge by the bankruptcy courts. Kelly, 479 U.S. at 49, 107 S.Ct. 353.
The debtor attempts to distinguish Kelly on its facts. In Kelly, the debtor was required to pay restitution to the Connecticut welfare authority from which she had fraudulently received payments. She was still on probation when she filed a bankruptcy petition. In contrast, the restitution debt here is a post-probation civil judgment in favor of the creditor City.
To resolve this appeal, we must focus on the structure of the California Penal Code and the legislative purpose of a civil judgment for restitution. Although a monetary sanction may be imposed by the state, and pursuant to a state law, the sanction must be “penal” to fall within the § 523(a)(7) exemption. Only monetary sanctions that are intended as punishment are “fines or penalties,” as that term is used in § 523(a)(7). In re Taggart, 249 F.3d 987, 992-94 (9th Cir. 2001) (determining that monetary sanction imposed under California’s statute for discretionary imposition of costs, in State Bar disciplinary proceedings, was dischargea-ble compensatory reimbursement for actual expenses of the state).
The debtor’s restitution obligation arose in, and was ordered in conjunction with, a state criminal prosecution. In general, such criminal proceedings are carried out on behalf of all of the citizens of the state and not for a particular creditor. Gruntz, 202 F.3d at 1086. California’s Penal Code provides for restitution to the victim as a condition of the defendant’s sentence of probation. In Kelly, the Supreme Court noted that restitution, while compensatory from the perspective of the victim, also has a penal aspect:
Restitution is an effective rehabilitative penalty because it forces the defendant to confront, in concrete terms, the harm . his actions have caused. Such a penalty will affect the defendant differently than a traditional fine, paid to the State as an abstract and impersonal entity, and often calculated without regard to the harm the defendant has caused. Similarly, the direct relation between the harm and the punishment gives restitution a more precise deterrent effect than a traditional fíne.
Kelly, 479 U.S. at 49 n. 10, 107 S.Ct. 353.
Thus, nondischargeable restitution may be determined by reference to the amount of harm caused by the offender. Kelly, 479 U.S. at 51-52, 107 S.Ct. 353. In this case the restitution ordered was the same amount as the City’s damages. That fact does not alter its penal character. The panel has explained:
As the Supreme Court recognized, a central feature of restitution is its relationship to the pecuniary loss of the victim. But the Court concluded resti*211tution orders “are not assessed ‘for ... compensation’ of the victim”, but rather . to promote “the penal and rehabilitative interests of the State.” 479 U.S. at 53, 107 S.Ct. at 363.
In re Steiger, 159 B.R. 907, 912 (9th Cir. BAP 1993).
California law further provides for the enforcement of a criminal restitution obligation as a civil money judgment. Cal.Penal Code §§ 1202.4, 1203(b)(2)(Q), and 1214. Cal.Penal Code § 1214(b) (Deering Supp.2001) also states, in relevant part:
A victim shall have access to all resources available under the law to enforce the restitution order, including, but not limited to, access to the defendant’s financial records, use of wage garnishment and lien procedures, information regarding the defendant’s assets, and the ability to apply for restitution from any fund established for the purpose of compensating victims in civil cases. Any portion of a restitution order that remains unsatisfied after a defendant is no longer on probation or parole is enforceable by the victim pursuant to this section.
Clearly, the California legislature intended that a restitution obligation should be paid even if payment was not complete at the conclusion of the criminal sentence. It therefore provided for enforcement of the restitution debt through a civil judgment. In this case, the Superior Court’s Order After Remittitur stated:
Additionally, defendant remains hable pursuant to Penal Code Section 1214(b) for the restitution that remains unpaid at the expiration of probation. The unpaid restitution, i.e. $6,856.73, becomes a civil judgment upon the expiration of probation and collects interest at 10% pursuant to PC Section 1214.5.
The debtor’s restitution liability remained viable under the Penal Code. The fact that California law allows enforcement of the restitution obligation as a civil judgment did not divest the restitution obligation of its identity as part of the criminal sentence.
The panel considered a similar argument in Steiger. There, the state sought to enforce a restitution judgment imposed as part of a vehicular homicide conviction. The debtor filed a nondischargeability complaint and argued, inter alia, that Kelly was not controlling because the victims were individuals, and the civil judgment was enforceable by the individuals. The panel affirmed the bankruptcy court’s holding that it made no difference that the victim may be empowered to enforce the restitution order, because such orders “operate ‘for the benefit of the State.” Steiger, 159 B.R. at 911 (quoting Kelly, 479 U.S. at 53,107 S.Ct. at 363).6
“[T]he limitation of § 523(a)(7) to fines assessed ‘for the benefit of a governmental unit’ was intended to prevent application of that subsection to wholly private penalties such as punitive damages.” Kelly, 479 U.S. at 51 n. 13, 107 S.Ct. 353 (emphasis added). In this case, the victim City met the plain requirement of § 523(a)(7) that the debt be “payable to and for the benefit of a governmental unit.” See § 101(27) (defining “governmental unit” to include a municipality). Furthermore, the plain language of the statute does not require the governmental unit that benefits from the payment of the penalty to be the same governmental unit which imposed the penalty. Assuming, arguendo, that the “governmental unit” referred to in § 523(a)(7) *212must also be the prosecuting entity, ie., the state of California, such that we must analyze the City’s position as being that of a third-party victim, our conclusion of non-dischargeability would not change. The Supreme Court in Kelly read § 523(a)(7) liberally in order to preserve from discharge restitution that was equal to the amount of the victim’s loss, even though on its face, such restitution did not appear to meet the explicit requirement of § 523(a)(7) that it not be “compensation for actual pecuniary loss.” The Court eschewed a mechanical interpretation of this discharge exception and “made it abundantly clear that the Bankruptcy Code must be interpreted ‘in light of the history of bankruptcy court deference to criminal judgments and in light of the interests of the States in unfettered administration of their criminal justice systems.’ ” In re Nelson, 91 B.R. 904, 905 (N.D.Cal.1988) (quoting Kelly, 479 U.S. at 44, 107 S.Ct. 353). See also Davenport, 495 U.S. at 563, 110 S.Ct. 2126 (stating that its holding that criminal restitution was a dischargeable debt in a chapter 13 case [before amendment of the code] “does not signal a retreat from the principles applied in Kelly”).
Recently, other circuit courts have analyzed the benefit requirement of § 523(a)(7) by focusing, not on the penal nature of restitution, but on the literal requirements that the restitution must be “payable to” a governmental unit as well as be “for the benefit of’ a governmental unit. In In re Rashid, 210 F.3d 201 (3rd Cir.2000), it was held that a chapter 7 debtor’s federal restitution obligation was dischargeable because it was payable to a private victim.7 The court noted that federal criminal restitution orders and civil restitution orders do not implicate “the federal court’s longstanding ‘reluctan[ce] to interpret federal bankruptcy statutes to remit state criminal judgments.’ ” Id. at 208 n. 3 (quoting Kelly, 479 U.S. at 44, 107 S.Ct. 353). Our case is distinguishable from Rashid because it concerns a restitution order in a state criminal judgment.
Another circuit court has held that civil restitution awarded to victims of consumer fraud under the Illinois Consumer Fraud and Deceptive Business Practices Act was dischargeable because it was not payable to, nor did it.benefit, a governmental unit. See In re Towers, 162 F.3d 952, 954-56 (7th Cir.1998), cert. denied, 527 U.S. 1004, 119 S.Ct. 2340, 144 L.Ed.2d 237 (1999). Again, our case is distinguishable because the restitution was imposed in a criminal proceeding, and was only enforced through a civil judgment.
The restitution obligation in this case was part of the panoply of punishments available in the California Penal Code for the debtor’s offense. Although not literally “payable to” the state, the restitution was ordered by the state to be paid. Although not benefitting the state directly, the restitution order promoted law enforcement by deterrence and served to protect society as a whole. To allow a debtor to discharge this obligation would be abhorrent to the standards of federalism expressed in Kelly that bankruptcy statutes should not be interpreted so as to remit state criminal judgments. See Kelly, 479 U.S. at 44, 107 S.Ct. 353. Probationers should not be encouraged by the Bankruptcy Code to withhold payment until their probation or jail time expires, and then attempt to discharge the debt in bankruptcy.
*213In this vein, the debtor’s final argument is that the restitution judgment was not a punishment for his wrongdoing, but that it was imposed due to his “protracted unemployment and indigence,” which made him, and continues to make him, unable to pay the restitution order.
The debtor’s contention that the reason for the ensuing civil judgment was his failure to compensate the City misconstrues the rehabilitative and penal nature of the state’s criminal sentencing scheme. The restitution order was part of the penalty for the debtor’s crime. When he was sentenced, the Penal Code provided that “[i]n every case in which a victim has suffered economic loss as a result of the defendant’s conduct, the court shall require that the defendant make restitution to the victim or victims.... ” Cal.Penal Code § 1202.4(f) (Peering Supp.2001). In its 1994 amendments to that section, the California Legislature recognized that restitution has a “rehabilitative effect on criminals” and is a “deterrent to future criminality.” See § 1 Cal.Stats.1994, c. 1106 (A.B.3169). In 1997, the state court held a probation revocation hearing. It determined that the debtor’s probation would be modified to one year’s imprisonment. The court maintained the restitution obligation.
Furthermore, the debtor’s suggestion that restitution was ordered for the wrong reasons is an improper collateral attack on the final state court restitution order and judgment. Watts v. Pinckney, 752 F.2d 406, 410 (9th Cir.1985) (doctrine of res judicata bars a collateral attack on a final judgment). Additionally, the debtor’s financial inability to pay the restitution in his bankruptcy case is not a factor in analyzing nondischargeability under § 523(a)(7).
Therefore, we hold that the restitution obligation, originally imposed as a condition of the debtor’s probation, did not transform into a dischargeable debt simply because it was also enforceable as a civil judgment by the victim.
CONCLUSION
The debtor has argued that, after state criminal proceedings terminated and a restitution order became a civil judgment, such judgment was no longer penal in nature. This view would thwart the goals of both the California Penal Code and the Bankruptcy Code, and must be rejected. The civil restitution judgment in favor of the City was a means of enforcing a sentence imposed on the debtor under California’s criminal justice system. Therefore, it was nondischargeable under the provisions of § 523(a)(7). The bankruptcy court’s order dismissing the debtor’s complaint for failure to state a claim is AFFIRMED.
. Unless otherwise indicated, references to "chapter” and "section” are to the Bankruptcy Code, 11 U.S.C. §§ 101-1330, and rule references are to the Federal Rules of Bankruptcy Procedure ("Fed.R.Bankr.P.”), which make applicable certain Federal Rules of Civil Procedure ("Fed.R.Civ.P.”)
. The bankruptcy court considered the documents subject to judicial notice, but did not indicate that it relied on any other pleadings, such as the Fay affidavit, outside of the complaint. Therefore, the motion was properly treated as one under Fed.R.Civ.P. 12(b)(6), rather than as a summary judgment motion under Fed.R.Civ.P. 56(c). See MGIC Indem. Corp. v. Weisman, 803 F.2d 500, 504 (9th Cir.1986) (under Rule 12(b)(6), the court may take judicial notice of matters of public record outside of the pleadings).
. The debtor incorporated into his opposition his First Amended Motion to Strike and Motion for Protective Order, which he filed in bankruptcy court on February 14, 2000. The bankruptcy court orally denied these motions at the hearing. The debtor has not raised issues concerning these motions in this appeal.
. In his opening brief, the debtor raised another issue concerning alleged violations of *209his constitutional rights during the probation proceedings in state court. According to the debtor’s Statement of Facts, however, he had appealed the superior court order modifying his probation, and assigned as error these same constitutional issues. See Opening Brief at 10. That order was affirmed by the California appellate court. See Order after Re-mittitur, February 22, 1999, p. 2.
The bankruptcy court and the panel lack jurisdiction to review the propriety of the final state court judgment upon which the civil restitution judgment was based. Bran-son v. Nott, 62 F.3d 287, 291 (9th Cir. 1995) (federal courts lack subject matter jurisdiction to review the final determinations of state courts in judicial proceedings even when the challenge to a state court decision involves federal constitutional issues); In re Audre, Inc., 216 B.R. 19, 26 (9th Cir. BAP 1997) (applying Rooker-Feldman doctrine).
. A gap in the Code that allowed the discharge of restitution in a chapter 13 case was closed by the 1990 amendments. See Crime Control Act of 1990, Pub.L. No. 101-647 (1990); § 1328(a).
. Although the debtor here has brought the adversary proceeding against the creditor City, and not against the prosecuting state, as in Steiger, that factual distinction does not change the application of the law as propounded by Kelly. See discussion below.
. Rashid involved a restitution obligation that was imposed before the 1994 amendments to the Bankruptcy Code. Section 523(a)(13) now provides that "any payment of an order of restitution under title 18, United States Code” is nondischargeable.