
177 B.R. 907 (1995)
In re Betty Jean DAVIS, Debtor.
Betty Jean DAVIS, Appellant,
v.
C.G. COURINGTON, Mary Courington, Priscilla Cardoza, Guy Ernest Guthrie, Harriet L. McGuire, Mary E. Schmall, San Joaquin Investments, Inc., David Rose, Appellees.
BAP No. EC-93-2135-CRJ. Bankruptcy No. 92-1-4351B-13F. Adv. No. 93-1142.
United States Bankruptcy Appellate Panel of the Ninth Circuit.
Argued and Submitted November 16, 1994.
Decided February 2, 1995.
*908 *909 Betty Jean Davis, in pro. per.
Russell D. Greer, Fresno, CA, for appellees.
Before CARLSON,[1] RUSSELL and JONES, Bankruptcy Judges.
CARLSON, Chief Judge:
The principal question raised in this appeal is whether Appellant's action alleging willful violation of the automatic stay was rendered moot by dismissal of the underlying bankruptcy case. We conclude that the action was not rendered moot and reverse the bankruptcy court's order dismissing the action.

FACTS
On June 24, 1992, Betty Jean Davis (Appellant) filed an action in Fresno County Superior Court alleging that certain secured lenders and their agents (Appellees): (1) wrongfully refused to accept loan payments from Appellant; (2) misapplied loan payments from Appellant; (3) initiated foreclosure proceedings in violation of California law; (4) defamed Appellant by falsely stating she had served time in prison and was a drug dealer; and (5) deliberately attempted to drive Appellant out of business. Appellant filed a chapter 13 petition on August 7, 1992 before the action came to trial. On August 12, 1992 and September 8, 1992, Appellees *910 conducted non-judicial foreclosure sales on two properties claimed by Appellant to be property of the estate. Appellees did not seek relief from the automatic stay before conducting these foreclosures.[2]
On July 16, 1993, Appellant filed the adversary proceeding at issue. The complaint alleges six causes of action. The third cause of action alleges that the postpetition foreclosures constituted willful violation of the automatic stay under 11 U.S.C. § 362(h). The fifth and sixth causes of action allege that Appellees committed other violations of the automatic stay. The remaining three causes of action allege various state-law wrongful foreclosure theories similar to those alleged in the prior state-court action. Appellees McGuire, Guthrie, Rose, and San Joaquin Investments, Inc. are named only in the state-law causes of action.
On July 20, 1993, the bankruptcy court granted the chapter 13 trustee's motion to dismiss Appellant's chapter 13 bankruptcy case because of Appellant's failure to propose a feasible plan of reorganization. The order dismissing the case was entered on July 23, 1993.
On August 18, 1993, Appellees filed a motion to have the bankruptcy court dismiss Appellant's adversary proceeding for lack of subject-matter jurisdiction, or to have the bankruptcy court abstain from hearing the action. Appellant did not file any written opposition to the motion.
The court granted Appellees' motion to dismiss. The court reasoned that because the underlying bankruptcy case had been dismissed, the complaint for damages for violation of the automatic stay was moot.
There's no dispute that the underlying case has been dismissed. That's a fact. The Court makes such a finding.
The case having been dismissed, the only bankruptcy or federal-related issue, namely, the one on sanctions for the violation of the automatic stay, becomes moot in that the dismissal of the case restores the parties as much as possible to their status before the case, which would mean that there was, in fact, no stay to violate.
. . . .
Without reaching the jurisdictional issue, the Court will grant the motion to dismiss. It will be without prejudice, Ms. Davis, in the event your appeal on the dismissal of the main case is successful.

ISSUES
(1) Whether a complaint under section 362(h) of the Bankruptcy Code for willful violation of the automatic stay becomes moot upon the dismissal of the underlying bankruptcy case.
(2) Whether the bankruptcy court had subject-matter jurisdiction over the dismissed action.
(3) Whether dismissal of the action was an appropriate exercise of discretionary abstention.

JURISDICTION AND STANDARD OF REVIEW
This panel has jurisdiction to hear appeals from final judgments, orders, and decrees entered by bankruptcy courts. 28 U.S.C. § 157(a), (b). Although the bankruptcy court dismissed the complaint without prejudice, the order was a final one, because it terminated the instant action. The bankruptcy court contemplated that Debtor could bring the action before that court again only by filing a new adversary proceeding if the dismissal of the underlying chapter 13 case was set aside on appeal.
The propriety of dismissal of a complaint on the ground that the complaint is moot or on the ground that the court lacks subject-matter jurisdiction is a question of law that is subject to de novo review. In re Omoto, 85 B.R. 98, 99-100 (9th Cir. BAP 1988). A bankruptcy court's decision to decline to exercise jurisdiction over related proceedings following dismissal of the underlying bankruptcy case is set aside only for *911 abuse of discretion. In re Carraher, 971 F.2d 327, 328 (9th Cir.1992).

DISCUSSION
1. Mootness. The weight of authority suggests that the dismissal of a bankruptcy case does not render moot an action for damages based on a willful violation of the automatic stay during the pendency of the bankruptcy case. See Price v. Rochford, 947 F.2d 829, 831-32 (7th Cir.1991); Martin-Trigona v. Champion Fed. Sav. & Loan Ass'n, 892 F.2d 575, 577 (7th Cir.1989); In re Fingers, 170 B.R. 419, 425 (S.D.Cal.1994); In re Nelson, 159 B.R. 924, 925 (Bankr.D.Idaho 1993).
In re Income Property Builders, Inc., 699 F.2d 963 (9th Cir.1982) is not to the contrary. In that case, the bankruptcy court granted relief from the stay to permit a creditor to foreclose. A second creditor moved to have the bankruptcy court reinstate the stay. The bankruptcy court denied the motion and the second creditor appealed. By the time the appeal was heard, however, the first creditor had completed its foreclosure sale and the bankruptcy case had been dismissed. The Ninth Circuit dismissed as moot the second creditor's appeal from the order declining to reinstate the automatic stay. The court reasoned that it would be an idle act to reinstate the stay, because there was no longer any bankruptcy case for the automatic stay to serve. Id. at 964. Income Property Builders is distinguishable from the present case because there had been no violation of the stay and because appellant was not seeking monetary damages. Although the court stated that the bankruptcy court "no longer had power to order the stay or to award damages allegedly attributable to its vacation," Id., the language referring to damages is clearly dictum because no claim for damages was at issue in the appeal.
In re Omoto, 85 B.R. 98 (9th Cir. BAP 1988), is also distinguishable from the present case, because it did not involve a claim for damages for violation of the automatic stay. In that case, a creditor foreclosed upon the debtor's residence without obtaining prior relief from the automatic stay. The bankruptcy court granted the creditor's motion for retroactive relief from the stay, validating the foreclosure sale. Debtor's chapter 13 bankruptcy case was subsequently dismissed. Debtor did not appeal the dismissal order. Debtor did appeal the order granting retroactive relief from the stay. This panel dismissed that appeal as moot on the basis that there was no legitimate purpose to set aside the foreclosure sale once the bankruptcy case had been dismissed.
When the underlying case is dismissed, the issue of whether the court should have approved the foreclosure sale is rendered moot because there is no longer an attempt to pursue a Chapter 13 plan. There is, therefore, no reason to restrain the creditor's right to foreclose.
Id. at 100. We did not address whether any claim for damages would have been rendered moot by the dismissal of the bankruptcy case, because appellant had not sought such relief.
Nor does section 349 of the Bankruptcy Code, which specifies the effects of dismissal of an underlying case, provide that dismissal moots an action for willful violation of the automatic stay. Section 349(b) provides that dismissal revests property of the estate in the debtor and vacates orders entered avoiding certain liens and transfers. Section 349(b) does not, however, retroactively vacate the automatic stay, vacate orders remedying violation of the stay, or vitiate any cause of action based upon violation of the stay.
We concur with the authorities holding that dismissal of the underlying bankruptcy case does not render moot an action for damages based on willful violation of the automatic stay. Willful violation of the automatic stay is an intentional tort for which compensatory and punitive damages may be awarded. 11 U.S.C. § 362(h). Imposition of damages for willful violation of the automatic stay serves an important purpose even after the underlying bankruptcy case has been dismissed; it provides compensation for and punishment of intentionally wrongful conduct. See In re Carroll, 903 F.2d 1266 (9th Cir.1990) (action for damages for violation of stay not moot even if action for injunctive *912 relief is moot). Stated differently, intentionally wrongful conduct should not be excused merely because the underlying bankruptcy case has been dismissed. Thus, we conclude that "a legally cognizable interest in the outcome of the [adversary proceeding] survives the bankruptcy." In re Universal Farming Industries, 873 F.2d 1334, 1336 (9th Cir. 1989).
2. Subject-Matter Jurisdiction. Appellees contend that the order dismissing the adversary proceeding without prejudice should be affirmed on the basis that the bankruptcy court lacked subject-matter jurisdiction over the action. Although the bankruptcy court did not rely upon that basis in dismissing the adversary proceeding, this court can affirm upon any basis presented by the record. See In re Woosley, 117 B.R. 524, 530 (9th Cir. BAP 1990).
The bankruptcy court had subject-matter jurisdiction over all claims alleging willful violation of the automatic stay. Bankruptcy courts have jurisdiction over "all civil proceedings arising under title 11, or arising in or related to cases under title 11." 28 U.S.C. § 1334(b). Appellant's action for willful violation of the automatic stay is created by section 362(h) of title 11 of the United States Code. Thus, the action arises under title 11 and is within the subject-matter jurisdiction of the bankruptcy court. Price v. Rochford, 947 F.2d 829, 832 n. 1 (7th Cir. 1991).
The bankruptcy court had supplemental jurisdiction over Appellant's state law claims. During the pendency of the bankruptcy case, the court had subject-matter jurisdiction over the state law claims because the Appellant was a chapter 13 debtor and the action would have an effect on her bankruptcy estate. See In re Fietz, 852 F.2d 455, 457 (9th Cir.1988); 11 U.S.C. § 1306(a)(1). After dismissal of the bankruptcy case, the court continued to have jurisdiction under the doctrine of supplemental jurisdiction if the facts of the case "permit[] the conclusion that the entire action before the court comprises but one constitutional `case.'" United Mine Workers v. Gibbs, 383 U.S. 715, 725, 86 S.Ct. 1130, 1138, 16 L.Ed.2d 218 (1966); see also 28 U.S.C. § 1367(a) ("[T]he district courts shall have supplemental jurisdiction over all other claims that are so related to claims in the action within such original jurisdiction that they form part of the same case or controversy under Article III of the United States Constitution."); In re Eads, 135 B.R. 387, 394 (Bankr.E.D.Cal.1991) (applying the Gibbs test under 28 U.S.C. § 1367(a) in the context of an adversary proceeding in bankruptcy). The basic inquiries under Gibbs are whether there is a common nucleus of operative fact and whether the parties ordinarily would be expected to resolve the matter in one judicial proceeding. United Mine Workers v. Gibbs, 383 U.S. at 725, 86 S.Ct. at 1138; In re Eads, 135 B.R. at 394. Supplemental jurisdiction extends over state claims brought against a party even when that party was not subject to the federal claim primarily at issue. Therefore, if Appellant's state law claims are sufficiently related to the federal claims, the bankruptcy court had jurisdiction over those claims under the doctrine of supplemental jurisdiction.
Appellant's complaint alleges a pattern of wrongful refusal to accept tender of payments on various deeds of trust, misapplication of payments, wrongful foreclosure proceedings, and wrongful interference with Appellant's real estate investment activities both before and after Appellant filed for bankruptcy. We conclude that the federal and state claims arise out of the same general controversy and that the bankruptcy court had supplemental jurisdiction over the state-law claims.
None of the cases cited by Appellees for the proposition that the bankruptcy court lacked jurisdiction involved a federal cause of action that survived dismissal of the bankruptcy case. The only cases holding that the bankruptcy court lacked jurisdiction following dismissal of the underlying case involved motions for prospective relief regarding the automatic stay. See In re Taylor, 884 F.2d 478, 480-82 (9th Cir.1989) (order granting relief from stay); In re Income Property Builders, Inc., 699 F.2d 963 (9th Cir.1982) (motion seeking reinstatement of automatic stay). As noted above, dismissal of the underlying case renders moot a motion for prospective *913 relief regarding the stay, but does not render moot an action for damages based on violation of the stay.
3. Discretionary Abstention. Our conclusion that Appellant's action is not moot and that the bankruptcy court had subject-matter jurisdiction does not end our inquiry. The Ninth Circuit has recognized the bankruptcy court's discretion to decline to exercise jurisdiction over pending adversary proceedings following dismissal of the underlying bankruptcy case. In re Carraher, 971 F.2d 327, 328 (9th Cir.1992); In re Franklin, 802 F.2d 324, 326-27 (9th Cir.1986); In re Lawson, 156 B.R. 43, 45-46 (9th Cir. BAP 1993). The bankruptcy court should consider "economy, convenience, fairness, and comity" in determining whether to abstain from exercising its jurisdiction. Carraher, 971 F.2d at 328. The bankruptcy court's decision is to be set aside only for abuse of discretion. Id. at 328.
We cannot affirm the order dismissing the adversary proceeding as an exercise of discretionary abstention, however, because the trial judge did not consider the appropriate factors in making his decision. A judge does not properly exercise discretion where the judge relies upon an erroneous interpretation of law in making a decision. Lawson, 156 B.R. at 45. In the present case, the judge did not consider economy, convenience, fairness, and comity in dismissing the adversary proceeding. The record clearly reveals that he dismissed the adversary proceeding because he believed the dismissal of the underlying bankruptcy case effectively eliminated the alleged federal cause of action. Nor can we conclude that the trial judge necessarily would have dismissed the action if he had considered the appropriate factors. Although there are factors that support dismissal (the presence of state-law claims), there is at least one factor that weighs against dismissal (the action for willful violation of the stay arises under federal law).[3]
We reverse the order dismissing the adversary proceeding and remand for further proceedings not inconsistent with our decision.
JONES, Bankruptcy Judge, dissenting:
Although I agree with the premise that dismissal of the underlying bankruptcy does not automatically moot a § 362(h) action for damages, I feel that a dismissal can moot the issue, and generally does. In this case, there are sufficient reasons to affirm the bankruptcy court's finding that the issue was moot. First, title to the property involved was not held in the debtor's name, and therefore was arguably not property of the estate nor subject to the automatic stay. Second, even if we assume that there was a stay violation, bankruptcy courts have authority to make terminations of the stay retroactive. In re Carroll, 903 F.2d 1266, 1272 n. 6 (9th Cir. 1990); In re Omoto, 85 B.R. 98, 99 (9th Cir. BAP 1988); see also 11 U.S.C. § 362(c) (1994). Finally, the main purpose of dismissal is to "undo the bankruptcy case, as far as practicable, and to restore all property rights to the position in which they were found at the commencement of the case." In re Income Property Builders, Inc., 699 F.2d 963, 965 n. 1 (9th Cir.1982) (per curiam) (quoting H.R.Rep. No. 595, 95th Cong., 2d Sess. 338 (1977), reprinted in 1978 U.S.C.C.A.N. 5787, 6294).
I also disagree with the majority's analysis of subject-matter jurisdiction. The majority states that the debtor's state law claims arose out of the same common nucleus of operative fact as the debtor's claim for § 362(h) damages, concluding that the bankruptcy court therefore has supplemental jurisdiction over the state law claims. The facts simply do not support this conclusion. The debtor initially filed a complaint alleging five state law claims in state court on June 24, 1992, six weeks before she filed bankruptcy. Clearly, the state law claims did not "arise out of the same controversy" as the alleged stay violations, since the state law claims arose before the bankruptcy petition was filed. As a result, the bankruptcy court does *914 not have subject matter jurisdiction to hear the state law claims after dismissal of the automatic stay violation claim.
For the foregoing reasons, I respectfully dissent.
NOTES
[1]  Honorable Thomas E. Carlson, Chief Bankruptcy Judge for the Northern District of California, sitting by designation.
[2]  The complaint acknowledges that Appellant had not held record title to the two foreclosed properties, but alleges that Appellees knew Appellant often held property in the name of her brother.
[3]  The bankruptcy court is authorized in appropriate circumstances to abstain from proceedings arising under title 11. 28 U.S.C. § 1334(c)(1). The bankruptcy court should exercise great care, however, in abstaining from proceedings arising under title 11, because of the court's expertise in such matters.
