delivered the opinion op the court.
The judge of the Warren County Court issued a warrant of arrest against Charles J. Von Arnold for illegally causing the arrest and imprisonment of J. F. Garrett in the jail of Warren county, Kentucky. Said Arnold was arrested and lodged in the jail of .Jefferson county under said warrant, and upon the appellant becoming his bail for his appearance before the county judge of Warren county, he was released from jail. Before said bond was returned to the *590Warren County Court, the appellant, upon a certified copy of the bond, and intending to surrender said Arnold, caused him to be arrested and put in the jail of Jefferson county. He was taken from said jail on a- writ of habeas corpus, issued by Judge Toney, of the Louisville Law and Equity Court, and, upon the trial of the same by said judge, he was “released and discharged.” Said Arnold failing to appear before the county judge, and the bond having been sent to the circuit court with the proper indorsement, and appellant having been summoned to appear before that court to show cause why judgment should not be rendered against him on the bond, he relied on the release and discharge of Arnold by Judge Toney as releasing his obligation on the bond. The circuit court having decided against him, he has appealed.
It is held in the case of Commonwealth v. Bronson, 14 B. M., 361, that in legal contemplation a prisoner, notwithstanding he is bailed, remains in the custody of his surety, and he has the right to surrender his principal at any time to be released of the custody of him and responsibility as his surety on the bond; that the surety did not legally surrender his principal to the jailer; consequently the jailer held the principal as the agent of the surety, which was illegal; that the principal, being thus illegally restrained of his liberty, his remedy was by writ of habeas corpus; that the justice who tried this writ had jurisdiction to try it, and he having tried it and discharged the principal, when he ought to have required him to give a new bail bond for his appear*591anee, released surety from responsibility on the bond, Here the surety surrendered his principal to the jailer of Jefferson county instead of to the jailer of Warren county, to whom he ought to have been surrendered; consequently, the surrender was not legal, and the jailer had the custody of the principal as the agent of the surety, and not in the discharge of a legal duty. But it .was not the custody that the surety and his principal had agreed on, hence, illegal; and the principal’s only remedy was by writ of habeas corpus to remove this illegal custody, which had the effect to take him out of the illegal custody, and out of any friendly custody also, and to place him again in the custody of the law ; not merely to release him from the illegal restraint, and remand him to the friendly custody of his surety, but to be dealt with as though no bond had been given, which was, in this case, according to the papers before the judge, to require him to give new bail for his appearance before the Warren County Court for trial, or, in default of which, to order him taken to said county for trial. But the judge’s failure to do this, while illegal, did not render his action void, because his action had the effect of the judgment of a court of competent jurisdiction ; hence, it was merely erroneous. This erroneous judgment, as the case supra decides, and as we think correctly, had the effect to release the surety from his obligation on the bond. The question, in a case like this, as to the liability of the surety on his bond, is not whether he should be held on his bond because he has not proceeded legally to get released, but the question is, was the principal taken out of the cus*592tody ol the surety and again put in the custody of • the law by competent authority? If he was, the surety is released of his obligation.
The judgment is reversed, and cause remanded.