Robinson, J.
i. CBiMiNAi.ia^ ueu°orbaÍi: ihsiTff^íimitation or actions. The defendant Farrell was elected sheriff of Mills county for the term which. commenced January, 1884, and duly qualified for and entered upon the discharge of the duties of the office. His codefendants W0r0 gure(¿es on ^g official bond. The petition shows that in the month of February, 1884, Farrell had in his custody as sheriff one Charles Mull, who had been ordered by a magistrate to be held on a criminal charge to await the action of the grand jury of Mills county at the term of court which commenced in-March, 1884. Mull had been admitted to bail in the sum of two hundred and fifty dollars. No bond was given, but money to the amount named was paid to Farrell by one Dailey, to be held in lieu of a bond, and Mull was released. He was indicted by the grand jury of Mills county at the March, 1884, term of the district court, but failed to appear at that term, and has never appeared since. At the term at which he was indicted the district court declared his bond forfeited. No bond had been given. The money was paid to Farrell for the purpose of having him deposit it with the clerk of the district court, but he failed to make the deposit, and has never paid the money to the clerk or to the county of Mills. This action is brought for the benefit of the school fund, in the name of the state and of the county, to recover the money paid to Farrell. The petition in different counts charges Farrell with liability as an officer, and also in an unofficial capacity. The first count alleges that the money was received by Farrell, as sheriff, as security for the appearance of Mull at the term of court to which he was held to appear, and demands judgment therefor against him and his bondsmen. The second count alleges that *663Farrell received the money for the purpose of depositing it with the clerk; that he received it in trust for the plaintiffs, to be deposited as aforesaid; that when he received it he was an officer of the court; that it was his duty to pay the money into the treasury of Mills county for the benefit of the school fund, and that he has repeatedly promised to make such payment. An order is asked requiring him to deposit the money, with interest, in the hands of the clerk. Also to pay it to the treasurer of Mills county. Judgment for the amount is also demanded. The third count alleges that in February, 1884, Dailey deposited with Farrell the money in question, and that the latter then promised to pay it to the plaintiffs for the use of the school fund; that the money is not paid, and is now held by Farrell, for the use of the plaintiffs. The fourth count charges that Dailey deposited the money in question with Farrell, who agreed to deposit it with the clerk for the use and benefit of the plaintiffs; that the money was set apart and appropriated by Dailey for the use and benefit of the plaintiffs for the use of the school fund; that it was deposited with Farrell for the use' of the plaintiffs, whether it was deposited with the clerk or not; and that it now belongs to plaintiffs. The fifth count contains a repetition of much that is stated in the other counts, and, in addition, alleges that by virtue of the agreement between Farrell and Dailey the former was not to hold the money for the latter, nor was he to hold the same for his own use, but that it was set apart and appropriated for the use and benefit of the plaintiffs. The grounds of the demurrer are numerous, and need not be specially mentioned. It is enough to say that the demurrers sufficiently present the questions upon which the case must be decided.
Section 4589 of the Code provides that “the defendant, at any time after an order admitting him to bail, instead of giving bail, may deposit with the clerk *664of the district court to which the undertaking in case of bail is required to be sent the sum mentioned in the order, and, upon delivering to the officer, in whose custody he is, a certificate, under seal, from said clerk, of the deposit, he must be discharged from custody.” There is no provision of law permitting the payment of money to the sheriff, and the action of the defendant in receiving it was not. only unauthorized, but the release of the prisoner in consideration of its payment was a violation of the warrant of the commitment under which he was held. The sheriff could not have made a valid agreement to receive the money for the use and benefit of plaintiff in consideration of the' release of the prisoner. The one he made was void, and no rights accrued to the plaintiffs by virtue of it.
2, . . _ • But, if the agreement had been valid, plaintiffs could not have succeeded in this action unless upon the ground that the money was held in trust for their benefit, for the reason that as to the other grounds the action is barred by the statute of limitations. The cause of action accrued, as to such grounds, not later than March, 1884. This action was commenced in September, 1889. Section 2529 of the Code provides that actions against a sheriff, growing out of a liability incurred by the doing of an act in an official capacity, or by the omission of an official duty, including the non-payment of money collected on execution, shall be barred if not brought within three years from the time the cause of action accrued. If it be true that Farrell received the money as a private person, under an agreement to hold it for the benefit of and to pay it to the plaintiffs, the action therefor was barred when the five years from the time the cause of action accrued had elapsed. Code, sec. 2529, subd. 4. It is said that lapse of time does not bar an action brought on any contract for any part of the school fund. Code, secs. 1880, 2542. But the money in *665question never became a part of the school fund, and this is not an action on a contract for any part of it. It was never deposited with the clerk, and the order of the court adjudging the bond forfeited gave dhe plaintiffs no right to have it appropriated for their use. That would have been true had • the money been lawfully paid to the sheriff under the rule .announced in State v. Klingman, 14 Iowa, 408, where it was held that, when the bond for the appearance of the •defendant was not before the court, it could hot be •declared forfeited.
We conclude that the demurrers were properly •sustained. The judgment of the district court is, therefore, AFFIRMED.