
20 Cal.2d 684 (1942)
SACRAMENTO MUNICIPAL UTILITY DISTRICT Respondent
v.
PACIFIC GAS AND ELECTRIC COMPANY (a Corporation), Appellant.
Sac. No. 5408. 
Supreme Court of California. In Bank.  
Aug. 11, 1942.
 Thos. J. Straub and John C. Wood for Appellant.
 Robert L. Shinn, Stephen W. Downey, Marshall K. Taylor, John F. Downey and Downey, Brand & Seymour for Respondent.
 CARTER, J.
 Defendant, a California corporation engaged in the operation of electric works and the distribution and sale of electric energy as a public utility within the plaintiff Sacramento Municipal Utility District, appeals from a judgment of the Superior Court of Sacramento County rendered against it in favor of plaintiff for attorney's fees incurred by plaintiff in the defense of an action in the United States District Court and the United States Circuit Court of Appeals, and in opposing the issuance of a writ of certiorari by the United States Supreme Court, which action was prosecuted by defendant to restrain plaintiff from issuing, selling and delivering its bonds voted for the purpose of financing the acquisition and construction of a competing system for the supply of electric energy to the inhabitants of plaintiff district. The instant action was commenced pursuant to the provisions of section 526b of the Code of Civil Procedure.
 On November 6, 1934, the electorate of plaintiff, a municipal utility district of this state organized under the Municipal Utility District Act of 1921 (Stats. 1921, p. 245, as amended; Deering's Gen Laws, 1937, Act 6393), authorized the issuance of $12,000,000 in bonds for the acquisition and construction of works for the supply of electric energy to the inhabitants thereof. On January 2, 1935, pursuant to section 16 of said act, plaintiff commenced a proceeding in rem in the Superior Court of Sacramento County to determine the validity of those bonds. Defendant appeared in that proceeding and contested the validity of said bonds on the ground that the taxation by the district of defendant's property situated within said district to pay the bonds would constitute a taking of its property without due process of law. It was ultimately determined by this court on appeal in that proceeding that the bonds were valid, and it was also determined that the ground of invalidity above mentioned advanced by defendant therein could not be properly considered *687 in that proceeding. (Sacramento M. U. Dist. v. All Parties, 6 Cal.2d 197 [57 P.2d 506].)
 Thereafter defendant commenced an action in the United States District Court against plaintiff seeking to have enjoined the issuance and sale of said bonds, attacking their validity upon the ground above mentioned. No temporary restraining order or preliminary injunction was ever issued and the District Court refused to grant a permanent injunction. (Pacific Gas & Electric Co. v. Sacramento M. Utility Dist., 17 F. Supp. 685.) That judgment was affirmed by the United States Circuit Court of Appeals on defendant's appeal. (Pacific Gas & Electric Co. v. Sacramento M. Utility District, 92 F. (2d) 365.) Defendant's petition to the Supreme Court of the United States for a writ of certiorari was denied on February 14, 1938. (Pacific Gas & Electric Co. v. Sacramento M. Utility Dist., 303 U.S. 640 [58 S. Ct. 610, 82 L.Ed. 1100].) The judgment in the instant action, here appealed from, establishes plaintiff's claim for attorney's fees incurred by it in its successful defense of the action in its course through the various federal courts.
 That judgment is based upon the right of action created by section 526b of the Code of Civil Procedure which reads:
 "Every person or corporation bringing, instigating, exciting or abetting, any suit to obtain an injunction, restraining or enjoining the issuance, sale, offering for sale, or delivery, of bonds, or other securities, or the expenditure of the proceeds of the sale of such bonds or other securities, of any city, city and county, town, county or other district organized under the laws of this state, or any other political subdivision of this state, proposed to be issued, sold, offered for sale or delivered by such city, city and county, town, county, district or other political subdivision, for the purpose of acquiring, constructing, completing, improving or extending water works, electric works, gas works or other public utility works or property, shall, if the injunction sought is finally denied, and if such person or corporation owns, controls, or is operating or interested in, a public utility business of the same nature as that for which such bonds or other securities are proposed to be issued, sold, offered for sale, or delivered, be liable to the defendant for all costs, damages and necessary expenses resulting to such defendant by reason of the filing of such suit."
 It is not questioned that plaintiff's claim for attorney's *688 fees upon which the judgment is based comes within the terms of that section, defendant's sole contention being that said section is unconstitutional as it impairs its right to resort to the federal courts for redress and invades a field belonging to the exclusive jurisdiction of those courts (U.S. Const., art. VI, clause 2; art. III,  2); that it is a general law without uniform operation, is a denial of equal protection of the laws, and a grant of special privileges. (U.S. Const., Fourteenth Amendment; Cal. Const., art. I,  11, 21; art. IV,  25.)
 It is not questioned that as a general rule the jurisdiction of federal courts over cases within the field of their jurisdiction cannot be enlarged, diminished or impaired by state statutes or regulations; and a person may not be deprived of his right to resort to the federal courts by state legislation. (United States Const., art. VI, clause 2, art. III,  2; Home Insurance Co. v. Morse, 20 Wall. 445 [22 L.Ed. 365]; Harrison v. St. L. & San Francisco R. R., 232 U.S. 318; Cowles v. Mercer County, 7 Wall. 118 [19 L.Ed. 86]; Chicot County v. Sherwood, 148 U.S. 529 [13 S. Ct. 695, 37 L.Ed. 546]; Pennsylvania v. Williams, 294 U.S. 176 [55 S. Ct. 380, 79 L.Ed. 841, 96 A.L.R. 1166]; Kline v. Burke Constr. Co., 260 U.S. 226 [43 S. Ct. 79, 67 L.Ed. 226, 24 A.L.R. 1077]; Blake v. McClung, 172 U.S. 239 [19 S. Ct. 165, 43 L.Ed. 432]; Barron v. Burnside, 121 U.S. 186 [7 S. Ct. 931, 30 L.Ed. 915].) Nor is it doubted that the matter of costs in federal courts is controlled exclusively by United States statutes or rules of the federal courts where such statutes or rules exist. (Missouri Pacific Ry. Co. v. Larabee, 234 U.S. 459 [34 S. Ct. 979, 58 L.Ed. 1398]; Tullock v. Mulvane, 184 U.S. 497 [22 S. Ct. 372, 46 L.Ed. 657].)
 [1] However, we believe it is clear that section 526b does not deprive plaintiff of access to the federal courts or impair or restrict the jurisdiction of those courts. That section creates a liability for attorney's fees in the type of actions specified therein regardless of whether the action in which the fees are incurred is in the state or federal courts. No attempt is made to keep parties out of the federal courts by singling out those courts alone as the forum in which the liability for the attorney's fees is incurred, while imposing no liability when the action is prosecuted in a state court. It is only in the event the one upon whom the fee is imposed is unsuccessful in his action that he becomes responsible for the fee. Thus his position is no different from that of any other litigant. *689 If he chooses to litigate the question, he runs the risk of being required to reimburse his opponent for the latter's expenses. The obligation is an independent one created by statute which in no wise purports to regulate or limit the jurisdiction of the federal courts. If the allowance of fees were confined to actions in state courts, the inequitable result would follow that a penalty would be imposed upon a resort to those courts, and an inducement created to seek relief in the federal courts. The substantive right created by the state Legislature in enacting section 526b should not be made dependent upon the court in which the action is prosecuted. In the case of People of Sioux Co. v. National Surety Co., 276 U.S. 238, 243 [48 S. Ct. 239, 72 L.Ed. 547], which involved a state statute creating a right to attorney's fees in an action on a surety bond, the court said:
 "Disregarding mere matters of form it is clear that it is the policy of the state to allow plaintiffs to recover an attorney's fee in certain cases, and it has made that policy effective by making the allowance of the fee mandatory on its courts in those cases. It would be at least anomalous if this policy could be thwarted and the right so plainly given destroyed by removal of the cause to the federal courts." (Emphasis added.)
 It must be remembered that the right created by the statute in question is an independent one. It is not dissimilar, with respect to the contention that there is interference with the jurisdiction of the federal court, to a state statute of limitation. No one would doubt that such statute would apply to an action which reached the federal court by reason of diversity of citizenship. It would not be considered as impairing the right of access to that court.
 Defendant relies upon such cases as Harrison v. St. L. & San Francisco R. R., supra, which involve statutes declaring forfeited a permit issued to a foreign corporation to transact business in the state when it commences an action in or has one transferred to the federal court. (See cases collected 21 A.L.R. 188.) Those cases are manifestly distinguishable from the case at bar inasmuch as a direct penalty is established by the statutes involved therein which singles out and attaches only to the right of access to the federal courts. In the instant case the statute is equally applicable to all courts, and defendant is not prevented from having its constitutional rights protected in the federal courts. It is merely *690 obligated to pay the expenses incurred by its opponent in defending such a suit when it is unsuccessful; that is, when an invasion of its constitutional rights was incorrectly assumed by it as the basis for its action whether instituted in the state or federal courts.
 It must be kept in mind that, generally speaking, the policy of the Supreme Court of the United States is to look with disfavor upon attempted restrictions on the legislative authority and policy of a state. (See Palmer v. Massachusetts, 308 U.S. 79 [60 S. Ct. 34, 84 L.Ed. 93]; Railroad Comm'n v. Pullman Co., 312 U.S. 496 [61 S. Ct. 643, 85 L.Ed. 971].) And except as to matters controlled by the United States Constitution and statutes the federal courts apply state law in matters of substance. (Erie R. Co. v. Tompkins, 304 U.S. 64 [58 S. Ct. 817, 82 L.Ed. 1188, 114 A.L.R. 1487].) The state policy creating the substantive right to counsel fees declared by section 526b should not, in conformity with those rules, be lightly brushed aside as imposing restrictions on the jurisdiction of the federal courts, merely because the right arises upon unsuccessful action being taken in either the federal or state courts. If every time there is some connection between a state created substantive right and an action in the federal courts it would be determined that there was unlawful interference with the jurisdiction of those courts or the right of access thereto, there would be little left of such rights and anomalous results would follow.
 [2] Another phase of this same question is manifested in the rule that, as to matters of costs in actions in the federal courts, the United States statutes when they cover the subject are controlling, and may not be regulated by state statutes which result in penalizing the free access to the federal courts in proper cases. In that connection defendant refers to the federal statutes on the subject of fees and costs in actions in the federal courts. (28 U.S.C.A. 571, 572.) Assuming that the subject of costs is wholly covered by the federal statutes, it does not follow that section 526b is a regulation or provision for costs contrary to those statutes. The essence of the matter is, as we have seen, that that section creates an independent substantive right, and implies no attempt to regulate the practice and procedure in relation to costs in the federal courts. This is brought out in the case of People of Sioux County v. National Surety Co., supra, involving a state statute authorizing the recovery of attorney's *691 fees by a successful plaintiff in an action on a surety bond. The action on the bond was in the federal court. The statute provided that the fees were to be allowed and taxed as costs; that is, the fees were to be allowed by the court hearing the action, rather than in an independent action. Nevertheless, the Supreme Court of the United States held the statute providing for counsel fees to be valid and enforceable, stating at page 241:
 "In striking down so much of the judgment as allowed an attorney's fee the court below was persuaded that sec. 7811, which provides for an attorney's fee, authorized it only as costs to be taxed in the state court. As costs in the federal courts are regulated exclusively by R. S. secs. 823 and 824, the court concluded that other costs, authorized only by a state statute, could not be included in the judgment. See United States v. Sanborn, 135 U.S. 271, 282 [10 S. Ct. 812, 34 L.Ed. 112]; The Baltimore, 8 Wall. (U.S.) 377, 388, et seq.; [19 L.Ed. 463]; compare Ex parte Peterson, 253 U.S. 300, 314-319 [40 S. Ct. 543, 64 L.Ed. 919]."
 "Both in an earlier case, Globe Indemnity Co. v. Sulpho-Saline Bath Co., 299 Fed. 219, certiorari denied 266 U.S. 606 [45 S. Ct. 92, 69 L.Ed. 464]; see also Spring Garden Insurance Co. v. Amusement Syndicate Co., 102 C.C.A. 29 [178 Fed. 519], and in a later case, Business Men's Assurance Co. v. Campbell, 18 F. (2d) 223, the same court applied the Nebraska statute allowing the recovery of attorneys' fees in suits upon insurance policies. When it was argued that no other costs can be taxed in a court of the United States than those authorized by federal statute, the Court of Appeals said in the latter case (p. 224) that the objection 'applies only to ordinary costs, and not to allowances for attorneys' services provided by state statutes.' ..."
 "That the statute directs the allowance, which is made to plaintiff, to be added to the judgment as costs are added does not make it costs in the ordinary sense of the traditional, arbitrary and small fees of court officers, attorneys' docket fees and the like, allowed to counsel by R. S. secs. 823, 824."
 "The present allowance, since it is not costs in the ordinary sense, is not within the field of costs legislation covered by R. S. secs. 823, 824. That the particular mode of enforcing the right provided by the state statute--i.e., by taxing the allowance as costs--is not available to the federal courts *692 under R. S. secs. 823, 824, does not preclude the recovery. Since the right exists, the federal courts may follow their own appropriate procedure for its enforcement by including the amount of the fee in the judgment." (Emphasis added.)
 The distinction between ordinary costs and the counsel fees involved in the action in the case at bar is emphasized in the case of Henkel v. Chicago, etc. Ry., 284 U.S. 444 [52 S. Ct. 223, 76 L.Ed. 386], involving a state statute authorizing the taxing as costs of fees for expert witnesses, the court deciding naturally that such fees were ordinary costs and therefore controlled by the United States statutes where the action was in the federal court. The case of People of Sioux County v. National Surety Co., supra, was distinguished on that ground, but the rule there stated was approved.
 Defendant refers to cases holding that in actions on injunction bonds in the federal courts attorney's fees should not be allowed even though the state law permitted such recovery. (Bein v. Heath, 12 How. (U.S.) 168 [13 L.Ed. 939]; Tullock v. Mulvane, supra.) It is doubtful that those cases are still the law since the decision in Erie R. Co. v. Tomkins, supra, in spite of the holding to the contrary in Travelers Mut. Casualty Co. v. Skeer, 24 F. Supp. 805, but in any event they are clearly distinguishable. They involved bonds given in federal court actions, and naturally the terms thereof would be controlled by the federal law. Such bonds related exclusively to matters involved in the actions pending in the federal courts and were given in the light of and pursuant to the laws and conditions pertaining to those particular actions. There was no statute creating an independent cause of action in any of those cases. Nor do we believe that the case of Missouri Pacific Ry. Co. v. Larabee, supra, relied upon by defendant, is controlling. There a state statute authorized attorney's fees to defendant in a mandamus proceeding. The state court allowed such fees for services rendered in a writ of error proceedings in the United States Supreme Court taken from the decision of the state court. Although the Supreme Court in determining that the fees could not be properly allowed, discussed the proposition that to allow them would deprive a person of access to the federal courts, the allowance was treated entirely as a part of ordinary costs throughout, and the thought was repeatedly expressed that a state statute could not control the procedure of a federal court with reference to such costs. The later *693 case of People of Sioux County v. National Surety Co., supra, recognized the distinction between counsel fees and ordinary costs which, as above seen, was also later recognized in Henkel v. Chicago, etc. Ry., supra. Numerous more recent federal court decisions have recognized the distinction. (See Orlando Candy Co. v. New Hampshire Fire Ins. Co., 51 F. (2d) 392; Associated Mfrs. Corporation v. De Jong, 64 F. (2d) 64; Business Men's Assur. Co. v. Campbell, 18 F. (2d) 223; Benash v. Business Men's Assur. Co., 25 F. (2d) 423; Missouri State L. Ins. Co. v. Jones, 290 U.S. 199 [54 S. Ct. 133, 78 L.Ed. 267].)
 [3a] The contention that the section in question lacks uniformity, grants special privileges and denies equal protection of the laws, is also without merit. None of those constitutional principles is violated if the classification of persons or things affected by the legislation is not arbitrary and is based upon some difference in the classes having a substantial relation to the purpose for which the legislation was designed. (County of San Bernardino v. Way, 18 Cal.2d 647 [117 P.2d 354]; Powers Farms v. Consolidated Irr. Dist., 19 Cal.2d 123, 119 P.2d 717.) [4] A law to be general in its scope need not include all classes of individuals in the state. [5] Nor is a classification void because it does not embrace within it every other class which might be included. (Heron v. Riley, 209 Cal. 507 [289 P. 160]; Powers Farms v. Consolidated Irr. Dist., supra.) Wide discretion is vested in the Legislature in making the classification and every presumption is in favor of the validity of the statute; the decision of the Legislature as to what is a sufficient distinction to warrant the classification will not be overthrown by the courts unless it is palpably arbitrary and beyond rational doubt erroneous. (In re Weisberg, 215 Cal. 624 [12 P.2d 446]; Rainey v. Michel, 6 Cal.2d 259 [57 P.2d 932, 105 A.L.R. 148]; Gillum v. Johnson, 7 Cal.2d 744 [62 P.2d 1037, 63 P.2d 810, 108 A.L.R. 595]; Natural Milk etc. Assn. v. City etc. of S. F., ante, p. 101 [124 P.2d 25].) A distinction in legislation is not arbitrary if any set of facts reasonably can be conceived that would sustain it.
 [3b] Applying those rules to section 526b, it cannot be said that the classification provided by the Legislature was palpably wrong and had no reasonable basis. When a municipality or public agency such as plaintiff in the case at bar *694 engages in the business of producing and distributing electricity, it necessarily comes into competition with any private utility distributing electricity in the same area; that competition may be partially or even totally destructive to the private utility's business. The private utility is without legal redress based upon constitutional guaranties for the results of such competition; its constitutional rights have not been thereby invaded. (Puget Sound etc. Co. v. Seattle, 291 U.S. 619 [54 S. Ct. 542, 78 L.Ed. 1025].) Nevertheless, the Legislature might reasonably have assumed that by reason of the threat to its business by such competition it would be naturally driven by a compelling motive, different and greater than that of other persons, to prosecute, with less scrutinizing of the merits thereof, litigation to hamper and interfere with the development and operation of a public utility by a public agency, and thus either delay or forestall the day when its business would be wholly or partially destroyed by such threatened competition. It would be especially tempted to prosecute such litigation, and the Legislature in order to protect the public agency in engaging in a pursuit which it had deemed necessary to the public welfare, might reasonably have required, as it did, that a private utility with such a probable motive should reimburse the public treasuries for expenses incurred in unjustifiable litigation prosecuted by the utility. It is no answer to these circumstances to assert that private utilities do not prosecute actions of this character more frequently than others, inasmuch as the Legislature's determination that because of the motive involved the probabilities that they would prosecute more of such actions is binding upon this court where it has some reasonable basis for such determination. The section establishes as a prerequisite to the recovery of those expenses that the private utility be unsuccessful, thus indicating that its action was without legal foundation. It is not prevented from obtaining access to the courts; if its action is meritorious it need not bear the expenses of the defendant. This basis for classification particularly removes any doubt that it is proper, in including only private utilities and such of those as operate within the area embraced by the public agency. But it is obvious that it also applies to the claimed discrimination between different kinds of litigation between plaintiff and the defendant in the actions contemplated by the section, and between actions enjoining the issuance and sale of bonds and *695 other actions inasmuch as the issuance and sale of such bonds is usually a fundamental initial step in the acquisition and operation of utilities by a public agency. In connection with the allowance of attorney's fees to the public agency if the private utility is unsuccessful, but not to the latter if it is successful, the statement in Missouri, Kansas and Texas Ry. v. Cade, 233 U.S. 642, 650 [34 S. Ct. 678, 58 L.Ed. 1135], is pertinent:
 "If the classification is otherwise reasonable, the mere fact that attorney's fees are allowed to successful plaintiffs only, and not to successful defendants, does not render the statute repugnant to the 'equal protection' clause. This is not a discrimination between different citizens or classes of citizens, since members of any and every class may either sue or be sued. Actor and reus differ in their respective attitudes towards a litigation; the former has the burden of seeking the proper jurisdiction and bringing the proper parties before it, as well as the burden of proof upon the main issues; and these differences may be made the basis of distinctive treatment respecting the allowance of an attorney's fee as a part of the costs."
 It is of interest to observe that the courts have practically uniformly held constitutional statutes requiring that insurance companies, under varying circumstances, pay attorney's fees in successful actions to recover from them claims they have refused to pay, although plaintiff need not pay their fees if unsuccessful, the necessity of bringing the action being vexatious. (Farmers' etc. Ins. Co. v. Dobney, 189 U.S. 301 [23 S. Ct. 565, 47 L.Ed. 821]; People of Sioux County v. National Surety Co., supra; cases collected 90 A.L.R. 530; 11 id 884.) Defendant urges that those cases are distinguishable on the ground that the theory upon which they are based is that the statute providing for attorney's fees becomes part of the insurance contract, while no contract is involved in the instant case. They also may be predicated on the proposition that insurance companies are inclined to litigate claims without having a meritorious defense. As we have pointed out hereinabove, we cannot say that the Legislature was not justified in concluding that private utilities, under the conditions and circumstances specified in section 526b, and in light of the motive generated by the threat of competition, would be inclined to prosecute unmeritorious litigation by means of the particular actions contemplated by *696 that section. Even if those cases do proceed on a contractual theory, that is, that when the company writes the policy it assumes the obligation imposed by the statute, that is no basis for a distinction, because, if the law was invalid as violating the equal privileges and protection clauses, it would be none the less invalid by requiring in effect that insurance policies and no other contracts should provide for attorney's fees. They could not be compelled to embody in their policy a provision for attorney's fees if the requirement was discriminatory.
 Defendant relies particularly upon the case of Black v. Hilliker, 130 Cal. 190 [62 P. 481], as announcing that it is against public policy that an unsuccessful plaintiff shall be mulct in damages by reason of his failure to obtain judgment. But here the Legislature has declared the policy under the specified circumstances that attorney's fees be allowed and under that policy the plaintiff is not being "mulct" in damages. Builders' Supply Depot v. O'Connor, 150 Cal. 265 [88 P. 982, 119 Am.St.Rep. 193, 11 Ann. Cas. 712, 17 L.R.A. (N. S.) 909], and Gulf, Colorado and Santa Fe Ry. Co. v. Ellis, 165 U.S. 150 [17 S. Ct. 255, 41 L.Ed. 666], invalidating statutes allowing attorney's fees to certain creditors or against certain debtors, are cited by defendant. But suffice it to say that no basis for a proper classification existed in those cases as does in the case at bar. It was said in Engebretson v. Gay, 158 Cal. 30, 32 [109 P. 880, Ann. Cas. 1912A, 690, 28 L.R.A. (N. S.) 1062] concerning the Builders' Supply case:
 "There is, however, nothing in the opinion in Gulf etc. Ry. Co. v. Ellis, 165 U.S. 150 [17 S.Ct. 255 (41 L.Ed. 666)], or in our own Builders' Supply Depot v. O'Connor, 150 Cal. 265 [119 Am.St.Rep. 193 (11 Ann. Cas. 712, 17 L.R.A. (N. S.) 909), 88 P. 982], to suggest that attorneys' fees may not be allowed a successful plaintiff in certain classes of cases, even though no such allowance be made to the defendant in the event that he prevails. The right to classify in this respect, as long as the classification is 'based upon some difference bearing a reasonable and just relation to the act in respect to which the classification is attempted' was conceded by the opinion in Gulf etc. Ry. Co. v. Ellis, 165 U.S. 150 [17 S.Ct. 255 (41 L.Ed. 666)] (see Atchison etc. R. R. Co. v. Matthews, 174 U.S. 96 [19 S.Ct. 609 (43 L.Ed. 909)]), and is recognized by all the authorities." *697
 No useful purpose may be served by an analysis of all the cases relied upon by defendant. Cases considering the particular constitutional guarantees here in question must each be determined upon its particular circumstances.
 The judgment is affirmed.
 Gibson, C.J., Shenk, J., Curtis, J., Edmonds, J., Traynor, J., and Ward, J. pro tem., concurred.
