The opinion of the Court was delivered by
Gibson, C. J.
The habeas corpus is undoubtedly an immediate remedy for every illegal imprisonment. But no imprisonment is illegal where the process is a justification of the officer; and process, whether by writ or warrant, is legal wherever it is not defective in the frame of it, and has issued in the ordinary course of justice from a court or magistrate having jurisdiction of the subject matter, though there have been error or irregularity in the proceedings previous to the issuing of it. Mackalley’s Case, 9 Co. 68 a; 1 Hale’s P. C. 488. In Cable v. Cooper, 16 Johns. 155, it was accurately said by the judge who delivered the opinion of the court, that whether the judgment or execution be voidable, is a point which the sheriff is never permitted to raise; and that having arrested the party, he is bound to keep him till he is discharged by due course of law. To the same effect is Cameron v. Lightfoot, 2 Bl. Rep. 1190, and 2 Saund. 101 y, note 2, where the authorities are collected. If, then, the officer can not allege error in the process, how can the prisoner do so consistently with the common law principle, that the proceedings of a court of competent jurisdiction are not to be reversed or set aside by a collateral proceeding, where redress may be had by appeal, writ of error, or any other direct means of review l That this principle is applicable in all its force to the habeas corpus, is sustained by an abundance of authority. In Barnes’s Case, 2 Roll. Rep. 157, a return that the prisoner had been committed in execution by the court of admiralty to the warden of the cinque ports till he should restore an anchor carried away by him, or pay the warden forty pounds, was held sufficient, though the proceedings were irregular. So in Bethel’s Case, 1 Salk. 348, it was held that if a commitment in execution be wrong in form only, the defendant may be discharged on habeas corpus, but is to be put to his writ of error. S. C. 5 Mod. 19. And The King v. Elwell, 2 Stra. 79, is a still more signal instance. On motion to discharge the prisoner on exceptions to the commitment, which was a conviction of forcible entry and detainer, the king’s bench refused to enter into any consideration of them till the commitment were regularly before them; and the proceedings having been removed by certiorari into that court at a subsequent term, were first quashed, and the prisoner, who had been bailed in the mean time, was then discharged,(a) The same principle seems to *68have been recognized by our own court in Respublica v. Goaler, 2 Yeates 349, where it was determined that the supreme court can not discharge a party arrested on process from the common pleas; and in the Commonwealth v. Hambright, 4 Serg. & Rawle 149, we refused to consider objections to an arrest upon similar process, urged on the ground of privilege. It must be admitted that the reasons on which the court proceeded in these two cases are not very fully unfolded; but the decisions are entirely consistent with the rule as I have stated it, and I know of none else on which they can be sustained. They may, I presume, be considered as in point; for that the arrest was on mesne instead of final process, can scarce be thought a material difference. Hecker v. Jarrett, 3 Binn. 409, which is supposed to bear the other way, was distinctly decided on another ground; and though the power to discharge from an execution seems to have been recognized by the chief justice, there is no reason to think he had in view an execution merely voidable. Of the power to discharge from a void execution no one ever doubted; and his remark is in fairness applicable to no other. There are, I believe, few decisions on the point in our sister states. In New York it seems to be doubted whether their habeas corpus act extends to arrests on civil process; and their judges, have for that reason, as well as on general principles, refused to discharge in some instances on exceptions to its regularity; as in Cable v. Cooper already cited. But in the Bank of the United States v. Jenkins, 18 Johns. 308, though it was held that the habeas corpus act did not extend to the supreme court in term time, yet no doubt was entertained of the common law power of the court to relieve from all illegal imprisonments, whether in civil or in criminal cases.; and it was expressly determined that a habeas corpus is not the remedy for a defendant imprisoned on a capias ad satisfaciendum which has issued irregularly, the proper course being an application to the court from which it has issued. After this explicit recognition of the principle in a case exactly Like the one before us, it is scarce necessary to refer to Yates’s Case, 4 Johns. 318, in which it was determined that the supreme court of tliat state can not discharge from a commitment by tire chancellor for a contempt. Any other rule would present some very curious judicial phenomena. By an inversion of their functions, a single judge in vacation, and of perhaps an inferior court, would be legally competent to rejudge the judgments of the highest tribunal in the land; and tlie supreme court of the state, instead of proceeding systematically in the correction of errors, would be called upon to produce its results by a new and shorter process, while in the guise of writs of habeas corpus, it would be flooded with appeals from the decisions of the other courts on questions of bail. Tire rule is therefore absolutely necessary to prevent judicial proceedings from running into a state of incurable disorder; and an application of it to the relater’s case, is fatal to his *69claim to relief in this particular way. Every court is the proper tribunal to judge of the regularity or abuse of its process; and the remedy for the alleged irregularity here, is an application to the court from which the process issued.
The relater was remanded.
See also Ex parte Gill, 7 East 376, where, on a habeas corpus for an apprentice committed to the house of correction on a conviction by two magistrates, the court *68refused to consider circumstances laid before them by affidavit, which might have been made matter of defence before the magistrates.