
190 Cal.App.3d 15 (1987)
235 Cal. Rptr. 238
CARMEN LEZAMA et al., Plaintiffs and Appellants,
v.
THE JUSTICE COURT FOR THE SAN BENITO JUDICIAL DISTRICT OF SAN BENITO COUNTY et al., Defendants and Respondents.
Docket No. A025829.
Court of Appeals of California, First District, Division Five.
March 11, 1987.
*18 COUNSEL
Lydia Villarreal, Juan Uranga, William H. Guy, Graciela E. Zavala and Richard Kohn for Plaintiffs and Appellants.
Harry Damkar, District Attorney, Ernest Rusconi and Rusconi, Jack, Foster & Thomas for Defendants and Respondents.
Richard Chernick, R. Gus Lehouck, Douglas B. Schreier and Gibson, Dunn & Crutcher as Amici Curiae on behalf of Defendants and Respondents.
OPINION
KING, J.
Plaintiff Carmen Lezama and five coplaintiffs (Lezama) appeal from portions of a judgment denying declaratory and injunctive relief and attorney fees against the Justice Court of San Benito County (the justice court). We affirm.

I

THE FACTS
In 1981, the six plaintiffs were brought before the justice court on various misdemeanor charges arising from a labor dispute between their union and *19 their employer. The justice court appointed defense counsel on the basis of indigence and subsequently assessed legal fees against plaintiffs at their sentencing hearings. The justice court gave no notice of hearing to determine the plaintiffs' abilities to pay, and did not inform plaintiffs of their rights to contest the fee assessments. Penal Code section 987.8, prescribing the procedure for determining a defendant's ability to pay the costs of appointed counsel, requires a hearing to determine such ability. The statute was amended in 1983 expressly to require notice of such a hearing, which notice must include a statement of various procedural and evidentiary rights under the statute. (Stats. 1983, ch. 142, § 120.)
Lezama took no action with regard to the fee assessments, except to file the present action against the justice court. In a complaint and petition for writ of mandate Lezama alleged, inter alia, violation of the hearing requirements of Penal Code section 987.8 and deprivation of civil rights  the right to a jury trial and the right to counsel  in violation of 42 United States Code section 1983. Lezama sought (1) a writ of mandate commanding the justice court to set aside its orders for payment of legal fees, (2) a declaration that the justice court had violated Penal Code section 987.8 and 42 United States Code section 1983, (3) an injunction against further violations of sections 987.8 and 1983, and (4) an award of Lezama's attorney fees.
The superior court sustained a demurrer to the causes of action seeking relief in the form of a writ of mandate. After trial the court rendered a judgment setting aside the justice court's fee assessments, on the basis of failure to comply with the hearing requirements of Penal Code section 987.8. However, the court denied declaratory or injunctive relief, based on its belief that it lacked authority to grant such relief against another court. The court found no violation of the right to a jury trial. The court also denied attorney fees. Lezama appeals from the portions of the judgment denying declaratory and injunctive relief and attorney fees.[1]

II

AVAILABILITY OF DECLARATORY AND INJUNCTIVE RELIEF
(1a) Lezama contends the superior court erred in determining that it lacked authority to grant declaratory or injunctive relief against the justice court. Lezama relies on Pulliam v. Allen (1984) 466 U.S. 522 [80 L.Ed.2d 565, 104 S.Ct. 1970], for the proposition that there is no common law judicial immunity from injunctive relief, and also argues that because Pulliam *20 speaks in terms of nonimmunity from "prospective" relief its holding extends to declaratory relief as well. (See Greene v. Zank (1984) 158 Cal. App.3d 497, 507, fn. 10 [204 Cal. Rptr. 770].) The justice court responds that the superior court had discretion to deny declaratory or injunctive relief and properly exercised such discretion.
The issue in Pulliam was whether a judicial officer was immune from injunctive relief and an award of attorney fees in a federal civil rights action. (42 U.S.C. §§ 1983, 1988.) The United States Supreme Court explored the parameters of judicial immunity. The court stated that the "more fundamental question" presented was "whether a judicial officer acting in her judicial capacity should be immune from prospective injunctive relief." (466 U.S. at p. 528 [80 L.Ed.2d at p. 570].) The court determined that at common law there has never been judicial immunity from prospective injunctive relief, as opposed to actions for damages. (466 U.S. at pp. 529-541 [80 L.Ed.2d at pp. 571-579].) The court concluded quite plainly that "judicial immunity is not a bar to prospective injunctive relief against a judicial officer acting in her judicial capacity." (466 U.S. at pp. 541-542 [80 L.Ed.2d at p. 579].) Thus, to reach the holding that there is no immunity from injunctive relief in federal civil rights actions, the Supreme Court determined that there is no judicial immunity from any action for injunctive relief.
We turn to the justice court's argument that the superior court had discretion to deny declaratory or injunctive relief and properly exercised such discretion.
It is true that the superior court had discretion to grant or deny the equitable relief sought. Code of Civil Procedure section 526 states that a court "may" grant an injunction in specified cases; Code of Civil Procedure section 1061 expressly states that a court may refuse to grant declaratory relief if it "is not necessary or proper at the time under all the circumstances."
The record in the present case demonstrates, however, that the superior court did not exercise such discretion, but denied declaratory or injunctive relief solely on the basis of its mistaken belief that it lacked the authority to grant such relief. The court stated on several occasions in open court that it had no power to grant declaratory relief against another court, twice inviting Lezama's counsel to "give me one case" authorizing such relief. The court's written judgment stated that injunctive and declaratory relief was denied on the basis of a lack of "jurisdiction to grant such relief against a Justice Court." Indeed, the court's comments in open court suggest that the court may have granted such relief had it believed it was authorized to do so; the court said that "the unfortunate thing with this kind of a case is this: There is no such thing as a declaratory relief available in this type of case." *21 (Italics added.) Thus the superior court never reached the discretionary determination whether to grant declaratory or injunctive relief.
(2), (3) Nevertheless, Lezama's claims necessarily rest on the ability to obtain injunctive relief (Pulliam v. Allen, supra, 466 U.S. at pp. 537-538 [80 L.Ed.2d at pp. 576-577]; Ashelman v. Pope (9th Cir.1986) 793 F.2d 1072, 1075), the prerequisites of which are "a showing of an inadequate remedy at law and of a serious risk of irreparable harm." (436 U.S. at p. 537 [80 L.Ed.2d at p. 576]; Beacon Theatres v. Westover (1959) 359 U.S. 500, 506-507 [3 L.Ed.2d 988, 994-995, 79 S.Ct. 948].) Lezama did not make such a showing.
Lezama could have appealed from the respective judgments of the justice court (Code Civ. Proc., § 904.2, subds. (a), (b); People v. Barger (1979) 97 Cal. App.3d 661, 663 [158 Cal. Rptr. 815]); Lezama could have moved for a new trial (Code Civ. Proc., § 657); Lezama could have moved to vacate the judgments (Code Civ. Proc., § 663); and, finally, the statute itself permits a motion to modify or vacate the judgments. (Pen. Code, § 987.8, subd. (g).) In addition, there is no evidence that the county was attempting to enforce the judgments; to the contrary, Lezama specifically alleged collection had been deferred. Hence, there was "no serious risk of irreparable harm."
(1b) Having failed to establish the prerequisites to injunctive relief, Lezama, as a matter of law, was not entitled to such relief, and the trial court therefore had no discretion to exercise.
(4) Lezama alternately contends that if injunctive relief is denied, the justice court may continue to operate as it has in the past. We disagree.
We presume that all courts will obey and follow the law as interpreted by higher courts, as they are required to do. (Auto Equity Sales, Inc. v. Superior Court (1962) 57 Cal.2d 450 [20 Cal. Rptr. 321, 369 P.2d 937].) In the instant case, the record supports that presumption. It reveals an unfamiliarity with the correct procedure, rather than a desire to avoid or disregard it. The justice court judge testified that he always informed criminal defendants for whom he was appointing counsel that they might subsequently be ordered to make reimbursement for the cost thereof. If any defendant wanted a separate hearing to determine their ability to reimburse the county, he would have granted their request. He operated in a small, rural county where he knew most of the lawyers and defendants involved, and knew how much time was expended and whether they could afford reimbursement. The reimbursement orders in the instant record are modest. His reference to himself as a "one rut man" was to his general routine, and not specifically to the manner in which he handled Penal Code section 987.8 matters.
*22 The record does not indicate that this matter of procedure was ever called to the attention of the justice court judge and/or that he refused to comply. If anything, it indicates the opposite. During the course of the proceedings in the superior court, the trial court, with counsel present, telephoned the justice court. Following that conversation, the superior court obviously felt that once the situation had been explained, no injunctive relief was necessary. Lezama did not request a statement of decision pursuant to Code of Civil Procedure section 632. "Where no statement of decision is requested, it must be presumed that the trial court found facts necessary to support the judgment. [Citations.]" (Roffinella v. Sherinian (1986) 179 Cal. App.3d 230, 236 [224 Cal. Rptr. 502].)
In light of the fact that Lezama did not first seek relief from the justice court prior to filing the superior court action, had an adequate remedy at law, and was in no danger of irreparable harm, we conclude the judgment of the superior court should be affirmed as to the denial of declaratory and injunctive relief, regardless of the reasons given by the trial court to support it. If it is right on any ground, we are required to affirm. (D'Amico v. Board of Medical Examiners (1974) 11 Cal.3d 1, 18-19 [112 Cal. Rptr. 786, 520 P.2d 10].)

III

ATTORNEY FEES UNDER CODE OF CIVIL PROCEDURE SECTION 1021.5
(5a) Lezama claims entitlement to an award of attorney fees against the justice court under Code of Civil Procedure section 1021.5, commonly known as the "private attorney general" statute. This claim is based upon the relief granted by the trial court setting aside the justice court's fee assessments.
Code of Civil Procedure section 1021.5 provides for recovery of attorney fees against courts as public entities. The statute provides in pertinent part, "With respect to actions involving public entities, this section applies to allowances against, but not in favor of, public entities, and no claim shall be required to be filed therefor." (Italics added.) (6) Courts are public entities within the meaning of section 1021.5. (Rhyne v. Municipal Court (1980) 113 Cal. App.3d 807, 824-827 [170 Cal. Rptr. 312] [municipal court subject to award of attorney fees in mandate action].) To hold otherwise would substantially frustrate the legislative purpose underlying section 1021.5 "to ensure that an aggrieved citizen have access to the judicial process where statutory or constitutional rights have been subjected to wholesale trampling." (Id., at p. 825.)
*23 (7) The present case involves a request for an award of attorney fees against a court as a public entity rather than against an individual judge. The court, and not the judge personally, is liable for payment of the award. (Rhyne v. Municipal Court, supra, 113 Cal. App.3d 807; see Brandon v. Holt (1985) 469 U.S. 464 [83 L.Ed.2d 878, 105 S.Ct 873]; Kentucky v. Graham (1985) 473 U.S. 159 [87 L.Ed.2d 114, 105 S.Ct. 3099] [official-capacity suit is against government entity and not the official personally].) Moreover, the judge is entitled to provision of a defense by the employing court. (68 Ops.Cal.Atty.Gen. 127 (1985).) Availability of attorney fees in an action against a court for declaratory or injunctive relief does not carry the threat of personal monetary loss to a judge.
(5b) We turn now to the merits of Lezama's claim of entitlement to an award of attorney fees under Code of Civil Procedure section 1021.5. The trial court could have awarded attorney fees based solely on the setting aside of the fee assessments if it determined that the requirements of section 1021.5 were met. (Rhyne v. Municipal Court, supra, 113 Cal. App.3d at pp. 826-827 [municipal court subject to award of attorney fees in mandate action where court is real party in interest with right to representation]; compare McCarthy v. Superior Court (1944) 65 Cal. App.2d 42, 44-45 [149 P.2d 871] [court in writ proceeding not subject to costs where not an interested party and has no right to representation].)
Section 1021.5 provides in pertinent part that "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 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."
The record before us clearly demonstrates Lezama has failed to meet the criteria for an award of attorney fees under section 1021.5 in the mandate proceeding. First, Lezama neither proved nor claimed that evidence could ever be presented to show the justice court, in making the erroneous fee order, had continued to follow an erroneous practice despite having previously been reversed on the same issue by a higher court. Additionally, and even more significantly, Lezama failed to move to modify or vacate the judgment, and failed to appeal from it. By this failure Lezama is in the position of being unable to prove that obtaining such statutory relief in the initial proceeding would not have resulted in the justice court correcting its procedure on assessing attorney fees. We must presume, as previously stated, that all courts will follow the law as interpreted by higher courts as required by *24 Auto Equity Sales, Inc. v. Superior Court, supra, 57 Cal.2d 450. Thus the exercise of statutory rights by Lezama in the initial proceeding would have made this mandate proceeding unnecessary, negating the criteria for attorney fees under section 1021.5.

IV

ATTORNEY FEES UNDER 42 UNITED STATES CODE SECTION 1988
(8) Lezama also claims entitlement to an award of attorney fees against the justice court under 42 United States Code section 1988, based on the action for deprivation of civil rights under 42 United States Code section 1983. Section 1988 provides in pertinent part that "In any action or proceeding to enforce a provision of sections ... 1983 ... the court, in its discretion, may allow the prevailing party, other than the United States, a reasonable attorney's fee as part of the costs."
Where a party, as here, fails without good cause to take advantage of available statutory remedies within the original proceeding, i.e., motions for a new trial or to modify or vacate the judgment, or appeal, to obtain the relief sought, it would be an abuse of discretion for the court in a collateral proceeding to award attorney fees pursuant to section 1988. Otherwise, unsuccessful litigants would always pursue a collateral rather than a direct attack on an adverse judgment, since a successful result would always produce an award of attorney fees in addition to the relief available by a direct attack. Congress cannot have intended its enactment of the Civil Rights Act to replace direct attacks upon judgments with collateral attacks.

DISPOSITION
The judgment is affirmed.
Low, P.J., and Haning, J., concurred.
A petition for a rehearing was denied March 31, 1987.
NOTES
[1]  Lezama filed the notice of appeal before the judgment was rendered but after the court announced its intended ruling. We treat the notice of appeal as being filed immediately after entry of the judgment. (Cal. Rules of Court, rule 2(c).)
