
    IN RE CASTELLINO VILLAS, A. K. F. LLC, Debtor, Picerne Construction Corp., DBA Camelback Construction, Appellant, v. Castellino Villas, A. K. F. LLC, Appellee.
    No. 12-57186
    United States Court of Appeals, Ninth Circuit.
    Argued and Submitted February 4, 2015
    Submission Vacated March 13, 2015
    Resubmitted August 29, 2016, Pasadena, California
    Filed September 6, 2016
    
      See also 244 Cal.App.4th 1201, 199 Cal. Rptr.3d 257.
    
      Scott E. Hennigh (argued), Meredith A. Jones-McKeown, and Scott A. Vignos, Sheppard Mullin Richter & Hampton LLP, San Francisco, California, for Appellant.
    Beth Ann R. Young (argued), Ron Bender (argued), and Krikor J. Meshefejian; Levene, Neale, Bender, Yoo & Brill LLP, Los Angeles, California, for Appellee.
    Before: MICHAEL J. MELLOY, JAY S. BYBEE, and SANDRA S. IKUTA, Circuit Judges.
    
      
       The Honorable Michael J. Melloy, Senior Circuit Judge for the U.S. Court of Appeals for the Eighth Circuit, sitting by designation.
    
   OPINION

IKUTA, Circuit Judge:

We are asked to determine whether the bankruptcy court erred as a matter of law by holding that attorneys’ fees incurred during litigation after the confirmation of a Chapter 11 bankruptcy plan were discharged by that bankruptcy. We have jurisdiction under 28 U.S.C. § 158(d). Picerne’s claim for attorneys’ fees arose before Castellino filed its bankruptcy petition, and Castellino’s post-discharge conduct did not amount to “a whole new course of litigation,” Siegel v. Fed. Home Loan Mortg. Corp., 143 F.3d 525, 534 (9th Cir. 1998). Therefore, under the circumstances of this case, Picerne’s attorneys’ fees claim was discharged in Castel-lino’s bankruptcy.

I

Castellino Villas LLC (Castellino) hired Picerne Construction Corp. dba Camel-back Construction (Picerne), a general contractor, to construct a 120-unit apartment complex on Castellino’s property. Pi-cerne and Castellino entered into an agreement for the work that contained an attorneys’ fees provision, which stated, in pertinent part:

Attorneys’ Fees. In any suit, action or proceeding between the parties arising out of, or in connection with, any of the terms, covenants, provisions or' agreements in the Agreement, the prevailing party in such suit ... shall be awarded ... all reasonable attorneys’ fees incurred before any trial or proceeding, at all trials or proceedings and on all appeals.

Castellino defaulted on its obligations and failed to pay Picerne and its subcontractors for their work. In response, Pi-cerne filed a demand for arbitration and a mechanic’s lien against the apartment complex. A few months later, Picerne filed a complaint in California Superior Court to foreclose on the mechanic’s lien. Picerne later amended the complaint to add Castel-lino’s lender, Bank of the West, as a defendant. In response, Bank of the West asserted that its deed of trust on Castellino’s property, which it held as security for Castellino’s $14 million debt to the Bank, was superior to Picerne’s mechanic’s lien.

The court stayed Picerne’s action in May 2007 to permit arbitration in accordance with the contract. On May 11, 2009, the arbitrator issued an award in favor of Pi-cerne. The superior court confirmed the arbitration award on July 24, 2009. That same day, Castellino filed a Chapter 11 petition for bankruptcy. The bankruptcy filing automatically stayed Picerne’s foreclosure action, see 11 U.S.C. § 362(a), but the bankruptcy court granted Picerne’s motion to lift the stay so that the parties could continue to litigate the mechanic’s lien action in state court. Castellino disputed the validity, priority, and amount of Picerne’s lien.

In bankruptcy court, Picerne filed an objection to confirmation of Castellino’s proposed plan of reorganization. In order to obtain confirmation of its plan, Castelli-no entered into a settlement agreement with Picerne. The settlement agreement provided that if Picerne’s foreclosure action in state court resulted in a determination that Picerne’s mechanic’s lien was a “valid, properly perfected and enforceable mechanics lien against the Castellino property” and was senior to the Bank’s lien, Picerne would receive specified payments from the trust account which Castellino would fund. The parties expressly did not agree as to whether Picerne was entitled to interest, costs or attorneys’ fees if it prevailed on its claim; the settlement agreement stated that “Castellino contends that under no circumstance is Pi-cerne entitled to interest, attorneys’ fees or costs” as part of its claim, and “Picerne disputes said contention.” Castellino reserved its defenses relating to the state court litigation. The settlement agreement also provided that upon the court’s approval of the settlement terms, Castellino’s plan of reorganization would be modified to include those terms and Picerne would withdraw its objection to the confirmation of the plan as modified. Finally, the parties entered into mutual releases, agreeing to release “any and all claims, demands, and causes of action ... that exist as of the date of this Agreement or any time prior thereto.”

After a hearing, the bankruptcy court approved the settlement agreement, and confirmed Castellino’s plan of reorganization, as modified to conform to the settlement agreement. As a result, Castellino was discharged from bankruptcy.

Pursuant to the plan and settlement agreement, the parties continued litigating the mechanic’s lien action in state court. After a nine day trial, the state court held that Picerne’s mechanic’s lien was valid and had.priority over the Bank’s lien, and the court entered judgment for Picerne in the amount of some $2.6 million (including prejudgment interest). Picerne moved for an award of attorneys’ fees. The state court held that under the bankruptcy court’s order, it lacked the authority to adjudicate or award attorneys’ fees, so it denied the motion without prejudice. Cas-tellino appealed the decision to the California Court of Appeal.

While the appeal was pending, Picerne moved the bankruptcy court for a ruling that the state court had the authority to award attorneys’ fees. Picerne argued that although it initiated litigation before Cas-tellino filed its petition in bankruptcy, it was entitled to an award of attorneys’ fees that were incurred after the confirmation of Castellino’s plan, citing In re Ybarra, 424 F.3d 1018 (9th Cir. 2005). Picerne also argued that the releases in the settlement agreement and plan of reorganization did not preclude it from seeking post-confirmation attorneys’ fees.

The bankruptcy court denied the motion. It reasoned that when Picerne sued Cas-tellino, the contract between the parties gave Picerne a contingent and unliquidated claim for attorneys’ fees. Because this claim arose before Castellino filed a petition in bankruptcy, it was discharged by the confirmation of Castellino’s plan of reorganization or was released by the parties’ settlement agreement. The district court affirmed, and Picerne timely appealed.

On appeal, Picerne contends that the bankruptcy court erred in denying its motion for post-discharge attorneys’ fees. First, Picerne argues that its claim for attorneys’ fees arising from litigation in state court arose after Castellino filed its petition in bankruptcy and therefore was not discharged by the confirmation of Cas-tellino’s plan of reorganization. Relying on In re Ybarra, Picerne argues that when a newly reorganized debtor voluntarily “returns to the fray” of litigation that began before filing a bankruptcy petition, the debtor is not free from liability for attorneys’ fees incurred after discharge. 424 F.3d at 1023-24. Second, Picerne contends that its settlement agreement with Castel-lino released only “existing claims,” and not claims for attorneys’ fees incurred after the settlement agreement was approved by the court. We review a bankruptcy court’s factual findings for clear error and its conclusions of law de novo. In re Gebhart, 621 F.3d 1206, 1209 (9th Cir. 2010).

II

We first consider when claims for attorneys’ fees are discharged in bankruptcy. The confirmation of a plan of reorganization under Chapter 11 “discharges the debtor from any debt that arose before the date of such confirmation” except as provided in the statute, the plan, or the order confirming the plan. 11 U.S.C. § 1141(d)(1) (emphasis added). “Debt” is liability on a “claim.” 11 U.S.C. §101(12). “Claim” is defined to include a “right to payment, whether or not such right is reduced to judgment, liquidated, unliquidated, fixed, contingent, matured, unmatured, disputed, undisputed, legal, equitable, secured, or unsecured.” 11 U.S.C. § 101(5). A “creditor” is defined to include an “entity that has a claim against the debtor that arose at the time of or before the order for relief concerning the debtor.” 11 U.S.C. § 101(10).

A claim is “contingent” when “the debtor will be called upon to pay [it] only upon the occurrence or happening of an extrinsic event which will trigger the liability of the debtor to the alleged creditor.” In re Fostvedt, 823 F.2d 305, 306 (9th Cir. 1987) (internal quotation marks omitted). A claim is “unliquidated” when it is not “subject to ready determination and precision in computation of the amount due.” Id. (internal quotation marks omitted). “This broadest possible definition of ‘claim’ is designed to ensure that all legal obligations of the debtor, no matter how remote or contingent, will be able to be dealt with in the bankruptcy case.” In re Jensen, 995 F.2d 925, 929 (9th Cir. 1993) (internal quotation marks omitted). “The breadth of the definition of ‘claim’ is critical in effectuating the bankruptcy code’s policy of giving the debtor a ‘fresh start.’ ” Id.

“[F]ederal law determines when a claim arises under the Bankruptcy Code.” In re SNTL Corp., 571 F.3d 826, 839 (9th Cir. 2009). We have recognized that under some circumstances, a creditor may have a claim against a debtor for attorneys’ fees, even though the creditor has not yet incurred those fees. For instance, where the debtor and creditor have entered into a contract that includes an attorneys’ fees agreement, the creditor may be deemed to have a contingent claim for payment of attorneys’ fees even before any fees are incurred. See id. at 843 & n.18 (“[W]hen a creditor’s right to payment for fees exists prepetition [in a Chapter 7 case], the right to payment constitutes a ‘claim,’ within the meaning of § 101(5)(A), albeit an unliquidated, unmatured claim.” (quoting In re New Power Co., 313 B.R. 496, 508 (N.D. Ga. 2004))). Such a contingent claim would then include attorneys’ fees incurred during and after the bankruptcy case. “In general, if the creditor incurs the attorneys’ fees postpetition [in a Chapter 7 case] in connection with exercising or protecting a prepetition claim that included a right to recover attorneys’ fees, the fees will be prepetition in nature, constituting a contingent prepetition obligation that became fixed postpetition when the fees were incurred.” Id. at 844 (quoting 5 Collier on Bankruptcy § 553.03[1][i] (15th ed. Updated 2007)). Said otherwise, when the creditor had a prepetition contingent claim for attorneys’ fees, even attorneys’ fees incurred after that date may be discharged in bankruptcy.

In determining whether a creditor’s claim arose prepetition, we use the “fair contemplation” test. Under this test, “a claim arises when a claimant can fairly or reasonably contemplate the claim’s existence even if a cause of action has not yet accrued under nonbankruptcy law.” Id. at 839; see also In re Jensen, 995 F.2d at 930-31. For instance, in Jensen we held that when a state environmental regulatory agency was aware that the groundwater at the debtors’ site was seriously contaminated before the debtors filed a bankruptcy petition, a contingent claim for cleanup costs was in the “fair contemplation” of the state at the time the debtors filed their Chapter 7 petition. Id. The state’s claim for cleanup costs was therefore discharged in bankruptcy, even though the state incurred nearly a million dollars in cleanup costs after the discharge. Id. Accordingly, if a creditor and debtor are engaged in prepetition litigation pursuant to a contract that includes an attorneys’ fees provision, and the creditor “can fairly or reasonably contemplate” that it will have a claim for attorneys’ fees if an “extrinsic event” occurs (that is, if it prevails in the litigation), then the creditor’s claim for attorneys’ fees will be discharged in the debtor’s bankruptcy even if the creditor incurs attorneys’ fees after the debtor was discharged. See In re SNTL Corp., 571 F.3d at 839; In re Fostvedt, 823 F.2d at 306.

Despite the breadth of this rule, attorneys’ fees incurred by a creditor pursuant to an agreement will not always be in the “fair contemplation” of the parties. See, e.g., Siegel v. Fed. Home Loan Mortg. Corp., 143 F.3d 525; see also In re Ybarra, 424 F.3d 1018. In Siegel, the debtor defaulted on two real estate loans and then filed a bankruptcy petition. 143 F.3d at 527. The lender’s claims were resolved in the bankruptcy, and the debtor received a discharge. Id. But the debtor subsequently brought a lawsuit in state court (later removed to federal court) against the lender, arguing that the lender breached the deed of trust. Id. at 527-28. The district court granted the lender’s motion for summary judgment, and the court awarded the lender attorneys’ fees pursuant to the deed of trust. Id. at 531. We affirmed, rejecting the debtor’s argument that his discharge in bankruptcy included the lender’s claim for attorneys’ fees. Id. at 533. We reasoned that a claim for attorneys’ fees is a contingent claim only where the potential for incurring post-discharge liability was contingent “upon what others might do” and “entirely out of [the debtor’s] hands before he entered bankruptcy.” Id. But where the debtor voluntarily undertook a new course of litigation, which we described as a decision “to return to the fray,” id. at 533, any new liability for attorneys’ fees constituted a post-discharge cost. Id.

We addressed a similar situation in Ybarra. In . that case, a debtor first brought a suit for employment discrimination against her employer in state court. 424 F.3d at 1020. Some eight months later, the debtor filed a Chapter 11 bankruptcy petition, which was subsequently converted to Chapter 7. Id. The trustee for the debt- or’s bankruptcy estate negotiated a settlement agreement with the employer, which was approved by the bankruptcy court. Id. The state court then dismissed the lawsuit. Id. Despite the dismissal of the lawsuit, the debtor took affirmative actions “to revive the state suit.” Id. at 1020, 1027. The debtor claimed her cause of action against the employer constituted exempt property, litigated this issue in bankruptcy court, and (after prevailing on appeal), rejected the settlement agreement and “successfully persuaded the state court to set aside the dismissal.” Id. at 1020. The debtor lost in state court and the employer was awarded attorneys’ fees and costs. Id. at 1020-21 Because the bankruptcy court had previously granted the debtor a discharge, the employer moved the bankruptcy court for leave to enforce the state award of fees and costs. Id. at 1021. The debtor claimed the award was discharged in bankruptcy. Id.

We disagreed. Following Siegel, we noted that “the award of post-petition attorney fees was not discharged” where the debtor returned to the fray by engaging in the “initiation of new litigation” post-petition. Id. at 1023-24 (citing Siegel, 143 F.3d at 534). We concluded that “postpetition attorney fee awards are not discharged where postpetition, the debtor voluntarily pursue[d] a whole new course of litigation, commenced litigation, or returned] to the fray voluntarily.” Id. at 1024 (alterations in original) (internal quotation marks omitted). We therefore rejected the debtor’s argument that the state lawsuit “should be considered continuous litigation, rather than the commencement of a new suit post-petition,” and we instead concluded that the debtor’s “actions to' revive the state suit were sufficiently voluntary and affirmative to be considered ‘returning to the fray.’ ” Id. at 1027; see also In re Sure-Snap Corp., 983 F.2d 1015, 1018-19 (11th Cir. 1993) (holding that when a debtor’s liabilities under an agreement were discharged in bankruptcy, but the debtor challenged the validity of the agreement through a post-discharge appeal “initiated” by the debtor, the debtor can be held liable for attorneys’ fees under the agreement).

The, analysis in these cases is consistent with our fair contemplation test. When parties engage in prepetition litigation that could lead to an award of attorneys’ fees, they may fairly contemplate that the prevailing party will be awarded those fees. Therefore, a creditor’s contingent claim to such fees is discharged in bankruptcy, even if some fees are incurred post-petition. But when the prepetition litigation is resolved in bankruptcy so that any claim (including a contingent claim for attorneys’ fees) against the debtor would be discharged, we cannot say that the debtor’s affirmative action to commence what amounts to “a whole new course of litigation,” Siegel, 143 F.3d at 534, was in the fair contemplation of the parties when the debtor filed a bankruptcy petition. Rather, the debtor’s decision to eschew the fresh start provided by bankruptcy and engage in new litigation is more akin to post-petition conduct that, by definition, was not in the fair contemplation of the parties prepetition. Cf. O’Loghlin v. County of Orange, 229 F.3d 871, 875 (9th Cir. 2000) (holding that a debtor who engages in postpetition illegal discriminatory conduct can be held liable for that conduct, even if claims for similar illegal discriminatory conduct occurring before the bankruptcy were discharged).

III

We now turn to Picerne’s claim for attorneys’ fees related to the state court litigation. Picerne argues it is entitled to attorneys’ fees under an expanded reading of Ybarra and Siegel. According to Picerne, if a debtor continues to litigate a prepetition claim after discharge, and takes any affirmative steps beyond what is necessary to extricate itself from the litigation, the debtor has chosen to “return to the fray,” Siegel, 143 F.3d at 533, and any attorneys’ fees incurred were not discharged. Here, Picerne contends, Castelli-no did more than attempt to extricate itself from the state court litigation: it brought a motion for summary judgment, opposed Picerne’s motion for summary judgment, took party and non-party discovery, and made a request for attorneys’ fees. Therefore, according to Picerne, Castellino engaged in the sort of post-discharge conduct that makes it liable for post-discharge attorneys’ fees.

We disagree. Because Picerne and Cas-tellino had entered into a contract with an attorneys’ fees provision, and Picerne commenced an action under that contract against Castellino in state court before Castellino filed a Chapter 11 bankruptcy petition, Picerne’s contingent claim for attorneys’ fees arose before both the filing of Castellino’s bankruptcy petition and the confirmation of Castellino’s plan. Further, the preconfirmation settlement agreement between Picerne and Castellino required the parties to complete the state court litigation. Under these circumstances, Pi-cerne could fairly and reasonably contemplate that it would incur attorneys’ fees associated with the state court litigation and would have a claim for attorneys’ fees under the agreement if it prevailed.

Contrary to Picerne’s argument, Ybar-ra and Siegel are not implicated here. Unlike the debtors in those cases, Cas-tellino was not relieved of liability under its agreement with Picerne and given a fresh start by its discharge in bankruptcy. Rather, the parties agreed that Pi-cerne’s action against Castellino would continue after discharge. Indeed, in order to obtain Picerne’s agreement to withdraw its objections to the plan of reorganization, Castellino and' Picerne agreed to litigate Picerne’s mechanic’s lien claim to conclusion, and the terms of -the plan of reorganization were conditioned on the results of the litigation. Nor did Castellino “pursue a whole new course of litigation,” Siegel, 143 F.3d at 534, after receiving a discharge. Rather, it merely continued to litigate the single legal action that Picerne had commenced before Castellino filed a petition in bankruptcy. Nothing in the agreement or in the definition of “claim” suggests that Castellino’s efforts to defend itself in the ongoing litigation were outside the fair contemplation of the parties. We decline to adopt Picerne’s expanded reading of Ybarra and Siegel, which is inconsistent with our fair contemplation test. The pertinent question is whether the right to obtain attorneys’ fees in the litigation is within the fair contemplation of the parties, and Picerne provides no reason why it would not have fairly contemplated that the parties would proceed with litigation that had not been resolved in bankruptcy.

We conclude that under the circumstances of this case, Picerne could “fairly or reasonably contemplate” that it would have a claim for attorneys’ fees if it prevailed in the state litigation before Castel-lino filed its petition for bankruptcy. Therefore, the district court correctly determined that the claim was discharged when the bankruptcy court confirmed Cas-tellino’s plan.

AFFIRMED. 
      
      
        . We vacated submission after hearing oral argument pending the resolution of Castelli-no's appeal of the state trial court’s ruling. The California Court of Appeal affirmed the trial court and held that Picerne had a valid mechanic’s lien that was superior to the Bank's deed of trust. See Picerne Constr. Corp. v. Villas, 244 Cal.App.4th 1201, 199 Cal.Rptr.3d 257 (2016).
     
      
      . We do not reach this issue because we conclude that the attorneys’ fees were discharged by Castellino's bankruptcy.
     
      
      . Although § 1141(d)(1) provides that a Chapter 11 debtor is generally discharged from any pre-confirmation debts, we have sometimes referred to pre-petition claims in discussing whether claims discharged in a Chapter 11 bankruptcy have subsequently been revived. See, e.g., In re SNTL Corp., 571 F.3d 826, 843-44 (9th Cir. 2009). Other courts have recognized a similar inconsistency. See In re Man-ville Forest Prods. Corp., 209 F.3d 125, 128 n.1 (2d Cir. 2000) (noting “an inconsistency between the wording of the Bankruptcy Code, which discharges debt arising before the confirmation date” and its statement in a prior decision "that the discharged debt must arise before the filing date”). As in Manville Forest, we need not resolve that point here because it is undisputed that the claim at issue arose before Castellino filed its Chapter 11 bankruptcy petition, and therefore the claim necessarily also arose before the confirmation date. For simplicity, we will refer to prepetition claims throughout this opinion.
     
      
      . The Bankruptcy Code defines any party with a contingent, unliquidated prepetition claim against the debtor for attorneys’ fees to be a "creditor.” See 11 U.S.C. § 101(10).
     
      
      . During the bankruptcy proceedings, Castel-lino disputed that it made a claim for attorneys’ fees, stating that it made a single, mistaken request for attorneys' fees and did not pursue the claim.
     
      
      . Because we decide the case on this ground, we need not reach Castellino's argument that Picerne's release of "any and all claims” pursuant to the settlement agreement precluded it from recovering attorneys’ fees.
     