It appears from the record presented to this court, that the relator was, by one Fuller, a justice of the peace of Montgomery county, convicted of an assault and battery, without the use of a stick or weapon, and sentenced to pay a fine of fifteen dollars, and the costs of prosecution, amounting to eight 25-100 dollars. Failing to pay or secure the fine and costs, the mittimus addressed to the sheriff, which is the only warrant or authority for the detention of the relator, returned in answer to the writ of habeas corpus, recites : “in default of the payment of said fine and cost, that he do hard labor for tbe county, for one hundred and sixteen days, the same being in payment of said fine at tbe rate of twenty cents per day.” The mandate of the mit-timus is, that the sheriff detain the relator, “ so that the sen*237tence of the court may be fully carried out,” The relator,averring that the sentence was illegal and void — an excess of the jurisdiction of the justice — -applied for a habeas corpus,* to be discharged from the custody of the sheriff. The City Court, on hearing the application, refused to discharge him; and he now in this court renews the application.
The statute, in obedience to a provision of the constitution, confers on justices of the peace jurisdiction of assaults, assaults and batteries, and affrays, in which no stick or other weapon is used, and some other minor misdemeanors. — lb C. § 8932. In default of payment, or security for the payment of the fine, when a conviction is had of an offense punishable by fine, all courts of criminal jurisdiction are vested with authority to sentence the prisoner to imprisonment in the county jail, or to hard labor for the county. If the fine does not exceed twenty dollars, the limit of the term of imprisonment, or of hard labor, is ten days on account of the fine. — B. C. § 3760. If the conviction is before the County, Circuit, or City Court, if .the costs are not paid, additional hard labor for the county, “ for a term sufficient to cover all costs and officers’ fees, allowing not exceeding forty cents per diem for the additional labor,” may be imposed. — B. C. | 4061. No authority is conferred on a justice of the peace to imprison, or to sentence to hard labor for the county, for the payment of costs. That authority, by the words of the statute, is limited to the County, City, or Circuit Court. It is apparent, therefore, that the sentence of the justice of the peace is in violation of law, and an excess of the authority and jurisdiction with which he was clothed. The limit of the term of hard labor, to which the relator could be sentenced, the fine not exceeding twenty dollars, was ten days. If the mittimus is to be construed as declaring that the term of hard labor was fixed on account of the fine only, the law was violated in the imposition of a longer term than ten days. Its proper construction, however, is, that the term of hard labor was imposed for fine and costs in the aggregate, a day’s labor being estimated at twenty cents. In the imposition of labor for the costs, as we have said, the justice exceeded his jurisdiction. The City, Circuit, or County Courts can, and a justice of the peace cannot, impose hard labor or imprisonment for the payment of costs. The statute authorizing the imposition of hard labor, as a mode of compelling the payment of costs of a criminal prosecution, is highly penal, confined in terms to particular courts, and cannot by construction be extended to other tribunals. The fine being less than twenty dollars, the term of hard labor is definitely prescribed by the statute at ten days. The court is without *238discretion — the term cannot be enlarged or diminished.
We repeat, the sentence of the justice is without authority, and in violation of law. The relator could have appealed from the judgment of conviction to the next ensuing term of the Circuit or City Court. On an appeal, the cause would have been triable de novo, without regard to the illegality of the sentence pronounced by the justice, or any error in the proceedings before him. — B. C. §§ 4029-30. No appeal having been taken, the material inquiry is, can the relator, on habeas corpus, be relieved from the execution of the illegal sentence which the justice has pronounced ? Habeas corpus is the immediate ana adequate remedy fox every illegal restraint of the liberty of the citizen. The justice of the peace had jurisdiction of the offense imputed to the prisoner, and could legally adjudge him guilty, declare the fine he should pay, and the term of hard labor, or of imprisonment, which the statute affixes to the fine. No error or irregularity which he may have committed in exercising this jurisdiction could be inquired into on habeas corpus. The proceedings of a court of competent jurisdiction cannot, on habeas corpus, be assailed for mere error or irregularity. An appeal, writ of error, or other revisory remedy, in a court of appellate jurisdiction, is the only mode of redressing, or obtaining relief from error or irregularity. Judgments or sentences may be not only erroneous, but void, and erroneous because void. When they are a usurpation or excess of jurisdiction, and the usurpation or excess is apparent on the face, not dependent on extrinsic facts or matter — when, if the sentence is expressed on the face of the warrant addressed to the officer who is to execute it, the warrant will afford no justification to the officer — when he becomes a trespasser, if he obeys it — the judgment or sentence, and the warrant for its execution, are void, and habeas corpus is a proper remedy for freedom from imprisonment which may be imposed under it. Such, in effect,- is the provision of the statute. All inquiry into the legality or justice of any order, judgment, decree, or process, of any court legally constituted,- or into the justice or propriety of any commitment for contempt, made by a court, officer, or body, according to law, and charged in such commitment, is forbidden on habeas corpus. N. C. § 4285. But, if it appears the applicant for the writ, or the person alleged to be falsely imprisoned, is in custody by virtue of process issuing from any court legally constituted, or issued by any officer in the course of judicial proceedings before him authorized by law, there are several cases in which the statute commands his discharge. The first of these is, where jurisdiction has been exceeded, as to *239either matter, place, sum, or person ; and tbe fifth is, where the process is not authorized bj any judgment, order, or decree, nor by any provision of the law. — B. C. § 4286.
The justice of the peace, in the sentence pronounced, exceeded his jurisdiction in the matter; and there is no provision of law, which warrants his judgment. The want of jurisdiction to pronounce the sentence, and the excess of the jurisdiction the law conferred, are apparent on the face of the proceedings, not dependent on extrinsic evidence, or any inquiry into the justice, legality, or propriety of the judgment of conviction. It is the illegality, not the irregularity of the sentence, which is assailed. If the sentence had been to imprisonment in the penitentiary, there would be no hesitation in pronouncing it void; and yet it would not have been a more palpable assumption of unauthorized power, though more grievous to the relator. When the justice passed beyond the term of ten days, as the term of hard labor for the county, he exceeded his jurisdiction. The sentence is consequently void, and the mittimus, expressing it as the cause of detention, is also void.
The judgment of the City Court is reversed, and a judgment discharging the relator from further imprisonment must be here entered.