
25 Cal.App.4th 1686 (1994)
HOSPITAL SYSTEMS, INC., Plaintiff and Appellant,
v.
OFFICE OF STATEWIDE HEALTH PLANNING AND DEVELOPMENT, Defendant and Respondent.
Docket No. C014341.
Court of Appeals of California, Third District.
June 17, 1994.
*1687 COUNSEL
McDonough, Holland & Allen, David W. Post and Marcia L. Augsburger for Plaintiff and Appellant.
Daniel E. Lungren, Attorney General, Charlton G. Holland III, Assistant Attorney General, Dennis Eckhart and Michael V. Hammang, Deputy Attorneys General, for Defendant and Respondent.
*1688 OPINION
SPARKS, J.
The question presented in this appeal is whether Code of Civil Procedure section 1021.5 authorizes an award of attorney fees to a party who prevails at an administrative hearing and thereby resolves a dispute without resorting to a lawsuit. The plaintiff in this case filed an independent action for attorney fees under this statute after it had prevailed in an administrative proceeding. The trial court granted judgment on the pleadings in favor of defendant. We conclude that the clear language of the statute precludes a court from awarding fees in such a case and therefore shall affirm the judgment.

FACTUAL AND PROCEDURAL BACKGROUND
Under the Alfred E. Alquist Hospital Facilities Seismic Safety Act of 1982 (Health & Saf. Code, § 15000 et seq.), the Office of Statewide Health Planning and Development (OSHPD) is charged with the duty of "observ[ing] the construction of, or addition to, any hospital building or the reconstruction or alteration of any hospital building, as it deems necessary to comply with this chapter for the protection of life and property." (Health & Saf. Code, § 15040.) OSHPD is also required to "pass upon and approve or reject all plans for the construction or the alteration of any hospital building, independently reviewing the design to assure compliance with the requirements of this chapter." (Health & Saf. Code, § 15043, subd. (a).) With certain exceptions, OSHPD is empowered to "make rules and regulations as it deems necessary, proper, or suitable to effectually carry out this chapter. [OSHPD] shall also propose and submit building standards to the California Building Standards Commission for adoption and approval pursuant to Chapter 4 (commencing with Section 18935) of Part 2.5 of Division 13 relating to seismic safety for hospital buildings." (Health & Saf. Code, § 15055.)
In 1985 OSHPD proposed a building standard regulation dealing with the reaming of gas piping in hospitals. The regulation was adopted and provided in pertinent part that "[a]ll medical gas piping shall have all burrs removed. Pipe ends shall be reamed and all chips removed. Piping shall then be cleaned in accordance with NFPA-56F Chapter 5 requirements." (Cal. Admin. Code, tit. 24, § 4-2110 [1987 Triennial ed.].) In "Guidelines for the Installation of Medical Gas Systems," OSHPD also promulgated brazing requirements for hospitals by specifying that the "brazing alloy in medical gas pipes entirely fill the annulus or ring space between the tube and the fitting on copper medical gas pipes."
*1689 Plaintiff Hospital Systems, Inc., challenged the reaming regulation and the brazing guidelines. In an administrative hearing before OSHPD and its building safety board, plaintiff claimed the regulation and guidelines were unenforceable because they had not been properly promulgated. Following the hearing, OSHPD concluded "a resolution was not possible," and informed plaintiff of its right to appeal to the California Building Standards Commission (Commission). In an administrative appeal, the Commission ruled in plaintiff's favor. It found that the requirements for the brazing of medical gas piping joints contained in the guidelines had "not been properly adopted and approved by the [Commission]" and consequently "have no force or effect" and were therefore "unenforceable." According to the Commission, "[t]he only adopted standard for these systems is the NFPA [National Fire Protection Association] pressure test." As to the reaming regulation, "[n]otwithstanding previous [Commission] approval of Section 2110 and its current inclusion in the State Mechanical Code, the Commission feels that, lacking documented evidence of the necessity for the adoption of this section, and in light of the obscure and conflicting references in NFPA, AWS [American Welding Society] and IAPMO [International Association of Plumbing & Mechanical Officials] standards on this issue, the requirement for the reaming of medical gas piping may be unnecessary." "Given the diversity of opinion on this issue and the lack of data in support of OSHPD's original adoption of Section 2110 of the State Mechanical Code," the Commission decided that "OSHPD should substantiate the need for the reaming of medical gas piping based on H&S Code Section 18930." OSHPD did not appeal these findings and rulings, and consequently they became final.
Plaintiff thereafter filed a complaint in superior court seeking more than $43,000 for attorney fees incurred in the two administrative proceedings, asserting these fees were authorized by Code of Civil Procedure section 1021.5. (All subsequent statutory references are to the Code of Civil Procedure unless otherwise indicated.) This statute provides: "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 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."
OSHPD moved for judgment on the pleadings, asserting that as a matter of law section 1021.5 is inapplicable to fees incurred solely and exclusively *1690 in an administrative proceeding. The trial court agreed and granted the motion, finding:
"1. [S]ection 1021.5 applies to `actions,' which word has a well[-]established meaning as referring to a proceeding in a court of law.
"2. The parties accepted the decision of the ... Commission; thus, the matter presently before the Court involved no substantive dispute requiring resolution by this Court.
"3. Cases cited by plaintiff in opposition to this motion involved court actions filed after an administrative proceeding to resolve substantive issues.
"4. Public policy encourages administrative resolution of disputes as a means to lighten the burden placed upon the court system.
"5. Plaintiff's argument for an award of attorneys' fees based on litigation costs exclusively in the administrative forum are more appropriately addressed to the Legislature.
"6. The facts set forth in the complaint did not raise questions of constitutional dimension."
The court entered judgment in favor of OSHPD and this appeal followed.

DISCUSSION
(1) As a general rule, a prevailing party must bear its own attorney fees unless a statute or agreement of the parties provides otherwise. (§ 1021; Gray v. Don Miller & Associates, Inc. (1984) 35 Cal.3d 498, 504 [198 Cal. Rptr. 551, 674 P.2d 253, 44 A.L.R.4th 763].) (2a) Plaintiff's claim to fees is based solely on one such statutory provision, section 1021.5, the codification of the private attorney general doctrine.[1] (Maria P. v. Riles (1987) 43 Cal.3d 1281, 1288 [240 Cal. Rptr. 872, 743 P.2d 932].) (3) This doctrine is designed to encourage lawsuits effectuating a strong public policy by awarding attorney fees to those who bring such suits and thereby benefit the public interest or a broad class of people. (In re Head (1986) 42 Cal.3d 223, 227 [228 Cal. Rptr. 184, 721 P.2d 65]; Bouvia v. County of Los Angeles (1987) 195 Cal. App.3d 1075, 1082 [241 Cal. Rptr. *1691 239].) It "`rests upon the recognition that privately initiated lawsuits are often essential to the effectuation of the fundamental public policies embodied in constitutional or statutory provisions, and that, without some mechanism authorizing the award of attorney fees, private actions to enforce such important public policies will as a practical matter frequently be infeasible.' Thus, the fundamental objective of the doctrine is to encourage suits enforcing important public policies by providing substantial attorney fees to successful litigants in such cases." (Maria P. v. Riles, supra, 43 Cal.3d at p. 1289, quoting Woodland Hills Residents Assn., Inc. v. City Council (1979) 23 Cal.3d 917, 933 [154 Cal. Rptr. 503, 593 P.2d 200].)
Section 1021.5 authorizes an award of attorney fees to a prevailing party "[u]pon motion ... in any action which has resulted in the enforcement of an important right affecting the public interest" if three conditions are met: (1) a significant benefit, either pecuniary or nonpecuniary, has been conferred on the general public or a broad class of people; (2) the necessity and financial burden of private enforcement make an award appropriate; and (3) the fees should not, in the interest of justice, be paid out of any recovery. (§ 1021.5) (2b) Plaintiff asserts it is entitled to file an action for fees under this statute despite the fact that its dispute was conclusively and finally resolved at the administrative level. The language of the statute compels us to disagree.
Attorney fees under section 1021.5 are awarded "[u]pon motion." Section 1003 defines a motion as "[a]n application for an order...." An order is a "direction of a court or judge, made or entered in writing, and not included in a judgment...." (§ 1003.) Section 1004 directs that "motions must be made in the court in which the action is pending." As courts have explained, "[a] motion is not an independent right or remedy; it is confined to incidental matters in the progress of a cause. A motion relates to some question that is collateral to the main object of the action and is connected with and dependent upon the principal remedy." (Donald J. v. Evna M. (1978) 81 Cal. App.3d 929, 934 [147 Cal. Rptr. 15]; accord, Killian v. Millard (1991) 228 Cal. App.3d 1601, 1606 [279 Cal. Rptr. 877].) A "motion" therefore implies the "pendency of [a] suit[] between the parties," (People v. Burks (1961) 189 Cal. App.2d 313, 317 [11 Cal. Rptr. 200]) and is ancillary to an ongoing action or proceeding. (People v. Gonzalez (1990) 51 Cal.3d 1179, 1257 [275 Cal. Rptr. 729, 800 P.2d 1159]; see also People v. Sparks (1952) 112 Cal. App.2d 120, 121 [246 P.2d 64]; 6 Witkin, Cal. Procedure (3d ed. 1985) Proceedings Without Trial, § 3, p. 329.)
Thus, a motion for attorney fees must relate to an existing lawsuit and must be filed in the court in which that suit is pending. A motion under *1692 section 1021.5 "`does not create a new cause of action ...' [citation], much less a new `action.' It is a collateral matter, ancillary to the main cause." (Serrano v. Unruh (1982) 32 Cal.3d 621, 636-637 [186 Cal. Rptr. 754, 652 P.2d 985]; accord, Maria P. v. Riles, supra, 43 Cal.3d at p. 1289; Citizens Against Rent Control v. City of Berkeley (1986) 181 Cal. App.3d 213, 226 [226 Cal. Rptr. 265]; No Oil, Inc. v. City of Los Angeles (1984) 153 Cal. App.3d 998, 1006 [200 Cal. Rptr. 768].)
This does not mean, however, that a court can never award attorney fees under section 1021.5 for services provided in a quasi-judicial administrative proceeding. In appropriate circumstances, where the administrative proceeding and the lawsuit are sufficiently entwined, the court on motion may award attorney fees under the statute for services during the administrative proceeding. The appellate court explained such an award in Wallace v. Consumers Cooperative of Berkeley, Inc. (1985) 170 Cal. App.3d 836 [216 Cal. Rptr. 649]: "When the trial court included fees for the services rendered in conjunction with the administrative proceedings, it described those proceedings and this action as `intertwined inextricably.' The court's description is accurate. According to the memorandum of understanding which settled this action for all practical purposes, respondents' promise to abandon their claims was contingent in part on the occurrence of those administrative hearings, and the fact that respondents would participate in the hearings was implicit in the agreement. Given the terms of the memorandum, it is also apparent that the legal services performed in those proceedings were both useful and necessary to the ultimate resolution of the action, and directly contributed to that resolution. Under the circumstances, it was well within the range of the trial court's discretion to determine that the attorney time expended in the administrative hearings was in effect time `reasonably expended' in the action itself. The award was proper." (Id. at pp. 848-849.)
But plaintiff here had resolved its case at the administrative level without the need to resort to litigation. Under these circumstances, there was no pending action in which to move for attorney fees. Plaintiff implicitly recognized this problem when it filed an independent "complaint" for attorney fees under section 1021.5. However, section 1021.5 does not authorize such a procedure; fees may be awarded only "upon motion," i.e., in conjunction with a pending court matter. Since no such matter existed, plaintiff was precluded from recovering attorney fees under the statute.
Plaintiff relies on numerous cases, most notably Best v. California Apprenticeship Council (1987) 193 Cal. App.3d 1448 [240 Cal. Rptr. 1], in asserting that fees are in fact recoverable for work done at the administrative level. *1693 Plaintiff fails to recognize that each of the cited cases either did not involve any administrative proceeding or involved both administrative proceedings and court litigation. Fees were thus properly sought in all of these cases "upon motion" in a pending superior court action.
We review Best at some length to emphasize the procedural differences between that case and the one currently before us. The plaintiff in Best, a participant in an electrical apprenticeship program, sought an exemption, based on his religious beliefs, from assignment at a nuclear power plant. (Best v. California Apprenticeship Council, supra, 193 Cal. App.3d at p. 1454.) His request was denied and he was terminated from the program. Two administrative proceedings ensued, which resulted in the program's decision being upheld. Plaintiff petitioned for a writ of mandate in the trial court to set aside this decision. The writ was denied, but plaintiff successfully appealed the matter to the Court of Appeal. Upon remand, the superior court entered judgment in accordance with the Court of Appeal's decision and awarded attorney fees under section 1021.5. However, it disallowed fees for expenses incurred in the administrative proceedings. Plaintiff appealed, asserting he was entitled to recover such fees. (193 Cal. App.3d at p. 1454.)
The Court of Appeal agreed, concluding fees should be awarded for services provided in administrative proceedings if "they were useful and of a type ordinarily necessary to the vindication of the public interest litigated by the private party." (Best v. California Apprenticeship Council, supra, 193 Cal. App.3d at p. 1459.) The court found that in such a case, the proceeding qualified as an "action" for purposes of section 1021.5 (attorney fees may be awarded to a successful party "in any action which has resulted in the enforcement of an important right"). (193 Cal. App.3d at p. 1459, italics added.) Reviewing sections 20 through 23,[2] the court stated: "[T]he term `action,' ... refers to a distinction between two classes of judicial remedies: (1) actions, which are ordinary proceedings derived from actions at law or suits in equity, and (2) special proceedings, which are established by statute and usually create new remedies unknown to the common law or *1694 equity courts. [Citations.] Thus, the distinction between `action' and `proceeding' in the Code of Civil Procedure has nothing to do with the distinction between judicial and administrative proceedings, but rather distinguishes between two types of judicial proceedings. Indeed, the writ of mandate proceeding involved here is described as a special proceeding, not an action. [Citations.] Yet, respondents do not argue, nor would it be reasonable to argue, that the court could not award attorney's fees for the mandamus proceeding. [Citation.] In short, the use of the term `action' does not in all contexts refer to the technical meaning of the term as defined in the Code of Civil Procedure. [Citations.]" (193 Cal. App.3d at p. 1460, fn. omitted & italics in original.)
The Best court noted this conclusion was bolstered by the Supreme Court's decision in In re Head, supra, 42 Cal.3d 223, which held that fees could be awarded under section 1021.5 in a habeas corpus proceeding vindicating prisoners' rights, because "`the nature of the relief sought, not the label or procedural device by which the action is brought, is determinative of the right to seek fees under section 1021.5.'" (193 Cal. App.3d at p. 1461.) The Best court reasoned "the fact the vindication of the public interest was sought beginning in an administrative rather than judicial forum should not be allowed to frustrate the legislative intent of encouraging public interest litigation." (Id. at p. 1461, fn. omitted.)
In a statement especially relevant to the case now before us, the Best court further noted, "In the context of the present case, we find that whether administrative proceedings precede or follow a court action, is a distinction without a difference, since the order alone does not make the proceedings any less intertwined, useful and of a type ordinarily necessary to the court action." (Best v. California Apprenticeship Council, supra, 193 Cal. App.3d at p. 1462.) The rule enunciated in Best thus clearly envisioned a court proceeding as one of the steps in resolving a given dispute, either before or after the administrative proceeding. Here, however, there was no court litigation.
The Best court specifically commented on this situation in a footnote: "It is not necessary to the resolution of this case for us to decide the issue of whether a party whose public interest dispute is resolved at the administrative level, without needing to resort to a court action, can obtain attorney's fees either from the administrative agency or from a court in a separate action brought solely to obtain fees. We note the United States Supreme Court has recently interpreted 42 United States section 1988 as not allowing such a separate court action. (North Carolina Dept. of Transp. v. Crest Street *1695 [(1986)] 479 U.S. 6 [93 L.Ed.2d 188, 107 S.Ct. 336].) North Carolina's interpretation of section 1988 may or may not apply to an award of attorney's fees under California law. Under federal law, fees based on the private attorney general doctrine are available only by statutory authorization. [Citation.] In contrast, under California law, courts have the equitable power to award attorney's fees under the private attorney general doctrine, at least when constitutional rights are vindicated, even absent statutory authorization. [Citations.]
"Since our Supreme Court has held an administrative agency has the equitable power to award attorney's fees under the common fund doctrine [citation], it is arguable an administrative agency has the equitable power to award attorney's fees under the private attorney general doctrine. Thus even if California's section 1021.5 was interpreted in the same manner as the federal section 1988 (i.e., as authorizing attorney's fees only when resort to a court is necessary to vindicate the claim), an award of attorney's fees solely for an administrative action may still be available based on the equitable powers of the administrative agency which do not depend on statutory authorization." (193 Cal. App.3d at p. 1462, fn. 12.)
Plaintiff asserts this footnote establishes that "... the Best court specifically recognized that a separate court action solely for recovery of private attorney general fees may be brought pursuant to section 1021.5." The footnote does no such thing. It discusses the possibility of awarding fees in such a case on equitable grounds, not under section 1021.5. However, plaintiff did not seek attorney fees on an equitable theory; as it emphasizes in its own reply brief, its motion was predicated entirely on section 1021.5. Consequently, the musings of the Best court are irrelevant to plaintiff's claim.
Plaintiff raises a number of public policy concerns and argues that the inability to award fees in cases such as this will act as a disincentive to settling matters at the administrative level and will unduly burden the court system. We note that the Legislature has already provided for an award of reasonable litigation expenses in civil actions between a small business and a state regulatory agency when the court determines that the action of the agency was undertaken "without any substantial justification." (§ 1028.5, subd. (a).) Under this statute, reasonable litigation expenses include "expenses incurred in administrative proceedings." (§ 1028.5, subd. (b).) In any event, whatever the merits of plaintiff's claims, they are addressed to the wrong forum. The language of section 1021.5 is clear: a party may claim *1696 attorney fees under section 1021.5 only upon motion in conjunction with ongoing court litigation. Any statutory changes must be made by the Legislature, not this court.
In sum, because plaintiff resolved its claim at the administrative level and did not have to resort to litigation for vindication, it was not entitled to fees under section 1021.5. The trial court properly granted OHSPD's motion for judgment on the pleadings.

DISPOSITION
The judgment is affirmed.
Puglia, P.J., and Scotland, J., concurred.
NOTES
[1]  Because plaintiff expressly states it is seeking fees only pursuant to section 1021.5, we have no occasion to discuss the various court-created equitable exceptions to the general rule concerning attorney fees. (See generally, Gray v. Don Miller & Associates, Inc., supra, 35 Cal.3d at p. 505.)
[2]  Section 20 provides: "Judicial remedies are such as are administered by the courts of justice, or by judicial officers empowered for that purpose by the Constitution and the statutes of this State."

Section 21 states: "These remedies are divided into two classes: [¶] 1. Actions; and, [¶] 2. Special proceedings."
Section 22 provides: "An action is an ordinary proceeding in a court of justice by which one party prosecutes another for the declaration, enforcement or protection of a right, the redress or prevention of a wrong, or the punishment of a public offense."
Section 23 provides: "Every other remedy is a special proceeding."
