                FOR PUBLICATION

  UNITED STATES COURT OF APPEALS
       FOR THE NINTH CIRCUIT


INDEPENDENT LIVING CENTER OF            No. 15-56142
SOUTHERN CALIFORNIA, INC., a
nonprofit corporation; GRAY                D.C. No.
PANTHERS OF SACRAMENTO, a               2:08-cv-03315-
nonprofit corporation; GRAY               CAS-MAN
PANTHERS OF SAN FRANCISCO, a
nonprofit corporation; GERALD
SHAPIRO, Pharm. D., DBA Uptown
Pharmacy and Gift Shoppe; SHARON
STEEN, DBA Central Pharmacy;
TRAN PHARMACY, INC.; MARK
BECKWITH; MARGARET DOWLING,
              Petitioners-Appellants,

                 v.

JENNIFER KENT, Director of
Department of Health Care Services
of the State of California;
DEPARTMENT OF HEALTH CARE
SERVICES,
               Respondents-Appellees.
2             INDEP. LIVING CTR. V. KENT


SACRAMENTO FAMILY MEDICAL                  No. 15-56154
CLINICS, INC.; ACACIA ADULT DAY
SERVICES; RONALD B. MEAD,                   D.C. No.
D.D.S.; THEODORE M. MAZER, M.D.,         2:08-cv-03315-
              Intervenors-Appellants,      CAS-MAN

                 v.
                                            OPINION
JENNIFER KENT, Director of
Department of Health Care Services
of the State of California;
DEPARTMENT OF HEALTH CARE
SERVICES,
               Respondents-Appellees.



     Appeal from the United States District Court
         for the Central District of California
     Christina A. Snyder, District Judge, Presiding

       Argued and Submitted September 26, 2018
                 Pasadena, California

               Filed November 21, 2018

Before: WILLIAM A. FLETCHER, MILAN D. SMITH,
    JR., and MORGAN CHRISTEN, Circuit Judges.

         Opinion by Judge Milan D. Smith, Jr.;
            Concurrence by Judge Christen
                  INDEP. LIVING CTR. V. KENT                        3

                          SUMMARY *


                         Attorneys’ Fees

    The panel reversed the district court’s denial of
plaintiffs’ request for attorneys’ fees following the
settlement of litigation concerning California’s Assembly
Bill X3 5, which reduced the Medi-Cal rate of
reimbursement for healthcare providers by ten percent.

    Plaintiffs sought a writ of mandamus under Cal. Civ.
Proc. Code § 1085 on the ground that AB 5 violated Section
30(A) of the Medicaid Act, thereby conflicting with federal
law and violating the Supremacy Clause. The Ninth Circuit
upheld the district court’s preliminary injunction against
enforcement of the ten percent reduction, to apply both
prospectively and retroactively. The Supreme Court vacated
and remanded in light of the Centers for Medicare &
Medicaid Services’ approval of certain plan amendments to
implement AB 5. The parties subsequently entered into a
settlement agreement in which plaintiffs reserved the right
to move for attorneys’ fees. Plaintiffs did so pursuant to Cal.
Civ. Proc. Code § 1021.5, and the district court denied their
motions.

    The panel held that, even though the case was properly
removed from state court based on federal question
jurisdiction, plaintiffs brought a state-law claim and were
therefore permitted to seek attorneys’ fees pursuant to
§ 1021.5. The panel concluded that plaintiffs’ § 1085 Writ

    *
      This summary constitutes no part of the opinion of the court. It
has been prepared by court staff for the convenience of the reader.
4               INDEP. LIVING CTR. V. KENT

was not a federal claim following Armstrong v. Exceptional
Child Care Ctr., Inc., 135 S. Ct. 1378 (2015), which held
that neither the federal Medicaid statute nor the Constitution
provides a cause of action for enforcement of Section 30(A).
The panel concluded that the § 1085 Writ endured as a state-
law claim because, under California law, § 1085 Writs may
issue to compel state agencies to comply with federal
requirements. The panel held that federal common law did
not govern the award of fees and preclude an award pursuant
to state law. The panel concluded that the Erie doctrine
supported allowing plaintiffs to seek fees under § 1021.5.
The panel reversed the district court’s holding that plaintiffs
were precluded from seeking an award of attorneys’ fees
under § 1021.5, and remanded to the district court to
determine whether plaintiffs met the requirements of
§ 1021.5 to obtain a fee award, and if so, to calculate that
award.

    The panel further held that the district court abused its
discretion in denying plaintiffs’ motion to set aside funds for
attorneys’ fees following the decision permitting retroactive
monetary relief from the Medi-Cal reimbursement
reduction. The panel remanded for a determination of
whether plaintiffs could recover any fees from the
retroactive relief.

    Concurring, Judge Christen wrote that she concurred in
the result reached by the majority opinion but reached the
same conclusion in a different way. Judge Christen wrote
that plaintiffs could seek attorneys’ fees under § 1021.5
because the parties’ settlement included a state-law request
for declaratory relief under § 1085. Judge Christen agreed
that it was an abuse of discretion to deny plaintiffs’ motion
to set aside attorneys’ fees from the reimbursement.
                INDEP. LIVING CTR. V. KENT                  5

                        COUNSEL

Erwin Chemerinsky (argued), University of California,
Berkeley, School of Law, Berkeley, California; Stanley L.
Friedman and Rafael Bernardino, Jr., Law Offices of Stanley
L. Friedman, Los Angeles, California; for Petitioners-
Appellants.

Craig J. Cannizzo (argued), Hooper, Lundy & Bookman,
P.C., San Francisco, California; Lloyd A. Bookman and
Jordan B. Keville, Hooper, Lundy & Bookman, P.C., Los
Angeles, California; for Intervenors-Appellants.

Susan M. Carson (argued), Supervising Deputy Attorney
General; Julie Weng-Gutierrez, Senior Assistant Attorney
General; Xavier Becerra, Attorney General of California;
Office of the Attorney General, San Francisco, California;
for Respondents-Appellees.


                         OPINION

M. SMITH, Circuit Judge:

    This case comes before us once again after a decade-long
journey within the federal court system. In these final stages
of the litigation, Petitioners-Appellants (Independent
Living), a group of health care advocacy organizations and
medical care providers, and Intervenors-Appellants
(Intervenors, and together with Independent Living,
Appellants), another group of health care providers and
organizations, seek an award of attorneys’ fees from the
Director of the California Department of Health Care
Services (the Director), and possibly others. We hold that
the district court erroneously concluded that Appellants were
6               INDEP. LIVING CTR. V. KENT

not entitled to seek fees pursuant to California Civil
Procedure Code § 1021.5. In addition, we hold that the
district court abused its discretion in denying Independent
Living’s motion to set aside fees from the retroactive
monetary relief obtained in 2010. Accordingly, we remand
to the district court to determine whether, in light of our
ruling, Appellants meet the requirements to obtain attorneys’
fees pursuant to § 1021.5 and Section III (C)(1)(a) and (b) of
the Settlement Agreement (infra), and whether it is possible
and appropriate at this stage of the litigation for Independent
Living to recoup attorneys’ fees “from Medicaid providers
that purportedly obtained a benefit from counsel’s work,”
pursuant to Section III (C)(1)(c) of the Settlement
Agreement, and that received payments from the
Department of Health Care Services (DHCS) as a result of
this litigation.

    FACTUAL AND PROCEDURAL BACKGROUND

I. Factual Background

    The Medicaid Act authorizes the federal government to
distribute funds to states for the purpose of providing
medical assistance to low-income persons. Participating
states are subject to certain conditions. Armstrong v.
Exceptional Child Care Ctr., Inc., 135 S. Ct. 1378, 1382
(2015). One such condition is the “equal access” provision
(Section 30(A)), which requires that states set provider
reimbursement rates that are “sufficient to enlist enough
providers so that care and services are available under the
plan at least to the extent that such care and services are
available to the general population in the geographic area.”
42 U.S.C. § 1396a(a)(30)(A).

   On February 16, 2008, the California legislature enacted
Assembly Bill X3 5 (AB 5). AB 5 reduced the Medi-Cal—
                INDEP. LIVING CTR. V. KENT                   7

California’s Medicaid program—rate of reimbursement for
healthcare providers by ten percent. These cuts took effect
on July 1, 2008.

II. Procedural Background

    On April 22, 2008, Independent Living filed in Los
Angeles County Superior Court a petition for a writ of
mandamus against the DHCS and the Director, pursuant to
California Code of Civil Procedure § 1085 (the § 1085
Writ). The petition alleged that the ten percent rate reduction
enacted pursuant to AB 5 violated Section 30(A), thereby
conflicting with federal law, and violating the Supremacy
Clause. In addition to the § 1085 Writ, Independent Living
sought an injunction preventing the implementation of AB
5, as well as attorneys’ fees pursuant to California’s Private
Attorney General Act, Cal. Civ. Proc. Code § 1021.5. On
May 19, 2008, the Director removed this action to federal
court based on federal question jurisdiction, and Independent
Living filed the § 1085 Writ in federal court. On June 1,
2008, Independent Living dismissed the DHCS from its
action, leaving only the Director as a defendant.

    On June 25, 2008, the district court denied Independent
Living’s motion for a preliminary injunction preventing the
enforcement of AB 5. We vacated that decision on July 11,
2008, holding that a plaintiff “may bring suit under the
Supremacy Clause to enjoin implementation of a state law
allegedly preempted by federal statute.” Indep. Living Ctr.
of S. Cal. v. Shewry, 543 F.3d 1047, 1049 (9th Cir. 2008)
(per curiam); see Indep. Living Ctr. of S. Cal. v. Shewry,
543 F.3d 1050 (9th Cir. 2008) (Shewry).

   On August 18, 2008, the district court enjoined
enforcement of the ten percent reduction. On August 27,
2008, the court modified its injunction to apply only
8               INDEP. LIVING CTR. V. KENT

prospectively from the date of the injunction because
sovereign immunity purportedly barred retroactive relief.

    On appeal, we analyzed whether retroactive application
of the injunction violated California’s sovereign immunity.
Indep. Living Ctr. of S. Cal. v. Maxwell-Jolly, 572 F.3d 644,
660–63 (9th Cir. 2009), vacated and remanded on other
grounds sub nom. Douglas v. Indep. Living Ctr. of S. Cal.,
132 S. Ct. 1204 (2012). We first found this retroactive relief
would violate California’s sovereign immunity absent the
Director’s waiver of that immunity. Id. at 661. We then
noted that the Director would have waived sovereign
immunity by removing the suit to federal court if California
had previously consented to similar suits in state court. Id.
Consequently, after reviewing numerous California state
court decisions that permitted § 1085 mandamus actions
seeking disbursement of unlawfully withheld funds, we held
that the Director had waived sovereign immunity. Id. at 663.
Therefore, we concluded that the injunction should also have
applied retroactively to Medi-Cal payments between the
time of AB 5’s implementation and the date of the district
court’s injunction (the retroactive period). Id.

    On March 15, 2010, Independent Living moved to set
aside a portion of the monies paid, or to be paid, to Medicaid
providers for the retroactive period to set up a fund from
which attorneys’ fees could be paid. The district court
dismissed this motion because it believed it was premature
and that “[n]either side has provided any reason why [the
court] at the conclusion of the case could not fashion an order
requiring . . . California to pay attorneys’ fees based on what
is ultimately the value of any judgment or settlement.”

   In 2011, the United States Supreme Court granted the
Director’s petition for a writ of certiorari with respect to the
Supremacy Clause issue. Preceding oral argument before
                INDEP. LIVING CTR. V. KENT                 9

the Supreme Court, the Centers for Medicare & Medicaid
Services (CMS), the federal agency in charge of
administering Medicaid, disapproved the Director’s
submitted plan amendments to implement AB 5 because
they did not satisfy Section 30(A). Douglas, 132 S. Ct. at
1209. However, after oral argument, and before the
Supreme Court issued its opinion, CMS approved some of
the pending amendments. Id.

    The Supreme Court ultimately held that CMS’s
decisions regarding the plan amendments changed the
procedural posture of the case, and remanded it to our court
to consider whether the providers could maintain an action
pursuant to the Supremacy Clause. Id. at 1209–11. The
Supreme Court thus vacated, but did not reverse, our
decision affirming the preliminary injunction.

    Following Douglas, the parties resolved this case in
mediation, and produced a Settlement Agreement specifying
the terms of their concord. In Sections III (C)(1)(a) and (b)
of the Settlement Agreement, Appellants reserved the right
to move for attorneys’ fees before the district court. The
state retained the right to oppose any such request. In
addition, Section III (C)(1)(c) of the Settlement Agreement
permitted “any plaintiffs’ attorney” who had appeared in one
of the listed cases to seek attorneys’ fees “from Medicaid
providers that purportedly obtained a benefit from counsel’s
work,” but not from “DHCS or any of the State Released
Entities.”

    Independent Living and Intervenors separately moved
for attorneys’ fees pursuant to § 1021.5. The district court
denied the motions, reasoning that this case involved only
federal law claims, so the district court could not award
attorneys’ fees pursuant to a state-law provision like
10              INDEP. LIVING CTR. V. KENT

§ 1021.5. Independent Living and Intervenors timely
appealed, and their consolidated appeals are before us now.

     JURISDICTION AND STANDARD OF REVIEW

    We have jurisdiction over this appeal pursuant to
28 U.S.C. § 1291. We review a district court’s decision to
deny attorneys’ fees for abuse of discretion. Labotest, Inc.
v. Bonta, 297 F.3d 892, 894 (9th Cir. 2002). Abuse of
discretion occurs if the district court based its decision “on
an erroneous legal conclusion or a clearly erroneous finding
of fact.” Id. We review de novo whether the district court
“applied the correct legal standard in determining
entitlement to attorneys’ fees.” Klein v. City of Laguna
Beach, 810 F.3d 693, 698 (9th Cir. 2016).

                        ANALYSIS

I. Availability of Attorneys’ Fees Under § 1021.5

    The central question in this appeal is whether Appellants
brought a state-law claim or a federal claim, for the answer
to that question will determine whether they are entitled to
seek attorneys’ fees pursuant to California’s § 1021.5 in
federal court. We hold that Appellants brought a state-law
claim, and that they are therefore permitted to seek fees
pursuant to § 1021.5.

     A. Federal Question Jurisdiction

    The Director argues that despite Appellants’ only cause
of action being the § 1085 Writ, their action involved
“solely” federal law, which permitted the federal courts to
exercise federal question jurisdiction. However, the fact that
the federal courts exercised federal question jurisdiction
                INDEP. LIVING CTR. V. KENT                   11

does not automatically determine whether Appellants’ claim
was based on federal or state-law.

    The Director removed this case based on federal question
jurisdiction. With good reason, we originally understood
Appellants’ cause of action to constitute a suit pursuant to
the Supremacy Clause to enjoin state legislation allegedly
preempted by a federal statute (here, the Medicaid Act).
Shewry, 543 F.3d at 1062, 1065–66. In so concluding, we
relied in part on Shaw v. Delta Air Lines, Inc., in which the
Supreme Court observed that a plaintiff bringing such a suit
“presents a federal question which the federal courts have
jurisdiction under 28 U.S.C. § 1331 to resolve.” 463 U.S.
85, n.14 (1983).

    Of course, federal question jurisdiction encompasses
more than just federal causes of action. Federal courts have
jurisdiction to hear “cases in which a well-pleaded complaint
establishes either that federal law creates the cause of action
or that the plaintiff’s right to relief necessarily depends on
resolution of a substantial question of federal law.”
Franchise Tax Bd. v. Constr. Laborers Vacation Tr. for S.
Cal., 463 U.S. 1, 27–28 (1983). Where, as here, state law
creates the cause of action, federal jurisdiction may also lie
if “it appears that some substantial, disputed question of
federal law is a necessary element of one of the well-pleaded
state claims.” Id. at 13. Quiet title actions, for example, have
prompted the exercise of federal question jurisdiction. See,
e.g., Grable & Sons Metal Prods., Inc. v. Darue Eng’g &
Mfg., 545 U.S. 308, 315–16 (2005) (exercising federal
question jurisdiction over a quiet title action that required
analysis of the federal notice statute).

   In Merrell Dow Pharmaceuticals, Inc. v. Thompson, the
Court held that federal question jurisdiction was unavailable
over a state tort claim alleging a violation of a federal
12              INDEP. LIVING CTR. V. KENT

misbranding prohibition, in part because Congress had not
provided a private federal cause of action for that violation.
478 U.S. 804, 812 (1986). However, the Court has since
noted Merrell Dow did not “convert[] a federal cause of
action from a sufficient condition for federal-question
jurisdiction into a necessary one.” Grable & Sons, 545 U.S.
at 317. Rather, a federal right of action is “evidence relevant
to, but not dispositive of” federal question jurisdiction. Id.
Federal question jurisdiction over state-law claims will lie if
a federal issue is “(1) necessarily raised, (2) actually
disputed, (3) substantial, and (4) capable of resolution in
federal court without disturbing the federal-state balance
approved by Congress.” Gunn v. Minton, 568 U.S. 251, 258
(2013).

      We conclude that the § 1085 Writ meets the
requirements of the Gunn/Grable & Sons inquiry, and arises
under federal law within the meaning of 28 U.S.C. § 1331.
To prevail on the § 1085 Writ, Appellants would necessarily
have had to show that AB 5 violated the requirements of
Section 30(A). This purported violation was the “central
point of dispute.” Gunn, 568 U.S. at 259. While the claim
only called for a determination of the validity of California
legislation, it more broadly raised the question of whether
state legislation conflicted with Medicaid requirements.
Given the ubiquitous reliance on Medicaid funding
nationwide, the claim therefore had substantial “importance
. . . to the federal system as a whole.” Id. at 260. Indeed, the
Supreme Court confronted this very issue in Armstrong just
three years after its decision in Douglas. Additionally, the
role of the Supremacy Clause in this case invokes the
essence of the “federal-state balance.” Id. at 258. Therefore,
the Director’s removal was proper, as was the court’s
exercise of federal question jurisdiction over the § 1085
Writ. However, the exercise of federal question jurisdiction
                INDEP. LIVING CTR. V. KENT                   13

did not itself transform the § 1085 Writ into a federal claim.
Determination of whether the § 1085 Writ constituted a
state-law or a federal claim requires further analysis.

   B. State Claim or Federal Claim?

    Appellants seek an award of attorneys’ fees pursuant to
California Code of Civil Procedure§ 1021.5. The Director
argues that fees are unavailable pursuant to § 1021.5 because
Appellants’ claim was federal—a conclusion also reached
by the district court.

     However, during the period between Shewry and this
appeal, the Supreme Court in Armstrong considered a suit
similar to the one at hand. In that case, health providers sued
officials in Idaho’s Department of Health and Welfare,
claiming that Idaho violated Section 30(A) of the Medicaid
Act by reimbursing providers of habilitation services at
impermissible rates. Armstrong, 135 S. Ct. at 1382. We had
affirmed the district court’s grant of summary judgment for
the providers and stated that the providers had an implied
right of action pursuant to the Supremacy Clause. Id. at 1383
(citing Inclusion, Inc. v. Armstrong, 567 F. App’x 496
(2014)). The Supreme Court reversed, holding that the
Supremacy Clause is “not the source of any federal rights
and certainly does not create a cause of action.” Id. (citation
omitted). The Court also determined that the suit against
Idaho for enforcement of Section 30(A) of the Medicaid Act
could not proceed in equity because Section 30(A) implicitly
precluded private enforcement. Id. at 1385. Finally, the
Court held that Section 30(A) of the Medicaid Act did not
confer a private right of action under federal law. Id. at 1387.
Thus, in short order, the Supreme Court determined that
neither the federal statute nor the Constitutional provision at
issue here provides similar plaintiffs a cause of action.
Accordingly, Appellants’ cause of action must be grounded
14                  INDEP. LIVING CTR. V. KENT

in state law, if a cause of action is to exist under the
circumstances alleged.

    Appellants argue that “the gist of [their] claim was that
California breached its contract with the federal
government,” and that breach of contract is a claim arising
under state law. This argument is meritless. In order to
prevail on a contract theory, Appellants would have had to
show that, at the least, they were third-party beneficiaries
entitled to enforce a valid contract between the federal and
state governments—a requirement that might have been
impossible to show. See Sanchez v. Johnson, 416 F.3d 1051,
1059 (9th Cir. 2005) (holding that Medicaid providers “are,
at best, indirect beneficiaries [of 42 U.S.C.
§ 1396a(a)(30)(A)] and it would strain common sense to
read § 30(A) as creating a ‘right’ enforceable by them”).
Regardless, Appellants never attempted or needed to make
that showing, because this case was not litigated as an action
on a contract. Therefore, in order for Appellants to recover
fees under § 1021.5, the § 1085 Writ must stand on its own
as a state-law cause of action. 1


     1
       The parties dispute whether a writ under § 1085 is best described
as a remedial mechanism or a cause of action under California law; in
reality, California courts have employed both descriptors. Compare
Kreeft v. City of Oakland, 80 Cal. Rptr. 2d 137, 141 (Cal. Ct. App. 1998)
(“Ordinary mandamus is the appropriate procedural mechanism for
resolving the dispute in this case. A traditional writ of mandate under
Code of Civil Procedure section 1085 is a method for compelling a City
to perform a legal, usually ministerial duty.” (citations omitted)) with Lee
v. Blue Shield of Cal., 65 Cal. Rptr. 3d 612, 619 (Cal. Ct. App. 2007)
(referring to “a cause of action for a writ of mandate,” as well as a
“declaratory relief cause of action”); see also Hayes v. County of San
Diego, 305 P.3d 252, 257 (Cal. 2013) (ruminating on the precise
meaning of “cause of action” under California law). We need not wade
into this dilemma, because as will be shown, regardless of whether the
                  INDEP. LIVING CTR. V. KENT                       15

    Although Appellant’s breach-of-contract theory is
unavailing, we conclude that in this case the § 1085 Writ
endured as a state-law claim. A brief survey of relevant
cases clearly shows that California courts have deployed
§ 1085 much as it was used in this case. Section 1085
provides that “any court may” issue a writ “to any inferior
tribunal, corporation, board, or person, to compel the
performance of an act which the law specially enjoins, as a
duty resulting from an office, trust, or station . . . .” Cal. Civ.
Proc. Code. § 1085(a). Therefore, writ relief is available to
compel a public agency to perform an act prescribed by law.
See, e.g., Berkeley Unified Sch. Dist. v. City of Berkeley,
297 P.2d 710, 715 (Cal. Ct. App. 1956) (mandamus
appropriate to direct city auditor to release funds from tax
levies for school purposes pursuant to city charter). Writ
relief is available even where state action implicates federal
issues. See Conlan v. Bonta, 125 Cal. Rptr. 2d 788, 803 (Cal.
Ct. App. 2002) (writ of mandate issued to provide Medi-Cal
recipient with proper reimbursements under the Medicaid
Act). Even more relatedly, in Mission Hospital Regional
Medical Center v. Shewry, the California Court of Appeal
considered whether the Medicaid Act’s notice and comment
requirements applied to the California legislature’s action to
freeze the Medicaid rate of reimbursement during the 2004–
2005 fiscal year, after a group of hospitals sought writ relief
under § 1085. 85 Cal. Rptr. 3d 639, 642–43, 649 (Cal. Ct.
App. 2008). The court agreed with the hospitals, remanding
the case to the trial court to issue a writ of mandate enjoining
the DHCS from utilizing the freeze provision. Id. at 661.

   Particularly pertinent to this case, California courts have
previously enforced Section 30(A) by issuing writs of

§ 1085 Writ is a procedural mechanism or a cause of action, its use to
enjoin state action is well recognized.
16              INDEP. LIVING CTR. V. KENT

mandate to the DHCS. See, e.g., Cal. Ass’n for Health Servs.
at Home v. State Dep’t of Health Care Servs., 138 Cal. Rptr.
3d 889, 900 (Cal. Ct. App. 2012) (further rate review of
Medi-Cal reimbursement rates required in accordance with
Section 30(A) and the state plan). However, a recent
California appellate court decision called into question the
future viability of using § 1085 Writs to enforce Section
30(A) violations. See Santa Rosa Mem’l Hosp., Inc. v. Kent,
236 Cal. Rptr. 3d 199, 207 (Cal. Ct. App. 2018). Relying
heavily on the Supreme Court’s decision in Armstrong, the
California Court of Appeal held that a § 1085 Writ could not
issue where the Medicaid Act did not provide for private
enforcement of Section 30(A) and Section 30(A)’s broad
standards for rate setting impeded a clear duty to perform.
Id. at 206–207. The California Supreme Court has not
decided this issue and, arguably, the California Court of
Appeal decisions are split. Still, the potential ability of
Appellants to prosecute this precise case under § 1085 if they
filed again today is largely immaterial to whether they could
have properly initiated such a state-court action in 2008.

    Ultimately, it is clear that, under California law, § 1085
Writs may issue to compel state agencies to comply with
federal requirements. That is the essence of Appellants’
claim. Moreover, a significant portion of Appellants’
success was due to our interpretation of state law. In
Maxwell-Jolly, we analyzed California law to determine
whether sovereign immunity precluded Appellants’ claim
for retroactive relief.        We held that it did not,
acknowledging, “Under California law, an action seeking
injunctive relief that requires a state official to disburse
funds is not an action against the State.” Maxwell-Jolly,
572 F.3d at 662. Thus, had the action remained in state
court, the Director would “not have enjoyed sovereign
immunity” against an order for retroactive payments. Id.
                    INDEP. LIVING CTR. V. KENT                           17

    Accordingly, we conclude that Appellants’ claim
pursuant to § 1085 is properly characterized as a state-law
cause of action and its removal to federal court does not
compel a conclusion otherwise. The overlapping concerns
of federal law did not transform the § 1085 Writ into a
federal claim, for as Armstrong elucidated, there was simply
no federal right of action to be had. Since the § 1085 Writ
was a state-law claim, we now turn to whether Appellants
were entitled to seek attorneys’ fees pursuant to § 1021.5.

    C. State Law Fee Awards in Federal Court

    The general rule in federal courts is that “absent statute
or enforceable contract, litigants pay their own attorneys’
fees.” Alyeska Pipeline Serv. Co v. Wilderness Soc’y,
421 U.S. 240, 257 (1975). We have stated that in a “pure
federal question case” in federal court, federal law governs
attorneys’ fees. Disability Law Ctr. of Alaska, Inc. v.
Anchorage Sch. Dist., 581 F.3d 936, 940 (9th Cir. 2009). By
contrast, “so long as ‘state law does not run counter to a valid
federal statute or rule of court . . . state law denying the right
to attorney’s fees or giving a right thereto, which reflects a
substantial policy of the state, should be followed.’” MRO
Commc’ns, Inc. v. Am. Tel. & Tel. Co., 197 F.3d 1276, 1281
(9th Cir. 1999) (quoting Alyeska, 421 U.S. at 259 n.31).

    Our previous cases in which we denied plaintiffs an
award of fees under state law do not preclude recovery here.
In Klein, we denied the plaintiff attorneys’ fees under
§ 1021.5 because although he pleaded both federal and state-
law claims, he did not prevail on the state-law claims.
810 F.3d at 702. 2 In Home Savings Bank, F.S.B. v. Gillam,

     2
       Incidentally, Klein clearly states “federal courts apply state law for
attorneys’ fees to state claims because of the Erie doctrine.” Id. at 701.
18              INDEP. LIVING CTR. V. KENT

952 F.2d 1152, 1163 (9th Cir. 1991), we reversed the district
court’s award of attorneys’ fees based on Alaska law.
Gillam concerned the control and disposition of a legal
indemnification fund set up by Home Savings Bank (HSB)
with the Federal Home Loan Bank Board. Id. at 1154. The
conservator of HSB sued Gillam, the former chief executive
officer of HSB, to recover severance benefits paid to Gillam
upon his resignation and to contest control over the legal
indemnification fund. Id. We first held that the conservator
had a right of action under the federal Financial Institutions
Reform, Recovery, and Enforcement Act of 1989 (FIRREA)
to sue Gillam. Id. at 1157 (“FIRREA expressly provides for
federal court jurisdiction over actions to which the
[conservator] is a party.”). We then held that the district
court improperly relied on Alaska law to award attorneys’
fees because the federal common law disfavoring non-
statutory awards of fees directly conflicted with the state rule
relied upon by the district court. Id. at 1162.

    Similarly, in Bass v. First Pacific Networks, Inc.,
219 F.3d 1052 (9th Cir. 2000), we considered whether
federal or state law governed the award of attorneys’ fees
incurred in filing a motion under Federal Rule of Civil
Procedure 65.1 for a supersedeas bond posted under Federal
Rule of Civil Procedure 62(d). The plaintiff originally filed
in state court alleging state claims and a federal RICO claim.
Id. at 1053. After the defendant removed the action to
federal court, the district court dismissed the RICO claim but
retained supplemental jurisdiction over the state claims. Id.
The plaintiffs then filed a motion under Rule 65.1 to enforce
a supersedeas bond, which the court granted. Id. at 1054.
This court affirmed the district court’s denial of attorneys’
fees under California state law because the bond was “posted
pursuant to Rule 62(d) and enforced pursuant to Rule 65.1.”
Id. at 1055. The court noted that it had “no opinion” on the
                   INDEP. LIVING CTR. V. KENT                19

availability of attorneys’ fees in a removed action seeking
judgment “on a surety pursuant to state statute,” as opposed
to enforcement of a surety bond issued pursuant to the
Federal Rules. Id. at 1056 n.4.

    This case presents a different issue than those we
confronted in Klein, Gillam, and Bass. Unlike in Klein,
Appellants here prevailed on a state-law claim by succeeding
on the § 1085 Writ. As determined by the Supreme Court,
neither Section 30(A) nor the Constitution provided a federal
right of action for Appellants, so there were no independent
federal claims in this case. Thus, Gillam and Bass, in which
federal provisions provided the right of action or the rule of
decision, are inapposite. In short, federal common law does
not govern the award of fees here, and an award pursuant to
state law would not be improper.

   D. Erie

    Erie 3 principles further persuade us that Appellants are
entitled to seek fees pursuant to § 1021.5. As the Supreme
Court has noted, nothing in Erie requires a departure from
the principle that “a state statute requiring an award of
attorneys’ fees should be applied in a case removed from the
state courts to the federal courts.” Alyeska Pipeline,
421 U.S. at 259 n.31. Although this footnote referred to
diversity jurisdiction cases, we have noted that the Erie
doctrine “applies irrespective of whether the source of
subject matter jurisdiction is diversity or federal question.”
Vess v. Ciba-Geigy Corp. USA, 317 F.3d 1097, 1102 (9th
Cir. 2003). Indeed, Erie itself was partially rooted in a desire
to prevent the “result of a litigation materially to differ
because the suit had been brought in a federal court.” Hanna

   3
       Erie R. Co. v. Tompkins, 304 U.S. 64 (1938).
20              INDEP. LIVING CTR. V. KENT

v. Plumer, 380 U.S. 460, 467 (1965). Further, Erie sought
to avoid the forum shopping that had arisen after Swift v.
Tyson, 41 U.S. 1 (1842). Id.

    Because the § 1085 Writ is a state-law cause of action,
we look to California law to determine whether attorneys’
fees are available to Appellants under § 1021.5 of the
California Code of Civil Procedure. Section 1021.5 is
California’s “private attorney general” fee statute.
Woodland Hills Residents Ass’n, Inc. v. City Council,
593 P.2d 200, 208 (Cal. 1979). It states, “Upon motion, a
court may award attorneys’ fees to a successful party against
one or more opposing parties in any action which has
resulted in the enforcement of an important right affecting
the public interest.” Cal. Civ. Proc. Code § 1021.5.
Pursuant to § 1021.5, a court may award attorneys’ fees to a
“successful party” in any action that

       has resulted in the enforcement of an
       important right affecting the public interest
       if: (a) a significant benefit, whether pecuniary
       or nonpecuniary, has been conferred on the
       general public or a large class of persons,
       (b) the necessity and financial burden of
       private enforcement are such as to make the
       award appropriate, and (c) such fees should
       not in the interest of justice be paid out of the
       recovery, if any.

Maria P. v. Riles, 743 P.2d 932, 935 (Cal. 1987).

    In determining whether a plaintiff is a successful party
for purposes of § 1021.5, “the critical fact is the impact of
the action, not the manner of its resolution.” Id. at 937.
Accordingly, the California Supreme Court has held that a
plaintiff securing a preliminary injunction may be awarded
                INDEP. LIVING CTR. V. KENT                 21

attorneys’ fees under § 1021.5. Press v. Lucky Stores, Inc.,
667 P.2d 704, 710 (1983) (preliminary injunction restraining
defendant from denying plaintiffs access to the store
premises fulfilled § 1021.5’s requirements for an award of
fees).

    In Maria P., for example, the plaintiffs sought a
preliminary injunction to prevent the school district from
denying a student admission to school based on her
noncitizen immigration status, and to prevent the school
district and State superintendent from complying with
California Education Code § 6957, which required the
district to report the child’s immigration status to the board
of supervisors and Immigration and Naturalization Service.
Maria P., 43 Cal. 3d at 934. The trial court issued the
preliminary injunction, ruling that Education Code § 6957
conflicted with the federal Family Education Rights and
Privacy Act of 1974, and was therefore void under the
Supremacy Clause. Id. Between the trial court’s issuance of
the preliminary injunction and the plaintiffs’ motion for
attorneys’ fees, the California legislature amended the
Education Code to delete all reporting requirements. Id. at
935. Due to the legislative amendment, the trial court
awarded attorneys’ fees to the plaintiffs based only on their
work obtaining the preliminary injunction. Id. The
California Court of Appeal reversed the fee award, but the
California Supreme Court held that plaintiffs were
successful parties because the state’s posture changed as a
result of their lawsuit and thus it served the public interest
purposes of § 1021.5. Id. at 935, 938.

    Similarly, here, Appellants secured a preliminary
injunction against the enforcement of California state
legislation on the ground that it violated a federal statute.
Further, Maria P. establishes that CMS’s subsequent
22                 INDEP. LIVING CTR. V. KENT

approval of California’s amended reimbursement rates does
not necessarily preclude Appellants’ recovery of attorneys’
fees.   Thus, California law appears to demonstrate
Appellants are “successful” parties under § 1021.5 and
would have been entitled to move for attorneys’ fees in state
court.

   Thus, to permit the Director to evade attorneys’ fees by
removing this action to federal court would violate the spirit
of Erie and its twin aims. As here, when fees would
probably be available in state court, to preclude a similar
award in federal court would likely lead to forum shopping,
among other maladies. Moreover, such a divergent result
would foster the very “inequitable administration of the
laws” that Erie sought to rectify. Plumer, 380 U.S. at 468.
Therefore, we conclude that the district court erred in
holding that Appellants were precluded from seeking an
award of attorneys’ fees under California Civil Code of
Procedure § 1021.5. 4

    We remand to the district court to determine whether
Appellants meet the requirements of § 1021.5 to obtain a fee
award, and if so, to calculate that award. We express no
opinion as to how the Settlement Agreement may affect such
an award and leave that issue to the district court to consider
in the first instance on remand.




     4
      Appellants also argue that the district court erred by not employing
the doctrine of judicial estoppel against the Director. In light of our
ruling, we find no need to consider this additional argument.
                INDEP. LIVING CTR. V. KENT                 23

II. Motion to Set Aside Attorneys’ Fees from the
    Common Fund

    After our decision in Maxwell-Jolly permitted
retroactive monetary relief from the Medi-Cal
reimbursement reduction, Independent Living moved to set
aside 25 percent of the $70 million reimbursement to set up
a fund for attorneys’ fees. The district court denied the
motion to set aside funds, finding the request “premature”
because there had not yet been a final adjudication or
settlement, and determining that a set-aside was not in the
public interest. Appellants now argue that the district court
abused its discretion when it denied their motion to set aside
funds. We agree.

    “[A] litigant or a lawyer who recovers a common fund
for the benefit of persons other than himself or his client is
entitled to a reasonable attorney’s fee from the fund as a
whole.” Boeing Co. v. Van Gemert, 444 U.S. 472, 478
(1980). The principle justifying this doctrine is that

       persons who obtain the benefit of a lawsuit
       without contributing to its cost are unjustly
       enriched at the successful litigant’s expense.
       Jurisdiction over the fund involved in the
       litigation allows a court to prevent this
       inequity by assessing attorney’s fees against
       the entire fund, thus spreading fees
       proportionately among those benefited by the
       suit.

Id. (citations omitted). An award of fees from a common
fund applies only if “(1) the class of beneficiaries is
sufficiently identifiable, (2) the benefits can be accurately
traced, and (3) the fee can be shifted with some exactitude to
those benefiting.” Paul, Johnson, Alston & Hunt v. Graulty,
24              INDEP. LIVING CTR. V. KENT

886 F.2d 268, 271 (9th Cir. 1989) (quoting In re Hill,
775 F.2d 1037, 1041 (9th Cir. 1985)). We have referred to
the percentage requested by Appellants, 25 percent of the
fund, as a standard or benchmark amount. Six (6) Mexican
Workers v. Ariz. Citrus Growers, 904 F.2d 1301, 1311 (9th
Cir. 1990).

    We conclude that the district court abused its discretion
when it denied Appellants’ motion to set aside funds. First,
the retroactive relief obtained satisfied the common fund
requirements. The identifiable class of beneficiaries was
comprised of Medi-Cal health providers who received
reduced reimbursement for services provided between July
1, 2008 and August 18, 2008. Each member of this class had
an “undisputed and mathematically ascertainable claim to
part of a lump sum judgment recovered on his behalf.” Van
Gemert, 444 U.S. at 749.

    Second, contrary to the district court’s statement, a final
settlement agreement or adjudication on the merits is not a
prerequisite to the formation of a common fund. See Reiser
v. Del Monte Properties Co., 605 F.2d 1135, 1140 n.4 (9th
Cir. 1979) (noting that it is not necessary to an award of
attorneys’ fees that a suit be litigated on the merits). We
observed that the Supreme Court “has refused to place form
over substance, focusing instead on the actual effect of a
plaintiff’s suit.” Id. at 1140. The question is thus “whether
a plaintiff . . . has conferred a benefit on others.” Id. Here,
the procurement of $70 million retroactive relief on behalf
of Medi-Cal providers, many of whom were not plaintiffs in
the case, undoubtedly conferred a benefit onto them
irrespective of a final settlement or adjudication. In finding
otherwise, and denying the motion to set aside funds, the
district court abused its discretion. See Hill, 775 F.2d at
1040 (holding that a district court abuses its discretion if its
                INDEP. LIVING CTR. V. KENT                   25

decision is based on an erroneous conclusion of law or if the
record contains no evidence on which it rationally could
have based its decision).

    The Director’s arguments to the contrary are unavailing.
She primarily argues that the district court’s denial of
Appellants’ motion to set aside funds was not a final
judgment, and therefore we lack jurisdiction to review it
under 28 U.S.C. § 1291. However, “[a] necessary corollary
to the final judgment rule is that a party may appeal
interlocutory orders after entry of final judgment because
those orders merge into that final judgment.” Am. Ironworks
& Erectors, Inc. v. N. Am. Constr. Corp., 248 F.3d 892, 897
(9th Cir. 2001). Appellants could not, and did not, appeal
the denial of their motion to set aside funds at the time that
decision was made. Appellants were only able to appeal that
decision after the district court entered final judgment.

    The Director also summarily argues that Appellants
cannot appeal the motion to set aside attorneys’ fee because
the Settlement Agreement bars this relief. The Settlement
Agreement specifies that the released claims either were
“asserted” in the various cases between the parties (including
this case) or “could have been asserted” in those cases. Yet,
any relief that may result from this claim would likely not
run against the Director, but rather against the recipients of
the $70 million. See Vincent v. Hughes Air W., Inc.,
557 F.2d 759, 770 (9th Cir. 1977) (stating the “the original
client’s attorney’s fees are not shifted to . . . the adversary-
losing party; rather, fees are shifted to third parties, people
viewed as beneficiates of the fund in some way”).
Furthermore, the Settlement Agreement permitted
Appellants to move for attorneys’ fees under the “common
benefit” theory provided they sought payment “exclusively
and directly from Medicaid providers that purportedly
26               INDEP. LIVING CTR. V. KENT

obtained a benefit from counsel’s work, and not from [the
Director].” Therefore, it is doubtful that the Settlement
Agreement serves as a complete bar to this relief, unless the
Director were ordered to pay. In any event, determination of
the Settlement Agreement’s effects, if any, on this issue are
for the district court to ascertain in the first instance.

    We remand this issue to the district court acknowledging
the potential difficulty or impossibility of reversing its denial
of the set aside for attorneys’ fees, given the possible
disposition of the funds to the various Medi-Cal providers
and that some recipient providers may not still be operating.
Nevertheless, the district court is better positioned than we
are to determine if any non-disbursed funds remain, or if
other funds could be recouped from which to award
appropriate attorneys’ fees.

                       CONCLUSION

    We remand to the district court to determine whether
Appellants should recover attorneys’ fees under Cal. Civ. P.
Code § 1021.5, and, if so, the amount of the award. We also
remand for a determination of whether Appellants can
recover any fees from the retroactive relief obtained in 2010.

     REVERSED and REMANDED.
                    INDEP. LIVING CTR. V. KENT                           27

CHRISTEN, Circuit Judge, concurring:

    I concur in the result reached by the majority opinion. I
write separately because I reach the same conclusion in a
different way.

1. Attorneys’ Fees Under Cal. Civ. Proc. Code § 1021.5

    As the majority explains, in February 2008, the
California legislature enacted legislation reducing the
Medicaid reimbursement rate for California healthcare
providers by ten percent. Several Medicaid providers and
recipients (the Appellants here) claimed that the discounted
reimbursement rate was so low that it was inconsistent with
the mandate in § 30(A) of the Medicaid Act, which requires
states to keep the rate high enough to ensure that there are
sufficient provider options. 1 Appellants’ argument was that
the California Legislature’s action ran afoul of the
Supremacy Clause.

    Appellants petitioned for a Writ of Mandate in state court
pursuant to § 1085 of California’s Code of Civil Procedure.
They sought to bar the California Department of Health Care
Services (“DHCS”) and its director from imposing the
discounted reimbursement rate. The Director removed the
action to federal court, and after several years of litigation,
the parties settled their dispute. Appellants now seek

    1
        See 42 U.S.C. §1396a(a)(30)(A), under which states accepting
federal Medicaid funds must “provide such methods and procedures
relating to . . . the payment for, care and services available under the plan
. . . and to assure that payments are consistent with efficiency, economy,
and quality of care and are sufficient to enlist enough providers so that
care and services are available under the plan at least to the extent that
such care and services are available to the general population in the
geographic area[.]”
28               INDEP. LIVING CTR. V. KENT

attorneys’ fees under California’s private attorney general
provision, Cal. Civ. Proc. Code § 1021.5.

    District courts in our circuit have concluded that “federal
courts are without power to issue writs of mandamus to
direct state agencies in the performance of their duties.” See,
e.g., Robinson v. Cal. Bd. of Prison Terms, 997 F. Supp.
1303, 1308 (C.D. Cal. 1998); Dunlap v. Corbin, 532 F. Supp.
183, 187 (D. Ariz. 1981), aff’d, 673 F.2d 1337 (9th Cir.
1982) (table) (finding federal courts lacked the power to
issue a writ of mandamus “directing a state agency to
exercise its discretionary power”); see also Clemes v. Del
Norte Cty. Unified Sch. Dist., 843 F. Supp. 583, 596 (N.D.
Cal. 1994) (concluding district court lacked jurisdiction to
issue a state law writ). 2 The majority cites to a number of
California state court cases to illustrate that writs of mandate
are available, including against the DHCS, to compel
compliance with § 30(A), ante at 15–16, but that authority
does not establish that a federal court is similarly authorized
to order relief pursuant to § 1085. Our court has never
precisely defined whether and when a federal court may
issue a § 1085 Writ of Mandate or injunction, but the State
offers no persuasive support for its argument that federal
courts cannot provide any relief pursuant to that provision.

    Appellants’ basic requested relief did not change when
the State removed their case to federal court. Suits with
federal and state claims are removed in their entirety—“the
entire action may be removed”—and any claims for which
the district court lacks jurisdiction must subsequently be
remanded. 28 U.S.C. § 1441(c)(1)(B) and (2) (emphasis
added). Here, nothing was ever remanded, and as they had

    2
      Abrogated on unrelated grounds by Maynard v. City of San Jose,
37 F.3d 1396, 1403–04 (9th Cir. 1994), as amended (Nov. 22, 1994).
                   INDEP. LIVING CTR. V. KENT                        29

done from the beginning, Appellants continued to seek a
judgment establishing that California’s imposition of a cut
reimbursement rate was unlawful because it conflicted with
§ 30(A)’s mandate. In other words, they sought both
injunctive and declaratory relief.

    Appellants were entitled to continue pressing their claim
because a petition for a § 1085 Writ necessarily includes a
request for a determination and declaration of rights. A court
ruling on a § 1085 petition is required to first determine
whether the requesting party is, or is not, entitled to the “use
and enjoyment of [the] right” at issue. Cal. Civ. Proc. Code
§ 1085(a). Indeed, California case law recognizes that
declaratory relief is the foundation for a § 1085 Writ of
Mandate. See, e.g., Beach & Bluff Conservancy v. City of
Solana Beach, No. D072304, 2018 WL 5023596, at *1 (Cal.
Ct. App. Oct. 17, 2018) (explaining that plaintiff “brought
the present action for declaratory relief and traditional
mandate under Code of Civil Procedure section 1085”). We
need not be concerned with whether the district court could
have issued an injunction or a writ of mandate in Appellants’
favor had this case proceeded to judgment because the
district court certainly could have entered a declaratory
judgment        establishing    whether      the     discounted
reimbursement rate was inconsistent with § 30(A), and that
request for declaratory relief is enough to anchor Appellants’
fees petition. 3



    3
       The State argued that § 1085 is only a procedural mechanism, not
a cause of action. But there is no question that requests for declaratory
relief can be stand-alone causes of action under California law. See Cal.
Civ. Proc. Code § 1060 (allowing a party who desires a declaration of
his or her rights or duties with respect to another to ask for such a
declaration, either alone or with other relief).
30              INDEP. LIVING CTR. V. KENT

    The majority explains that Armstrong v. Exceptional
Child Care Ctr., Inc., essentially foreclosed Appellants’
federal law claims by holding that neither the Supremacy
Clause, the Medicaid statute, nor even general principles of
equity provide a federal basis for challenging a state’s use of
Medicaid funds under § 30(A). 135 S. Ct. 1378, 1383–87
(2015). Armstrong’s limitation may apply to challenges
based on state law as well, because the Court held that “the
Medicaid Act implicitly precludes private enforcement of
§ 30(A),” and thus may preempt suits bringing § 30(A)
challenges under state law. Id. at 1385. If we were ruling
on the merits, Armstrong likely would require dismissal of
Appellants’ claims, but the parties settled their dispute
before Armstrong was decided and we are tasked only with
identifying the nature of the claims the parties resolved. Pre-
Armstrong, California state courts had issued writs of
mandate to force compliance with § 30(A), see ante at 15–
16, and Appellants’ insistence that the State had violated
§ 30(A) presented significant litigation risk to the State.
Both parties were aware of this and their settlement was
global; it encompassed not only the Appellants’ remaining
federal claims but also their state § 1085 claim (or what
remained of it).

    So what state claim was settled? If nothing else, the
settlement included that portion of Appellants’ claim that
constituted a request for declaratory relief; that much of the
§ 1085 claim surely survived. From there, Erie dictates that
California’s substantive law on attorneys’ fees applies. Erie
R. Co. v. Tompkins, 304 U.S. 64 (1938); ante at 19–22. Just
as the State could not escape its waiver of sovereign
immunity by removing the case to federal court, Indep.
Living Ctr. of S. Cal., Inc. v. Maxwell-Jolly, 572 F.3d 644,
                INDEP. LIVING CTR. V. KENT                  31

661–63 (9th Cir. 2009) 4, it could not avoid exposure to
attorneys’ fees through removal. On remand, the district
court must decide whether Appellants’ counsel is eligible for
attorneys’ fees pursuant to Cal. Civ. Proc. Code § 1021.5.

2. Motion to Set Aside Attorneys’ Fees

    I also agree that it was an abuse of discretion to deny
Appellants’ motion to set aside attorneys’ fees from the
$70 million reimbursement. Moreover, it is hard to see
anything that would prevent the district court from recouping
funds to which the Appellants’ attorneys may be entitled, as
long as the relief ultimately comes from providers who
received a windfall as a result of the earlier reimbursement,
and those providers have an opportunity to be heard on any
proposed plan for recoupment.

    Although we lack jurisdiction over the individual
beneficiaries of the original reimbursement fund (i.e., the
various medical care providers), the court continues to have
jurisdiction over the Director and presumably it will be the
Director who will be responsible for reimbursing providers
for services yet to be furnished. I see no absolute obstacle to
gradually recouping an appropriate fee amount either as part
of a fractionally reduced reimbursement payment to the
overcompensated providers or through some comparable
process. The Director pointed out in her briefing at the time
the Appellants moved for a set aside that there are
inefficiencies and transaction costs associated with adjusting
the department’s automated payouts. However, those
difficulties do not appear to be sufficiently onerous to


    4
      Vacated and remanded on other grounds sub nom. Douglas v.
Indep. Living Ctr. of S. Cal., Inc., 132 S. Ct. 1204 (2012).
32            INDEP. LIVING CTR. V. KENT

warrant denying Appellants’ counsel a fee award to which
they may be entitled.
