The defendant was sentenced by the District Court, at its October session, during the year 1839, to pay a fine and costs of prosecution, and to be committed until that sentence was performed. Having been committed, he remained in prison for thirty days and his note for the amount of the fine and costs was taken, payable to the county treasurer, and he was liberated by the sheriff. This action was commenced upon that note.
The first ground of defence presented is, that between these parties there was no consideration for the note.
The defendant by the judgment of the Court, became indebted to the amount of the fine and costs. By giving this note he obtained a discharge of that judgment. His detention in prison was only to enforce a payment of it, and he was liberated. Although the plaintiff had no particular interest in the recovery of the fine and costs, the benefit thus received by the defendant was a sufficient consideration. The second ground of defence is, that the consideration was illegal.
By the act of March 17, 1821, c. 83, § 2, the Justices of the judicial courts were authorized to liberate poor convicts imprisoned only for the non-payment of a fine and costs upon certain conditions prescribed by the statute, taking their notes for the amount of their fines and costs. By the act of February 2, 1822, c. 190, the sheriffs of the several counties were authorized to exercise the powers conferred by the former act upon the Justices of the judicial courts.
The sheriff of this county, according to the agreed statement, appears to have omitted to take a schedule of the defendant’s *257property, and to cause him to take and subscribe the oath required by the statute, previous to his liberation. The course pursued by him was illegal. But there does not appear to have been any agreement or understanding between him and the defendant, that he should act illegally or omit any part of his duty. The note was not given to induce him to act illegally. It does not appear, that either the sheriff or the defendant knew, that he did act illegally. The consideration of the note does not therefore appear to have arisen out of any unlawful or corrupt bargain or contract.
The sheriff in taking the note, acted as a public agent, and by violating his duty and the law, by acts of omission, he could not deprive the public of its just and legal rights. The plaintiff, and those whom he represents, are in no way connected with any unlawful acts, and are not therefore disenabled to claim the aid of the Court for the recovery of their debt.
The action is not founded upon an illegal contract; nor is the Court called upon to lend its aid to execute such a contract. When the contract and its consideration are lawful, the plaintiff may recover, although he may have violated the provisions of a statute in acquiring a title to the property, which is the subject of it. Marks v. Hapgood, 24 Maine, 407. So he may in like case, if he be guilty of a violation of a statute in the execution of such a contract. Branch Bank v. Crockerow, 5 Ala. 250. The defendant cannot be discharged from the payment of a legal demand by showing, that the sheriff violated a statute, by omitting to require him to do other additional acts, there being no corrupt agreement that they should be omitted. A default is to be entered.