
146 Cal.App.3d 42 (1983)
193 Cal. Rptr. 842
PAUL DANIELS et al., Plaintiffs and Appellants,
v.
HAROLD McKINNEY, as Sheriff, etc., Defendant and Respondent. LYNN POLAND, Plaintiff and Appellant,
v.
HAROLD McKINNEY, as Sheriff, etc., Defendant and Respondent.
Docket No. 6635.
Court of Appeals of California, Fifth District.
August 15, 1983.
*46 COUNSEL
Catherine Fancher Campbell and Michael R. Snedeker for Plaintiffs and Appellants.
Floyd R. Viau, County Counsel, and J. Wesley Merritt, Senior Deputy County Counsel, for Defendant and Respondent.
OPINION
FRANSON, Acting P.J. 

THE CASE AND THE FACTS
The superior court combined for hearing an action (Poland v. McKinney) in which plaintiffs (hereinafter petitioners), female inmates of the Fresno County jail, sought to hold the Fresno County Sheriff in contempt of court for failing to comply with an order issued over two years before commanding the sheriff to provide, among other things, a minimum of three hours of exercise per week to incarcerated female inmates and an original mandamus action (Daniels v. McKinney) in which male inmates sought similar exercise privileges.
At the hearing, all petitioners were represented by Catherine Campbell and Michael Snedeker, private attorneys. At the beginning of the hearing, the attorneys declined on behalf of their clients an offer by the court to *47 appoint the Fresno County Public Defender to represent petitioners pursuant to Government Code section 27706, subdivision (g).[1]
By a settled statement in lieu of a reporter's transcript the parties have stipulated that the following evidence was presented at the hearing:
(1) Many of the inmates of the Fresno County jail received no physical exercise whatsoever in either the jail gymnasium or other exercise facilities during their period of incarceration;
(2) The remaining inmates who did receive exercise, received less than three hours of exercise per week;
(3) The exercise privileges of some of the inmates of the jail had been restricted or denied to an extent which detrimentally affected their health and well-being;
(4) The Sheriff of Fresno County was able at all times considered to provide both indoor and outdoor exercise to the inmates in the county jail;
(5) The denial of exercise in the circumstances of the cases presented was not rationally related to legitimate institutional purposes;
(6) The sheriff did not provide exercise to all inmates because of jail overcrowding and the administrative segregation of assaultive inmates. (The contention apparently being that a lack of funds to hire adequate personnel to provide the required exercise excused compliance with the order.)
At the suggestion of the trial court, the sheriff proposed an exercise plan for male and female inmates confined in the county jail.
On the basis of the aforesaid evidence and the plan proposed by the sheriff, the trial court issued a memorandum of decision which contained an exercise plan for all jail inmates.[2] In making its decision, the court ruled that shortages of personnel or other resources by the sheriff did not justify *48 a failure to provide inmates with an opportunity for exercise, citing Spain v. Procunier (9th Cir.1979) 600 F.2d 189, 190. Nevertheless, because the sheriff had made a good faith effort to comply with the previous order in Poland v. McKinney relating to female inmates and had demonstrated a continued willingness to comply, he (the sheriff) was not in wilful contempt.
During the hearing, petitioners' counsel made an oral motion for attorneys' fees pursuant to Code of Civil Procedure section 1021.5.[3] In support of the motion, petitioners presented the testimony of the Fresno County Public Defender and the acting director of the public defender's office that the public defender considered representation of jail inmates regarding conditions of their jail confinement a discretionary duty, and the public defender could decline such an appointment. The public defender explained that if all such representation were undertaken by his office, he would be compelled to hire additional personnel. He further testified that the public defender's office had never represented more than one inmate in a suit (at any one time) seeking to alleviate jail conditions, and his office had not been requested to represent petitioners in the present litigation.
In other proceedings initiated by the sheriff to modify prior court orders pertaining to the issuance of toothbrushes, toothpaste and combs to inmates, the public defender had accepted the representation.
The trial court denied petitioners' attorneys' request for fees on the grounds that (1) petitioners had not prevailed in the contempt proceedings, (2) the benefits conferred by the proceedings were with respect to a small number of inmates, and (3) private enforcement of the petitioners' rights was unnecessary since the public defender could have represented the petitioners.
Petitioners' attorneys filed a motion for reconsideration of their request for attorneys' fees. Attached to the motion were declarations by jail inmates averring they did not trust the public defender's office; they preferred to be represented by an attorney affiliated with "Inside/Out" (a prisoners' rights organization petitioners' attorneys were affiliated with). Also attached were *49 documentation of the 79 1/2 hours spent by petitioners' attorneys in preparing for and appearing in the subject proceedings, a declaration by a local attorney establishing the median rate for lawyer services in Fresno County and a declaration by an American Civil Liberties Union staff attorney attesting to the expertise of petitioners' attorney Snedeker and describing prisoners' rights litigation in which the declarant had been awarded attorneys' fees. Other declarations were filed attesting to the qualifications of Attorney Campbell in prosecuting and achieving compliance by the sheriff with the constitutional rights of incarcerated prisoners over the preceding six years.
The trial court again denied an award of fees on the ground that enforcement of the petitioners' rights was not "necessarily private" since the public defender had been available to represent the petitioners.

DISCUSSION
(1) Except as provided by statute, the measure and mode of compensation of attorneys for their legal services in California generally is left to the agreement of the parties (Code Civ. Proc., § 1021). Equitable exceptions to this rule have been fashioned by the courts, one of which is the "private attorney general" doctrine. (Serrano v. Priest (1977) 20 Cal.3d 25 [141 Cal. Rptr. 315, 569 P.2d 1303].) The substance of this equitable doctrine is that a plaintiff's attorneys are entitled to reasonable attorneys fees where, as a result of their efforts, state constitutional rights of importance are protected to the benefit of a large number of people, and where, under the circumstances of the case, the necessity for private enforcement has placed upon the plaintiff a burden out of proportion to his individual stake in the matter. (Id., at pp. 47-48.) This doctrine was expanded and codified in Code of Civil Procedure section 1021.5, effective January 1, 1978. Under this statute, a plaintiff's attorney is entitled to fees from the opposing party in suits vindicating any important right, constitutional, statutory or otherwise, affecting the public interest.
(2) The fundamental objective of the private attorney general concept as codified in section 1021.5 is to encourage suits effectuating a strong public policy by awarding substantial attorneys' fees to those who successfully bring such suits and thereby bring about benefits to a large group of citizens. (Woodland Hills Residents Assn., Inc. v. City Council (1979) 23 Cal.3d 917, 933 [154 Cal. Rptr. 503, 593 P.2d 200]; Serrano v. Priest, supra, 20 Cal.3d 25, 43.) The doctrine rests on the recognition that privately initiated lawsuits are often essential to the effectuation of public policies embodied in constitutional or statutory provisions, and without some mechanism authorizing the award of attorneys' fees, private actions to enforce such important public policies will be impracticable. (Ibid.)
*50 (3) Attorneys' fees may properly be awarded under Code of Civil Procedure section 1021.5 where the vindication of jail inmates' rights to reasonable exercise periods and other conditions of detention also benefit other inmates similarly situated. (Inmates of Sybil Brand Inst. for Women v. County of Los Angeles (1982) 130 Cal. App.3d 89, 112-114 [181 Cal. Rptr. 99]; see also Jordan v. Multnomah County (9th Cir.1982) 694 F.2d 1156.) Respondents concede this point.
The pivotal question in the present case is whether the possible availability of the public defender to conduct jail conditions litigation on behalf of petitioners which arises from the discretion vested in the public defender under Government Code section 27706, subdivision (g), to represent any indigent pretrial detainee in such litigation, justifies the denial of attorneys' fees to petitioners. To answer this question, we must examine the requirements of section 1021.5. The statute requires petitioners show (1) that their lawsuits resulted in the enforcement of an important right affecting the public interest; (2) that they conferred a significant benefit on the general public or a large group of people; and (3) that the necessity and financial burden of private enforcement of the claims were such as to make a fee award appropriate.
(4) The maintenance of humane jail conditions has long been recognized as an important responsibility of the state and its political subdivisions. A reasonable minimum period of exercise each week is essential to the health and well-being of detainees. Exercise reduces tension within the jail, lessens disciplinary problems and promotes the safety of inmates and security officers. Thus, petitioners' lawsuit resulted in the enforcement of an important right affecting the public interest.
(5) Petitioners' lawsuits also conferred a significant benefit on a large class of persons. All pretrial detainees then and thereafter confined in the Fresno County jail and in other county jails throughout California are entitled to a minimum of three hours of exercise each week as a result of petitioners' lawsuit. The magnitude of the number of people benefited by the lawsuits is indicated by the fact that approximately 700 to 750 people are incarcerated in the Fresno County jail at any one time and close to 20,000 persons are incarcerated there for varying lengths of time each year.
(6a) The third requirement and one that is at the heart of the private attorney general doctrine is that an award of attorneys' fees under section 1021.5 only can be made if "the necessity and financial burden of private enforcement are such as to make the award appropriate." (§ 1021.5, subd. (b), italics added.) This requirement was the basis for the trial court's denial of petitioner's attorneys' request for fees. The judge reasoned there was no *51 need for "private enforcement" of petitioners' exercise rights because the public defender was available to represent petitioners as authorized by Government Code section 27706, subdivision (g). Since petitioners had not requested the public defender to represent them and since petitioners' attorneys' declined the court's offer to "appoint" the public defender (which by statute would have been discretionary with the public defender), the hiring of private counsel to represent petitioners was purportedly unnecessary.
The appellants were indigent; hence, the "financial burden" requirement would be met if the public defender could not or would not represent them. On the other hand, if the public defender did represent petitioners, there would be no financial burden on petitioners to justify an award of attorneys' fees under section 1021.5.[4]
(7) The trial court appears to have misunderstood the concept of "private" as contrasted with "public" enforcement of jail inmates' rights. Its ruling suggests that if the public defender had represented petitioners it would have constituted public enforcement of petitioners' rights by a public officer, similar to the public attorney general or other public officer representing an aggrieved party in the enforcement of his rights. (See McDermott & Rothschild, Foreword: The Private Attorney General Rule and Public Interest Litigation in California (1978) 66 Cal.L.Rev. 138, 149.) Thus, there was no need for private enforcement of petitioners' rights. It is quite apparent, however, that under the authority of Government Code section 27706, subdivision (g), the public defender is just as capable in the abstract as private counsel to represent jail detainees in the private enforcement of their rights. The public defender would not be a public officer representing the public interest but rather would be an attorney representing his client according to the same high standard of professional ethics required of an attorney in private practice. (People v. Mattson (1959) 51 Cal.2d 777, 793 [336 P.2d 937]; In re Hough (1944) 24 Cal.2d 522, 528-529 [150 P.2d 448].)
The test for determining the necessity of private enforcement of petitioners' rights is explained in Woodland Hills Residents Assn., Inc. v. City Council, supra, 23 Cal.3d 917. In that case, the plaintiffs, a citizens' association, prevailed in a mandamus action against the city, its planning commission and an advisory agency, challenging defendants' approval of a *52 subdivision map for a proposed subdivision located in the city. Plaintiffs obtained a ruling that the city agencies had erred in approving the subdivision without making specific findings that the proposed subdivision was in fact consistent with the city's general plan. The Supreme Court reversed the judgment denying attorneys' fees pursuant to section 1021.5 and remanded the case in light of the statutory criteria.
The court observed: "Inasmuch as the present action proceeded against the only governmental agencies that bear responsibility for the subdivision approval process, the necessity of private, as compared to public, enforcement becomes clear. [Citations.]" (23 Cal.3d at p. 941.) Thus, in deciding whether public or private enforcement of the plaintiff's rights is required, the Supreme Court did not focus on the status of counsel as private or public lawyers, but on the nature of the parties to the action, i.e., the persons initiating the action and the governmental agency or agencies that bear responsibility for the denial of the plaintiff's rights. Where the plaintiff must act on his own behalf because no governmental agency exists which is empowered to protect the plaintiff's rights or the appropriate agency has failed or refuses to act to protect his or her rights, private as contrasted with public enforcement is necessary. In the present case, enforcement of petitioners' rights to a reasonable exercise period each week required private action since the very governmental agency charged with petitioners' custody and required to protect their rights  the county acting through the sheriff  is the party against whom enforcement must be sought.[5]
Petitioners therefore have shown that private enforcement of their rights was necessary.
(6b) We turn now to the question whether the financial burden of private enforcement was such that plaintiffs had to hire private counsel. As we have explained, if the public defender would have accepted appointment petitioners would have been relieved of any financial burden in connection with the prosecution of their actions and their attorneys would not be entitled to compensation under Code of Civil Procedure section 1021.5.[6]
*53 We conclude the public defender would not have represented petitioners if he had been asked to do so. This being so, petitioners cannot be held to have waived the right to compensation for their private counsel by declining to accept the public defender as counsel.
The public defender testified in essence that his office could not embark on impact litigation involving jail conditions with his existing personnel; he was too busy handling criminal cases. The fact the public defender did represent certain inmates involving the issuance of toothbrushes, toothpaste and combs does not mean the public defender would have taken on this case. These actions were "heavy" litigation; for over two years the county sheriff had refused to comply with a court order requiring exercise rights. Only vigorous prosecution by attorneys who were experienced in jail conditions litigation and who were willing to spend the time required to fight the county at every turn of the road would be likely to succeed. Unlike toothbrushing and hair combing problems, the vindication of the right of each inmate to exercise for a minimum of three hours per week in a crowded county jail could not be handled by one or two perfunctory court appearances.
We note the commonly known fact that the Fresno County Public Defender as well as other metropolitan public defenders in California are so overwhelmed with the volume of criminal cases which they are required to defend under Government Code section 27706, subdivision (a), they would not voluntarily take on litigation of the present type. County budgetary limitations coupled with the increasing crime rate and greater responsibilities placed on defense counsel due to the increased complexity in the criminal law have resulted in public defenders being overworked and underpaid. They simply cannot handle complex civil litigation apart from their mandated duties in criminal cases.
There are other policy and ethical reasons why the public defender should not accept such representation. The public defender is in a delicate position vis-a-vis the defendant county. The problem is described in a recent issue of the Judge's Journal of the American Bar Association in an article entitled Empty Handed Justice. After explaining that public defenders are badly overworked, underpaid and faced with continuing drastic budget cuts, the author describes the inevitable loss of independence: "`[T]he [Chief] Defender ... is often particularly vulnerable to the same forces that operate generally to inhibit effective representation. The Defender is, in most programs, hired by the same body that controls the funding process and generally *54 also can be terminated at will. The salary of the Defender is often set by the same body. The combined effect on the Defender of having his continued employment as well as his salary determined by the same body that determines the program's operating budget might understandably inhibit vigorous demands for additional funding.'" (Wilson, Empty Handed Justice (1983) 22 Judges' J. [No. 1] 21, 53, quoting from Mounts, Public Defender Programs, Professional Responsibility, and Competent Representation (1982) Wis.L.Rev. 473, 504, fn. omitted.)
Thus, the public defender is almost in an adverse position insofar as representing jail inmates in suits against the county which if successful would impose additional costs on the county. At the same time, the public defender is dependent upon the county for the monies necessary to operate his office and pay the salaries of his deputies and other personnel.[7]
Lastly, the trial court's offer to "appoint" the public defender in place of petitioners' private attorneys was not made until the first day of the hearing, after petitioners' private counsel had expended considerable time in research, preparation of pleadings and preparation for trial. Petitioners did not want the public defender substituted in as their counsel at this late stage but wished to continue with existing counsel. While a forced substitution at this time might not have violated petitioners' right to counsel (the Sixth Amend. does not give an indigent the right to counsel of his choice (Drumgo v. Superior Court (1973) 8 Cal.3d 930, 933-935 [106 Cal. Rptr. 631, 506 P.2d 1007, 66 A.L.R.3d 984])), we do believe the public defender, with professional respect for retained private counsel, would have declined the appointment at this stage of the proceedings.
(8a) Respondent contends that if fees are to be awarded to petitioners' attorneys, the fees should be allowed only for services rendered on those issues in which petitioners were successful. According to respondent, petitioners were not "successful" as to the rights of the female inmates because the sheriff was not held in contempt. To state the argument is to demonstrate its falsity.
*55 (9) "... the determination of success under section 1021.5 must depend upon more than mere appearance." (Folsom v. Butte County Assn. of Governments, supra, 32 Cal.3d at p. 685.) The trial court must realistically assess the litigation from a practical perspective in order to determine whether it vindicates an important right. (Ibid.; Woodland Hills Residents Assn., Inc. v. City Council, supra, 23 Cal.3d at p. 938.) The inquiry may go outside the merits of the precise underlying dispute and focus on the condition that the plaintiffs and their attorneys sought to change. (Folsom, supra, 32 Cal.3d at p. 685.) The critical fact is the impact of the action, not the manner of its resolution. (Ibid.)
The United States Supreme Court has spoken on this very question in deciding how attorneys' fees are to be awarded in civil rights cases under 42 United States Code section 1988. "We hold that the extent of a plaintiff's success is a crucial factor in determining the proper amount of an award of attorneys' fees under 42 U.S.C. Section 1988. Where the plaintiff has failed to prevail on a claim that is distinct in all respects from his successful claims, the hours spent on the unsuccessful claim should be excluded in considering the amount of a reasonable fee. Where the lawsuit consists of related claims, a plaintiff who has won substantial relief should not have his attorney's fee reduced simply because the district court did not adopt each contention raised. But where the plaintiff achieved only limited success, the district court should award only that amount of fees that is reasonable in relation to the results obtained. On remand the district court should determine the proper amount of the attorney's fee award in light of these standards." (Hensley v. Eckerhart (1983) 461 U.S. 424, 440 [76 L.Ed.2d 40, 54-55, 103 S.Ct. 1933], italics added.)[8]
(8b) Petitioners' attorneys filed two lawsuits, both related to the deprivation of exercise by inmates. They prevailed in both suits and are entitled to be compensated for the time spent in achieving the victory. The award should not be reduced simply because the trial court did not find the sheriff in contempt.
Petitioners' attorneys also are entitled to compensation for time spent in vindicating their claim for fees on appeal. (Serrano v. Unruh (1982) 32 Cal.3d 621, 636-639 [186 Cal. Rptr. 754, 652 P.2d 985].)
*56 The judgment is reversed. The matter is remanded to the trial court with directions to award reasonable attorneys' fees to petitioners' counsel as required by law.
Hanson (P.D.), J., and Woolpert, J., concurred.
NOTES
[1]  Government Code section 27706, subdivision (g), provides: "The public defender shall perform the following duties: ... [¶] (g) upon the order of the court or upon the request of the person involved, the public defender may represent any person who is not financially able to employ counsel in a proceeding of any nature relating to the nature or conditions of detention, of other restrictions prior to adjudication, of treatment, or of punishment resulting from criminal or juvenile proceedings." (Subd. (g) added by Stats. 1975, ch. 1125, § 2, p. 2743, operative July 1, 1976. Italics added.)
[2]  The trial court treated the original mandamus action as a petition for writ of habeas corpus in ordering that the specified exercise program be implemented without distinguishing between male and female inmates.
[3]  Code of Civil Procedure section 1021.5 provides as follows: "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. 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." (Added by Stats. 1977, ch. 1197, § 1, p. 3979, eff. July 1, 1978. Italics added.)
[4]  We are aware of the language in Serrano v. Priest, supra, that "the eligibility ... for the award of fees granted in this case is not affected under the `private attorney general' theory by the fact that plaintiffs are under no obligation to pay fees to their attorneys, or the further fact that plaintiffs' attorneys receive funding from charitable or public sources." (20 Cal.3d 25, 47-48.) Serrano did not involve indigent criminal jail detainees who are entitled to have the public defender represent them if the public defender elects to do so.
[5]  The trial court's belief that the public defender could have filed a "next friend" petition for habeas corpus on behalf of an inmate in isolation or under other exceptional circumstances as was done in In re Davis (1979) 25 Cal.3d 384 [158 Cal. Rptr. 384, 599 P.2d 690] (see also In re Harrell (1970) 2 Cal.3d 675, 689 [87 Cal. Rptr. 504, 470 P.2d 640]) is not germane since it does not alter the need for private enforcement of petitioners' right to exercise. The special habeas corpus procedure is simply another method of private enforcement of a pretrial detainees' rights.
[6]  It could be argued that if the public defender elects to represent pretrial detainees in actions concerning jail conditions, the public defender would be entitled to attorneys' fees from the defendant county the same as privately retained counsel, provided the other criteria of Code of Civil Procedure section 1021.5 are met. Such a holding would find support in the rationale expressed by the Supreme Court in Folsom v. Butte County Assn. of Governments (1982) 32 Cal.3d 668 [186 Cal. Rptr. 589, 652 P.2d 437] and Serrano v. Priest, supra, 20 Cal.3d 25 at page 47, footnote 21. This question, however, is not before us.
[7]  There is another pragmatic problem which might dampen the public defender's desire to vigorously prosecute the rights of jail detainees beyond that needed in the defense of their criminal cases. The public defender must cooperate with the sheriff and the jail personnel to achieve optimum communication with his criminal clients and the use of jail facilities for interview purposes. The public defender would hesitate to accept the arduous task of filing a lawsuit against the sheriff concerning jail conditions while at the same time representing inmates in the defense of their individual criminal cases.
[8]  Use of federal authorities in interpreting Code of Civil Procedure section 1021.5 was approved in Woodland Hills Residents Assn., Inc. v. City Council, supra, 23 Cal.3d at page 934. The continued validity of a federal precedent was recognized in Folsom v. Butte County Assn. of Governments, supra, 32 Cal.3d at pages 685-686.
