The case comes before the court, primarily, on an application for a mandamus to compel the judge of the city court of Anniston, to enter an order dismissing a suit commenced in that court by A. D. Cheney against the First National Bank of Anniston, and to vacate an order which had been entered, overruling a motion for a dismissal. At the time of- the' commencement of the suit Cheney was-a non-resident of the State, and failed to give security for the costs of suit. If the neglect to give the security required the dismissal of the suit, mandamus is an appropriate remedy to compel it; though on appeal, after final'judgment against the defendant, the refusal to dismiss, if properly presented, would be error available to reverse the judgment. As a general rule, it is true, that mandamus will not be granted for the- correction of an error arising in the progress of a suit, which can be revised on-appeal after final judgment.—Exparte Elston, 25 Ala. 72. But the appeal must be an adequate remedy, it must be capable of protecting - parties from the injury immediately resulting from the error of the court. — Merrill on Man-*122damns; § 201. While the-error in refusing a dismissal for want of security for costs, may be available on error for the reversal,of a judgment, obviously, an appeal is not an adequate remedy. The citizen is compelled into litigation with a non-resident, pending the further continuance' of the suit and the appeal, without indemnity, against the cost, the evil the statute intends to avoid. Hence, it has-been the uniform course of decision, that mandamus is an appropriate remedy to compel the dismissal of such suit. Ex parte Cole, 28 Ala. 50; Ex parte Bobbins, 29 Ala. 71; Ex parte Morgan, 30 Ala. 51.
From the adoption of the Code of 1852, to the enactment, of the apt of February 17, 1885 (Pamph. Acts, 1884-85, p. 137), sections one and three of which formed sections 2858 and 2859 of the Code of 1886, and now form sections. 1347 and 1348 of the Code of 1896, the giving of security for costs by non-residents was a condition precedent to the commencement of suit, and if it was not then given, the mandate- of the statute was, that on. motion .the, suit must be dismissed and’the courts were without power to permit the security to be given a.t any subsequent time. But a defendant appearing and pleading,, .admitted himself rightly in court, and could not thereafter raise the objection that security for costs had nof been given at the commencement of suit. Ex parte Robbins, 29 Ala. 71; Heflin v. Rock Mills M. & L. Co., 58 ' Ala: 613.
The statute, prior to the Code of 1852, required nonresidents to give security for costs, but the failure to give it,at the. commencement of suit, was not cause of dismissal. It was -cause only for a requirement of security, which if not. given within a time prescribed by the court, resulted in a dismissal. The security could be given at any time before a dismissal of the suit, and the requirement of security could be made at any stage of the suit, not regarding what were the pleadings the defendant may have interposed. The statutes prior to the Code of 1852, and the decisions in construction and application of them will be found 1 Brick. Dig. pp. 422-24.. The present statute was intended to restore the practice prevailing under the statute prior to the Code of 1852, and to authorize a deposit of money in lieu of personal secur*123ity for costs, if such deposit. was elected. The whole matter rests largely in the sound judicial discretion of the court-, and the motion for security'may be made at any stage of the cause, before entering on the trial. — Ex parte Jones, 83 Ala. 587; Brown v. Bamberger, 110 Ala. 342. The defendant was not precluded from ' moving that the plaintiff be required to give security for the costs because of anything he may have done in defense of the suit; but he was not entitled to a dismissal because, of the failure of the plaintiff to give it at commencement of suit, and the court properly pverruled the motion. for a dismissal. All to which the defendant was entitled was an order requiring the plaintiff to give security within a time prescribed by the court. Not being entitled to a peremptory dismissal, the, application for mandamus must be denied;
.We have examined the ruling of the court touching tlie pleadings, assigned as error, and are of the opinion that the rulings are supported by the statute (Code of 1896, § 565), which authorizes the institution of this suit, pending the attachment suit; and by former decisions of this court, which are collected in, 1 Brick., Dig. 172, § § 273-75; 3 Brick; Dig. 60-61, § § 13 5, 138, 140, 142, 143, 145, 146, and in the annotations to the section of the Code referred to. On these assignments of error,’ the judgment must be affirmed.
Affirmed.