
252 Cal.App.2d 754 (1967)
CHARLES OLIVER BEAN et al., Plaintiffs and Appellants,
v.
COUNTY OF LOS ANGELES et al., Defendants and Respondents.
California Court of Appeals. 
July 24, 1967.
 Jacob Forst for Plaintiffs and Appellants.
 Harold W. Kennedy, County Counsel, and Martin E. Weekes, Deputy County Counsel, for Defendants and Respondents.
 FRAMPTON, J. pro tem.  [fn. *]
 Appeal from judgment of dismissal after sustaining of demurrer without leave to amend.
 The plaintiffs filed their first amended complaint, wherein it was alleged in substance that the plaintiff Charles Oliver Bean (hereinafter referred to as "Bean") is the principal party involved herein as to all matters; plaintiff National Automobile and Casualty Insurance Co., a corporation (hereinafter referred to as "National" or "Surety") is his surety; that the plaintiffs Frank Taylor and Claudia Taylor (hereinafter referred to as "Taylor") are the brokers for National; Bean at all times mentioned was insane and therefore incapable *756 of acting for himself; if the orders and judgments made and pronounced against Bean are void, then National and Taylor are not bound by them; prior to May 8, 1963, Bean was in the psychiatric unit of the Los Angeles County General Hospital; from May 8, 1963, to July 16, 1963, he was at the Compton Foundation Hospital, having been sent there from the Los Angeles County General Hospital; on or about December 18, 1964, "he was committed to a mental institution," [sic] (see Welf. & Inst. Code,  5050) and on December 21, 1964, he was adjudged to be a mentally ill person under proceedings brought pursuant to the provisions of the Welfare and Institutions Code.
 It was further alleged in substance that while Bean was insane, he was arrested and charged in two separate actions with violations of the Vehicle Code, both actions having been brought in the defendant Municipal Court of San Antonio Judicial District; Bean was released in both actions upon bail bonds furnished by National, through Taylor acting as its agent; such bonds were in the sums of $328 and $1,100, respectively; on August 26, 1964, Bean entered a plea of guilty in each such action, and he was ordered to appear in court on September 4, 1964, for the pronouncement of judgment and sentence; on September 4, 1964, Bean failed to appear, and the bond in each action was forfeited; neither National nor Taylor moved to set aside such forfeitures within 90 days or at any other time, as neither had knowledge of Bean's whereabouts or of his mental condition; National and Taylor paid the amounts of the bonds to the County of Los Angeles.
 It is further alleged in substance that Bean's insanity existed prior to May 8, 1963; that at the time of his arrest, his plea of guilty, his failure to appear for judgment and sentence, and as of the time of the forfeiture, Bean was insane; by reason of insanity, Bean could not enter a plea of guilty, nor could he be tried, adjudged, or punished; that by reason of the foregoing the plea, the adjudication of guilt, and the order forfeiting the bonds are void, and that all acts done pursuant to such proceedings are also void.
 It was further alleged in substance that some time after December 21, 1964 (the date upon which Bean was adjudged to be a mentally ill person), National and Taylor were informed of the adjudication.
 The pleading is barren of any explanation as to why National or Taylor was unable to ascertain the whereabouts of Bean between September 4, 1964, and December 21, 1964. The *757 pleading is also barren of any allegation that Bean was in the psychiatric department of the Los Angeles County General Hospital or the Compton Foundation Hospital as the result of a commitment arising out of a proceeding brought to ascertain his mental status. One hundred eight days elapsed from the time of the bail forfeiture until the time that Bean was adjudicated a mentally ill person. The defendants demurred to the amended complaint upon four grounds, the first ground being a general demurrer, that the complaint failed to state a cause of action. The remaining three grounds were framed under subdivisions 5, 2, and 4, respectively, of section 430 of the Code of Civil Procedure and were special demurrers in character. The court sustained the demurrer upon the first ground without leave to amend.  [fn. 1] A written judgment of dismissal followed. (Code Civ. Proc.,  581d.) The appeal is from the judgment of dismissal.
 The plaintiffs raise four questions upon this appeal. They are: "I Is Penal Code Section 1305 unconstitutional as to an insane person? II If the orders of arrest, plea, and judgment are void becuse of insanity, is not the order of forfeiture also void? III Does the superior court have jurisdiction where insanity is alleged as to a municipal court misdemeanor proceeding? IV Do sureties and bail bond brokers have a right to sue, on behalf of the principal, and for themselves also, if the principal is insane?"
 [1] A defendant in a criminal action is entitled to be released on bail as a matter of right  [fn. 2] except for a capital offense when the proof is evident or the presumption great (Cal. Const., art. I,  6) or where for the safety of the individual or for the protection of society it would be proper to deny bail. (See In re Westcott, 93 Cal.App. 575 [270 P. 247] (charged with murder, sanity in doubt, but no petition filed or adjudication of insanity had); In re Keddy, 105 Cal.App.2d 215 [233 P.2d 159] (convicted of misdemeanor, certified to *758 superior court for hearing on question of sexual psychopathy); In re Gentry, 206 Cal.App.2d 723 [24 Cal.Rptr. 208] (charged with first degree burglary, pleas of not guilty and not guilty by reason of insanity entered); Evans v. Municipal Court, 207 Cal.App.2d 633 [24 Cal.Rptr. 633] (arrested upon charge of driving while under the influence of intoxicating liquor, held without bail until sober, then released on bail); In re Henley, 18 Cal.App. 1 [121 P. 933] (arrested and detained upon warrant issued upon petition to ascertain addiction to intemperate use of stimulants).)
 There was a presumption that Bean was sane until he was adjudged to be a mentally ill person (Insane and Incompetent Persons, 27 Cal.Jur.2d 332,  10; People v. Chamberlain, 7 Cal.2d 257, 260 [60 P.2d 299].) He was entitled to be admitted to bail as a matter of right upon the misdemeanor charges. Assuming that the petition to declare Bean a mentally ill person was pending but undetermined at the same time that the misdemeanor proceedings were pending, Bean would have been entitled to bail as a matter of right under either or both such proceedings until he was adjudicated to be a mentally ill person and committed to a state hospital, unless it could be shown that his condition was such that for his safety or for the protection of society it would have been proper to deny bail. (See Pen. Code,  1370, 1371.)
 The obligations of bail are governed by the statutes specially applicable thereto. (Civ. Code,  2781.) The rights and liabilities of sureties on bail bonds differ in important respects from those of sureties on ordinary bonds or commercial contracts. The sureties on a bail bond can at any time discharge themselves from liability, while sureties on ordinary bonds and commercial contracts can only be released by payment of the debt or performance of the act stipulated. (Bail and Recognizance, 7 Cal.Jur.2d 585 and 586.) Upon the release of a person on bail he is in the custody of the sureties, and the consideration of the bond, accruing to the sureties, is his freedom from any other custody. [2] The responsibility of the sureties is based upon their custody of the principal (the person bailed), and their rights and powers under such custody. If they are at any time fearful that he may not appear, they can have him arrested and surrendered, or he may surrender himself, and in either event they are exonerated. (People v. McReynolds, 102 Cal. 308, 311 [36 P. 590]; Pen. Code,  1300; County of Los Angeles v. Maga, 97 Cal.App. 688, 690 [276 P. 352].) Performance of the undertaking may be rendered *759 impossible or excused by an act of God or of the obligee or of the law. (County of Los Angeles v. Maga, supra, p. 691.) However, it has been held that the insanity of the principal is not such an act of God as will exonerate the surety. (Commonwealth v. Allen, 157 Ky. 6 [162 S.W. 116]; Briggs v. Commonwealth, 185 Ky. 340 [214 S.W. 975, 8 A.L.R. 363]; People v. Fiannaca, 306 N.Y. 513 [119 N.E.2d 363, 366.) It is said that "[a]lthough insanity might be a defense to the criminal charge pending against the accused, it could not relieve him of the responsibility of appearing for trial nor his surety of the obligation to see that he appeared unless there were facts alleged, as a result of the insanity, showing it would be reasonably impossible to fulfill the obligation." (Ramer v. State (Okla.) 302 P.2d 139, 141.) Insofar as the record before us discloses, Bean was released to the custody of his surety some time prior to August 26, 1964, the date upon which he entered his plea of guilty to the misdemeanor charges, and that he remained in the custody of his surety until on or about December 18, 1964, when it is alleged that he was committed to a mental institution. [3] The bail forfeiture occurred on September 4, 1964, and no motion to set aside such forfeiture was made within the 90-day period prescribed by law or at any other time. There is no reason given why the surety did not surrender Bean during the 90-day period except, as alleged, that they did not know of his whereabouts. This presents no legal cause for setting aside the forfeiture.
 [4a] The Legislature has provided ample means for the determination of the sanity of a person charged with a public offense. (Pen. Code,  1026 et seq. and  1367 et seq.; Welf. and Inst. Code,  5000 et seq.; Baer v. Smith, 68 Cal.App.2d 716, 724 [157 P.2d 646].) If Bean was in fact insane, as is claimed, but was physically able to attend court, and had the surety surrendered him within the time required by law for the setting aside of the bail forfeiture, such forfeiture would have been set aside, and the question of his sanity would have been determined in accordance with the procedures provided therefor. The surety, having breached its obligation under the bond, may not now be heard to collaterally attack the proceedings in the trial court, based upon the alleged insanity of its principal.
 [5] It is said that since judgment against the bail is one taken by consent, the obligation assumed by the bail is absolute but for the defenses set forth in section 1305 of the Penal Code, and even these must be asserted within the 90-day *760 period before the court loses jurisdiction. If the motion is not timely made, for such relief, the consent judgment must be entered, from which there is no appeal, the 90-day period being a period of limitation for any permissible relief. (People v. Stuyvesant Ins. Co., 216 Cal.App.2d 380, 382 [31 Cal.Rptr. 208].) [4b] Although Bean may not have been mentally competent to conduct his defense, it is not shown that he was physically unable by reason of illness or insanity to appear in court at the time fixed for the pronouncement of judgment and sentence. Further, had Bean been physically unable to appear in court at the appointed time by reason of illness or insanity, it was mandatory upon the surety to bring this to the attention of the court within 90 days after the forfeiture was declared in order to be entitled to have the forfeiture set aside. (Pen. Code,  1305.)
 Section 1305 of the Penal Code does not violate any right guaranteed to the principal or the surety under either the state or the United States Constitution, when applied to the facts in the instant case. The order of forfeiture is a valid order. [6] The superior court has exclusive jurisdiction to hear and determine the question of the sanity of a person, even though such question may first arise in connection with a criminal charge pending in a municipal or other inferior court. [4c] The surety may not, in the present action and under the circumstances here shown, collaterally attack the proceedings in the municipal court upon the grounds of the insanity of its principal.
 The judgment is affirmed.
 Kaus, P. J., and Stephens, J., concurred.
NOTES
[fn. *]  *. Retired judge of the superior court sitting under assignment by the Chairman of the Judicial Council.
[fn. 1]  1. "Demurrer sustained on all the grounds stated therein, without leave to amend. Attorney order. Although the Court thinks that most of the grounds of the demurrer can be cured by amendment, there is one ground which cannot, and that is ground I, as set out on page 6 of the Points and Authorities. Under this Court's interpretation of Penal Code section 1305, the legislature contemplated this situation. The last sentence of that section provides for the case of inability to appear because of insanity, and limits the time for application under that section to 90 days. People v. Stuyvesant Ins Co., 216 CA 2d 380, 381 [31 Cal.Rptr. 208] would indicate to this Court that unless application is made within 90 days there is no relief."
[fn. 2]  2. Prior to conviction in case of felony.
