
219 Cal.App.2d 838 (1963)
COUNTY OF LOS ANGELES, Plaintiff and Respondent,
v.
CITY OF LOS ANGELES, Defendant and Appellant.
Civ. No. 27083. 
California Court of Appeals. Second Dist., Div. Four.  
Sept. 6, 1963
 Roger Arnerbergh, City Attorney, Bourke Jones and Weldon L. Weber, Assistant City Attorneys, and Spencer L. Halverson, Deputy City Attorney, for Defendant and Appellant.
 Harold W. Kennedy, County Counsel, and Robert C. Lynch, Deputy County Counsel, for Plaintiff and Respondent.
 BURKE, P. J.
 Is the county or the city obligated to pay the cost of detention of prisoners committed to the Los Angeles County Jail by the Municipal Court for the Los Angeles Judicial District for violations of Los Angeles city ordinances? This is the question presented in this proceeding.
 The superior court rendered judgment for the county and against the city in the sum of $476,194.68 for reimbursement of the costs incurred by the county in the detention of prisoners so committed during the period from July 1, 1955, to March 31, 1962.
 [1a] In 1950, under the reorganization of the inferior court system by state constitutional amendment (art. VI,  1 and 2), municipal courts were molded into the state judicial *840 system and ceased to be a part of the municipal governments with which they had been affiliated. Following this reorganization, the Municipal Court for the Los Angeles Judicial District followed the policy of committing prisoners convicted of violations of city ordinances to the county jail. Such policy has been based upon the theory that the state law set forth in section 19 of the Penal Code is applicable, that section providing: "Except in cases where a different punishment is prescribed by any law of this State, every offense declared to be a misdemeanor is punishable by imprisonment in the county jail not exceeding six months, or by fine not exceeding five hundred dollars, or by both."
 [2a] The enforcement of this policy has been resisted consistently by the City of Los Angeles, which contended that its city jail is the proper place for such detention by reason of the specific provision of section 11.00(m) of the Los Angeles Municipal Code, City Ordinance No. 77000, which provides that violations of its provisions constitute a misdemeanor which "... unless provision is otherwise herein made, shall be punishable by a fine of not more than $500.00 or by imprisonment in the City jail for a period of not more than six months or by both such fine and imprisonment." (Italics added.)
 The county contends that the general law of the state is controlling and that it is mandatory that the municipal court commit such city ordinance violators to the county jail. The city takes the contrary view. Prior to and during the period embraced in this action the city lodged formal written objections with the Presiding Judge of the Municipal Court for the Los Angeles Judicial District and with the Sheriff of the County of Los Angeles for commitment of such violators to the county jail. The sheriff, as custodian of such prisoners upon commitment to his custody, has considered himself bound to follow the Penal Code provisions and the orders of commitment of the court. As a result, the city has been unable to make use of its own available jail facilities for detention of city ordinance offenders after conviction and sentence. The city has refused to reimburse the county for the costs entailed in the detention of such prisoners in the county jail and this action resulted.
 The trial court found the facts to be essentially as above stated and, in its conclusions of law, held, in part, as follows:
 "1. The commitment[s] of prisoners to the Los Angeles County Jail by the Municipal Court of the Los Angeles Judicial *841 District for violation of Penal Ordinances of the City of Los Angeles are valid commitments."
 "2. The Sheriff of Los Angeles County was required by law to receive and to maintain and care for in the Los Angeles County Jail at the expense of the plaintiff all persons committed to the Los Angeles County Jail by the Municipal Court of the Los Angeles Judicial District for violation of Penal Ordinances of the City of Los Angeles."
 "3. The plaintiff is entitled to reimbursement from the defendant for its actual cost of care and maintenance of prisoners committed to the Los Angeles County Jail by the Municipal Court of the Los Angeles Judicial District for violation of the Penal Ordinances of the City of Los Angeles from July 1, 1955, through March 31, 1962."
 "4. The applicable statute of limitations in this action is 3 years."
 Judgment was ordered and entered accordingly, and the city has appealed.
 The trial court, in pronouncing judgment, relied principally upon the authority of County of Sonoma v. City of Santa Rosa, 102 Cal. 426 [36 P. 810], and upon the application of section 36903 of the Government Code.
 In the Sonoma case the County of Sonoma brought action against the City of Santa Rosa to recover the cost of maintaining prisoners committed to the county jail for violations of the ordinances of the city. Judgment was granted in favor of the county for the costs of maintaining such prisoners. The court stated (pp. 430-431):
 "It is contended that if the charter does not authorize the commitment to the county jail of persons found guilty of the violation of city ordinances, such commitments are in excess of [the court's] jurisdiction, and void, and are not made by competent authority; that the plain duty of the sheriff, under such circumstances, is to refuse to receive the prisoner. But counsel are wrong in this construction. The commitments were illegal, but were nevertheless made by 'competent authority.' By competency is meant the legal power or capacity to take cognizance of a cause, as, for example, the competency of a judge or court to examine and decide."
 "* * *"
 "That the city recorder had jurisdiction to try and punish these persons is not disputed, and that constitutes 'competent authority.' That he erred did not affect the charter [character] of the tribunal. ..." *842
 Relying upon the Sonoma case, supra, the county contends that the commitments to the county jail by the municipal court of violators of penal ordinances of the City of Los Angeles were valid commitments made by competent authority and accordingly the county is entitled to reimbursement.
 It is clear from a reading of the Sonoma case that the court felt constrained to render judgment in favor of the county because of an implied contract found to exist between city and county justifying reimbursement.
 Unusual as it may seem, the City of Los Angeles also relies upon the Sonoma case, pointing to language at page 429, which reads as follows: "We think the provision in question requires persons found guilty of violating city ordinances to be committed to the city prison, and those found guilty of the violation of the criminal laws of the state, where imprisonment is ordered, to be committed to the county jail." The Sonoma case arose in 1894, long before the reorganization in California of the inferior courts and at a time when the recorder or city judge was a city official responsible to the taxpayers of the city. The court was a city court and the general laws governing the city provided that imprisonment for a violation of city ordinances shall be in the city prison or the county jail. The court reasoned that the judge, being a city official, in committing prisoners to the county jail impliedly requested maintenance of the county for such prisoners and accordingly an implied contract resulted for reimbursement for their care.
 Contrary to the trial court's views, the Sonoma case is not controlling in the instant case because its rulings are based upon facts diametrically opposed to those in the instant case. Schematically, this is shown in the following manner:
 Tabular Material Omitted
 *843 rendered on the basis of an implied contract but on the authority of a statute (Gov. Code,  36903), and the service was not "requested" but specifically resisted.
 The trial court in the instant case remarked, in pronouncing judgment: "It is my opinion that 36903 of the Government Code is controlling. ... I think here we have a situation where the statute expressly provides for reimbursement by the City to the County. I do not feel that 29602 is applicable here." The two Government Code sections read as follows:
 " 36903. Imprisonment for violation of an ordinance shall be in the city jail, unless by ordinance the legislative body prescribes imprisonment in the county jail. If city prisoners are imprisoned in the county jail the expense is a charge against the city."
 " 29602. The expenses necessarily incurred in the support of persons charged with or convicted of crime and committed to the county jail, and for other services in relation to criminal proceedings for which no specific compensation is prescribed by law are county charges."
 [3] The trial court considered the last sentence of section 36903 to be controlling and to justify the charge against the city for the care of the prisoners by the county. However, this interpretation ignores the first sentence which directs that such city ordinance violators be incarcerated in the city jail unless the city by ordinance prescribes for imprisonment in the county jail. It is conceded that no such ordinance was ever enacted. In fact, the contrary course was taken by the city which prescribed by ordinance that imprisonment be in the city jail. Accordingly, read in its entirety, the section supports the city's contention that the city jail was the proper place for incarceration of city ordinance violators.
 [1b] Unlike Sonoma, no act by any officer of the city or its legislative body took place from which a contract may be implied. Paradoxically, the county successfully resisted a similar claim for detention costs of the City of Pasadena brought on the theory of implied contract in City of Pasadena v. County of Los Angeles, 118 Cal.App.2d 497 [258 P.2d 28]. *844
 [2b, 4] But there is a more compelling reason for disregarding section 36903 of the Government Code. The City of Los Angeles is governed by its own freeholders' charter adopted pursuant to the state Constitution (art. XI,  8). As such it enjoys freedom from state legislative control with respect to its municipal affairs. When in conflict with general laws, and relating to municipal affairs, the provisions of its charter and ordinances adopted pursuant thereto must prevail. (Cole v. City of Los Angeles, 180 Cal. 617 [182 P. 436]; Fletcher v. Porter, 203 Cal.App.2d 313 [21 Cal.Rptr. 452].) It is only with respect to state affairs, as distinguished from municipal affairs, that the general laws of the state take precedence over local ordinances. (Eastlick v. City of Los Angeles, 29 Cal.2d 661 [177 P.2d 558, 170 A.L.R. 225]; City of Pasadena v. Charleville, 215 Cal. 384. [10 P.2d 745].)
 [5] Section 19 of the Penal Code is also inapplicable to this case. That section, like Government Code section 36903, is a general law which provides for a penalty for misdemeanors where no different punishment is prescribed by "any law of this state." It has no application to a validly enacted city ordinance which prescribes its own measure of punishment for violation of its provisions. So long as such penalty does not exceed any maximum limits prescribed by its charter, as a freeholders' charter, or section 36901 of the Government Code as to other cities which are governed by the general laws, then the penalty provided in the ordinance prevails. Furthermore, a municipal ordinance is a "law of this state." (Ex parte Bagshaw, 152 Cal. 701, 703 [93 P. 864]; Ex parte Sweetman, 5 Cal.App. 577 [90 P. 1069].) In In re Isch, 174 Cal. 180, 184 [162 P. 1026], the court stated: "We are satisfied that section 19 of the Penal Code is not applicable in the matter of city, town, and county ordinances. We are further satisfied that if it could be held applicable, it could not reasonably be construed as a limitation on the power of local bodies in the matter of prescribing penalties, but simply as a law prescribing the penalty where a different punishment is not prescribed by the local body. There is no decision in conflict with our views. ..."
 [1c] Any contentions that the county is entitled to reimbursement on principles of implied contract (City of Pasadena v. County of Los Angeles, supra, 118 Cal.App.2d 497), unjust enrichment, or quantum meruit must be rejected under the facts here presented. (Nash v. City of Los Angeles, 78 Cal.App. 516 [248 P. 689]; Shaw v. City & County of San Francisco, 13 Cal.App. 547 [110 P. 149].) *845
 [2c] Section 29602 of the Government Code, which provides that expenses incurred with respect to persons committed to the county jail for which no specific compensation is prescribed by law are county charges, is applicable to the situation presented here.
 The judgment is reversed.
 Jefferson, J., and Kingsley, J., concurred.
