
62 Cal.2d 630 (1965)
BENJAMIN D. AVAN, Petitioner,
v.
THE MUNICIPAL COURT FOR THE LOS ANGELES JUDICIAL DISTRICT OF LOS ANGELES COUNTY, Respondent.
L.A. No. 28242. 
Supreme Court of California. In Bank.  
Apr. 28, 1965.
 Roger Arnebergh, City Attorney, Bourke Jones and Marcus E. Crahan, Jr., Assistant City Attorneys, for Petitioner.
 Harold W. Kennedy, County Counsel, George W. Wakefield, Chief Assistant County Counsel, and Edward H. Gaylord, Assistant County Counsel, for Respondent.
 McCOMB, J.
 Petitioner is an attorney at law and is the duly appointed Public Defender of the City of Los Angeles.
 He seeks a writ of mandate commanding respondent court to comply with the requirements of section 987a of the Penal Code by determining, and awarding to him, a reasonable sum for compensation and for necessary expenses due him on account of his representing in respondent court, as court-appointed counsel, a person charged therein with a misdemeanor offense and determined by the court to be unable to employ an attorney.
 This proceeding seeks an interpretation of section 987a of the Penal Code, which provides, in part: "In any case in which counsel is assigned in the superior court to defend a person, including a person who is a minor, who is charged therein with crime, or is assigned in a municipal or justice's court, or justice court as established pursuant to the Municipal and Justice Court Act of 1949, to represent such a person in such a court and who desires but who is unable to employ counsel, such counsel, in a county, or city and county, in which there is no public defender, or in a case in which the court finds that because of conflict of interest or other reasons the public defender has properly refused to represent the person accused, 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."
 [1a] Questions: First. Does section 987a of the Penal Code require the determination, award, and payment of reasonable compensation to counsel appointed by the court in misdemeanor cases to defend defendants who desire, but are financially unable to employ, counsel, wherever there is no county public defender with power to represent such persons?
 Yes. Respondent court concedes that the "public defender" referred to in section 987a of the Penal Code is the county public defender and that the Public Defender of Los Angeles County is not authorized to defend persons charged with misdemeanors in municipal or justice courts. (Gov. Code,  27705.1, 27706; L.A. County Charter,  23.) *632
 It is contended, however, that a government official cannot "refuse" to do something which he is prohibited by law from doing and that, in any event, a "refusal" presupposes a request or demand, and no showing is made that a request or demand was made on the county public defender to represent defendant. As a result, it is urged, the county is not liable, under section 987a of the Penal Code, for compensation and expenses of counsel appointed to represent defendant.
 If the county public defender had been requested to represent defendant in the proceedings in question, he would have been required to decline the representation, and by such action would clearly have "refused" to represent defendant.
 Under the circumstances, since a refusal would have been mandatory, no demand was necessary, and the county public defender may be deemed to have refused to represent defendant. (Cf. Phelan v. Superior Court, 35 Cal.2d 363, 372 [10] [217 P.2d 951]; Prichard v. Kimball, 190 Cal. 757, 765 [7] [214 P. 863]; Allan v. Guaranty Oil Co., 176 Cal. 421, 426 [168 P. 884].)
 [2] The purpose of section 987a of the Penal Code is to provide adequate representation for indigent persons charged with crime in superior, municipal, or justice courts by requiring that their court- appointed counsel be compensated at the expense of the county.  [fn. 1]
 In 43 Cal. Attorney General's Opinions 33, 36, it is stated: "... section 987(a) limits the right to compensation [to appointed counsel] to situations where there is no public defender in the county or where the public defender is incapacitated because of a 'conflict of interest or other reasons.' Thus, the section discourages an overlapping of the functions of appointed counsel and the public defender by denying compensation to the former when the latter is authorized and qualified to act. Conversely, the section provides for the compensation of appointed counsel in all other circumstances, thus insuring that every indigent accused of crime will have a right to representation by an attorney who is being paid for his efforts. This objective, while not overlooking that the bar has generously provided competent representation for indigent criminal defendants, is presumably designed to achieve even higher standards of such representation."
 [1b] Thus, the representation of such persons will be *633 either by the county public defender, at the county's expense, or, where for any reason no county public defender is available, by court- appointed counsel, again at county expense.
 Since defendant desired, but was financially unable to employ, counsel, respondent court was required to appoint counsel to represent him (Pen. Code,  987), but could not appoint the county public defender, since the latter is prohibited by law from representing a person charged in the municipal court with a misdemeanor offense.
 By the terms of section 987a, the counsel appointed became entitled, upon performance of his duties as such appointed counsel, to have the court determine, and award to him, a reasonable sum for compensation and for necessary expenses, to be paid out of the general fund of the county.
 [3] Second. Does the term "counsel," as used in section 987a of the Penal Code, include petitioner, a salaried city public defender?
 Yes. No differentiation is made in section 987a of the Penal Code between private and public counsel, and there is no question of double or dual compensation involved, since under the law any amounts paid petitioner would have to be deposited by him in the city's general fund. (L.A. City Charter,  68.)
 As indicated above, the county has the mandatory duty to pay a reasonable sum for compensation and necessary expenses of counsel appointed to represent indigent persons charged with crime. The fact that respondent court appointed a city employee to represent defendant is irrelevant and does not operate to relieve the county of its duty to pay a reasonable sum for such employee's services and expenses in representing defendant.
 The argument that payment of compensation to petitioner for his services and expenses in representing defendant would constitute a gift of county funds to the city, in violation of section 31 of article IV of the California Constitution,  [fn. 2] is specious. There would be no "gift." Payment would be for services rendered, and expenses incurred, for which the law makes the county expressly liable.
 Let a writ of mandate issue directing respondent court to comply with the requirements of section 987a of the Penal Code and to determine, and award to petitioner, a reasonable *634 sum for compensation and necessary expenses for petitioner's representation of the defendant in the case of People v. Joel L. Galloway, Los Angeles Municipal Court Criminal No. 213727.
 Traynor, C. J., Peters, J., Tobriner, J., Peek, J., and Burke, J., concurred.
NOTES
[fn. 1]  1. Section 987a of the Penal Code formerly applied only to proceedings in superior courts and preliminary examinations in municipal and justice courts, but it was amended in 1963 to cover any criminal proceedings in superior, municipal, or justice courts.
[fn. 2]  2. Section 31 of article IV of the California Constitution provides, in part: "The Legislature shall have no ... power to make any gift or authorize the making of any gift, of any public money or thing of value to any individual, municipal or other corporation whatever. ..."
