
141 Cal.App.3d 693 (1983)
190 Cal. Rptr. 490
H. JESSE ARNELLE, Plaintiff and Appellant,
v.
CITY AND COUNTY OF SAN FRANCISCO, Defendant and Respondent.
Docket No. 50622.
Court of Appeals of California, First District, Division Two.
April 6, 1983.
*694 COUNSEL
Ralph C. Alldredge for Plaintiff and Appellant.
*695 Jeff Brown, Public Defender, and Ephraim Margolin as Amici Curiae on behalf of Plaintiff and Appellant.
George Agnost, City Attorney, Philip J. Moscone and Paula Jesson, Deputy City Attorneys, for Defendant and Respondent.
OPINION
MILLER, J.
Appellant H. Jesse Arnelle appeals from a judgment of dismissal entered after respondent's demurrer to appellant's first amended complaint was sustained without leave to amend.
Appellant was appointed pursuant to Penal Code section 987, subdivision (b),[1] to represent an indigent defendant charged with the murder of a police officer. No compensation for appellant was agreed upon in advance, and after the trial appellant submitted a petition for an order compensating him pursuant to section 987.2, subdivision (a). Appellant declared that he had spent over 200 hours in court and over 1,300 hours in trial preparation and other out-of-court activities, to which he attached a reasonable value of $39,732.10. The trial judge found that $12,362.16 was a reasonable amount for the compensation due appellant. That smaller amount was paid to appellant.
Appellant then filed a complaint for the remainder ($27,369.94), alleging three causes of action: quantum meruit, breach of oral contract and breach of implied contract. The court, finding that appellant's complaint failed to state facts sufficient to state a cause of action, sustained respondent's demurrer but granted appellant leave to amend his complaint.
Plaintiff's first amended complaint pleaded the same causes of action as the original complaint and added a fourth cause of action for a taking without just compensation. Respondent demurred to the first amended complaint, which demurrer was sustained without leave to amend, and a judgment of dismissal was entered.
On appeal from the judgment of dismissal appellant contends that: 1) his complaint states legitimate causes of action and is the appropriate vehicle for *696 enforcing his contractual rights; 2) section 987 et seq. do not bar a suit based in contract to recover compensation which appellant claims is due him; 3) if section 987 et seq. are construed to bar appellant a cause of action to enforce his contractual rights, then they are unconstitutional; and 4) even if the demurrer to appellant's first amended complaint were properly sustained, denial of leave to amend was an abuse of the court's discretion.
Amicus curiae briefs in support of appellant were filed by California Attorneys for Criminal Justice and Northern California Criminal Trial Lawyers Association, and by the San Francisco Public Defender.
(1a) We are thus presented with, essentially, a single question: when counsel appointed by the court to represent an indigent defendant is dissatisfied with the compensation ordered him by the court, is an action at law ever the proper avenue by which he should seek review of the court's determination? This appears to us to be a question of first impression.
(2) In the absence of statutory authorization, it has long been settled in this state that an attorney is not entitled to compensation for services rendered in acting in the defense of indigent criminal defendants. (Payne v. Superior Court (1976) 17 Cal.3d 908, 920, fn. 6 [132 Cal. Rptr. 405, 553 P.2d 565]; Hill v. Superior Court (1956) 46 Cal.2d 169, 172 [293 P.2d 10]; 64 Ops. Cal.Atty.Gen. 257, 258 (1981).) Absent statutory authorization, an appointed attorney must serve gratuitously in accordance with his "duty ... [n]ever to reject, for any consideration personal to himself, the cause of the defenseless or the oppressed," and the courts lack the power to order the expenditure of public funds for such compensation. (Bus. & Prof. Code, § 6068, subd. (h); Jara v. Municipal Court (1978) 21 Cal.3d 181, 184 [145 Cal. Rptr. 857, 578 P.2d 94].)
A criminal defendant unable to employ counsel is entitled to have counsel assigned to defend him. (§§ 859, 987, subd. (b).) "In any case in which a person ... desires but is unable to employ counsel and in which counsel is assigned ..., such counsel ... shall receive a reasonable sum for compensation and for necessary expenses, the amount of which shall be determined by the court, to be paid out of the general fund of the county." (§ 987.2, subd. (a).) The court, in setting reasonable compensation, must consider six factors set forth in section 987.3.
(1b) The rights and duties involved in representing indigent criminal defendants do not arise from contract. The attorney's duty to assist the indigent is statutory. (Bus. & Prof. Code, § 6068, subd. (h).) The indigent's right to counsel is constitutional. (Gideon v. Wainwright (1963) 372 U.S. 335 [9 L.Ed.2d 799, 83 S.Ct. 792, 93 A.L.R.2d 733]; In re Williams (1969) 1 Cal.3d 168, 174 [81 Cal. Rptr. 784, 460 P.2d 984].) The county's duty to compensate the attorney and the attorney's right to be compensated are statutory. (§ 987.2, *697 subd. (a).) Thus the appointed attorney may not sue for compensation, based on contract or quasi-contract, unless such a cause of action is specifically created by statute.
That the arrangement in section 987.2, subdivision (a), is not to be considered a contract is made clear by the provision for a contract in subdivision (b): "[t]he sum provided for in subdivision (a) may be determined by contract between the court and one or more responsible attorneys after consultation with the board of supervisors...." (Italics added.) This subdivision clearly anticipates that the appointed attorney's compensation, either a flat fee or an hourly rate, will be established upon the attorney's appointment, before he has undertaken any performance under the contract. In such a case there would be a contract for the attorney to sue upon if he did not receive his agreed-upon compensation. Here, however, appellant and respondent did not contract.
(3) Appellant contends that denying him a contract cause of action to "enforce his contract" is unconstitutional. We disagree.
Appellant argues that the denial to him of a contract cause of action available to other attorneys who contract with a city or county denies him the equal protection of laws. This is incorrect, since appellant has no contract. He is not situated similarly to someone else who has contracted with a city or county.
Appellant contends that he is denied due process of law because the trial judge who determined his compensation is not impartial. He alleges that this is so because the judge is a "contracting agent" for the county, because the judge is a witness to the evidence underlying the factors to be considered pursuant to section 987.3 in determining the compensation, and because the trial judge might be biased against the attorney because of the attorney's efforts in representing his client.
These contentions are incorrect. They rest on the assumption that the fee-setting process is an adversarial proceeding in which the trial judge who will set the compensation is an opponent of the appointed attorney. This is not so. First, the judge is not a "purchasing agent" for the county. The courts are not "the guardians of the county coffers.... The Constitution and the statutes commit that responsibility, more appropriately, to the board of supervisors...." (Ingram v. Justice Court (1968) 69 Cal.2d 832, 842 [73 Cal. Rptr. 410, 447 P.2d 650, 36 A.L.R.3d 1391].) Second, the trial judge's role as witness to the lawyer's performance is not only not antithetical to a fair determination of reasonable compensation, it is inherent in the statutory system for making a fair determination, insofar as the following factors are to be considered by the court in setting the compensation: "(b) The time and labor required to be spent by the attorney. [¶] (c) The difficulty of the defense. [¶] (d) The novelty or uncertainty *698 of the law upon which the decision depended. [¶] (e) The degree of professional ability, skill, and experience called for and exercised in the performance of the services." (§ 987.3.) The trial judge is uniquely qualified to consider these factors by virtue of having presided at the trial. We cannot assume that either the trial judge's first-hand acquaintance with these factors or the theoretical existence of antagonism between attorney and judge growing out of the attorney's representation of his client automatically precludes the judge's being able fairly to determine the attorney's compensation.
Finally, appellant contends that a writ of mandate is inadequate. We disagree. First, the court could issue a writ with instructions to the trial court, and mandate would still be available if the trial court again abused its discretion. Second, if the petitioner were to present an adequate record with the petition for the writ, the court issuing the writ could itself determine the reasonable compensation and order the trial court to fix compensation in that amount. (Pedlow v. Superior Court (1980) 112 Cal. App.3d 368 [169 Cal. Rptr. 326] [attorney's petition for writ of mandate to compel payment of specific amount of compensation claimed by attorney was denied because of the absence of an adequate record, not because the Court of Appeal lacked the power to issue the sort of writ requested].) In either case the attorney would be afforded the same quality of review which he might obtain by means of a suit and an appeal therefrom.
The availability of a writ of mandate is not an inadequate remedy. An action at law to recover claimed compensation is not available to appellant, and it was not an abuse of discretion on the part of the trial court to deny appellant leave to further amend his complaint.
The judgment is affirmed.
Rouse, Acting P.J., and Smith, J., concurred.
Appellant's petition for a hearing by the Supreme Court was denied June 1, 1983. Grodin, J., did not participate therein. Bird, C.J., was of the opinion that the petition should be granted.
NOTES
[1]  Unless otherwise indicated all references are to the Penal Code.
