
500 P.2d 176 (1972)
84 N.M. 91
Ernest P. MONTOYA, Petitioner-Appellee,
v.
Hon. Richard BLACKHURST et al., Respondents-Appellants.
No. 9453.
Supreme Court of New Mexico.
August 4, 1972.
David L. Norvell, Atty. Gen., Frank N. Chavez, Asst. Atty. Gen., Santa Fe, for appellants.
Peter C. Mallery, Charles T. DuMars, Albuquerque, for appellee.

OPINION
MONTOYA, Justice.
Petitioner-appellee Ernest P. Montoya, hereinafter referred to as "appellee," brought suit in the District Court of Bernalillo County asking for a writ of mandamus to order respondents-appellants Magistrates, hereinafter referred to as "appellants," to quash a writ of replevin issued in the Magistrate Court. The District Court issued an alternative writ of mandamus. Before a hearing was held on the alternative writ, appellee amended his petition for a writ of mandamus and asked, in the alternative, for a declaratory judgment that the replevin statute was unconstitutional. Appellee further asked for injunctive relief against appellants. After a hearing, the trial court ruled that the alternative writ be made permanent, declared replevin statutes §§ 36-13-1 through 36-13-6, N.M.S.A., 1953 Comp. (Repl.Vol. 6, 1971 Pocket Supp.), to be unconstitutional, and enjoined appellants from enforcing the replevin statutes.
Appellants' main contentions revolve around the use of mandamus by appellee as the proper remedy to test the constitutionalty of the replevin statutes. Apparently they do not attack the conclusion of the trial court, that the replevin statutes are unconstitutional as a taking of property without notice and an opportunity to be heard.
Appellants' first contention is that the trial court committed error in issuing the *177 writ of mandamus, because mandamus cannot be used to control judicial discretion. Second, appellants contend that the mandamus should not have been issued, because appellee had an adequate remedy at law. Finally, appellants argue that the trial court improperly joined the mandamus action with a complaint for declaratory relief.
Appellants correctly state that mandamus may not be used to control judicial discretion. Section 22-12-4, N.M.S.A., 1953 Comp. When the issue has been placed before the court, the decision as to the constitutionality of a statute is generally within the judicial discretion of the judge. However, this court has held that, in the proper case, mandamus may be used to question the constitutionality of a state statute. State ex rel. Chavez v. Evans, 79 N.M. 578, 446 P.2d 445 (1968); State ex rel. Shepard v. Mechem, 56 N.M. 762, 250 P.2d 897 (1952). Because of the peculiar nature of the replevin proceedings, mandamus was the proper remedy in the cause before us to test the constitutionality of the replevin statutes.
Under the replevin statutes, the plaintiff may replevy goods in possession of the defendant upon posting a bond and filing an affidavit. If the defendant in the replevin action posts a similar bond, he is entitled to keep the goods until such time as there is a hearing before the magistrate on the merits of the plaintiff's claim. Unless the defendant posts the requisite bond, the goods are delivered to plaintiff, assuming he has complied with the statutory requirements. Thus, the defendant may be deprived of the goods without notice and an opportunity to be heard, even though he may have a good defense to the replevin action, if he does not or cannot post the required bond. In order to test the constitutionality of the procedures of the replevin statute, a defendant must appear at the hearing and assert as a defense the unconstitutionality of the replevin statute. If he should lose, on appeal to the district court the issue of a taking without a prior hearing would clearly be moot, because he had his day in court at the magistrate level. If he should win on the merits at the magistrate level, there would be no appeal to test the taking of his property without notice and an opportunity to be heard. Therefore, in this case, mandamus was the proper remedy to test the constitutionality of the replevin statutes.
Appellants next contend that appellee had an adequate remedy at law and, therefore, mandamus did not lie in the instant case. It is true that mandamus will not lie where there exists a plain, speedy and adequate remedy at law. Section 22-12-5, N.M.S.A., 1953 Comp. Mandamus also will not lie where there is an adequate remedy by appeal. State ex rel. Sweeney v. Raynolds, 17 N.M. 282, 127 P. 23 (1912).
We believe that the appellee had no plain, speedy and adequate remedy at law or by appeal. Even though he was entitled to a hearing on the merits of the replevin action, in the absence of his posting bond he was deprived of possession of the goods until such time as the hearing on the merits could be held. If he had lost on the merits at the magistrate level, he could not, on appeal to the district court, argue that he was deprived of a hearing because he would have had a hearing at the magistrate level. The remedy on appeal would not have been adequate. We do not believe that appellee's remedy other than mandamus would have been plain, speedy or adequate.
The United States Supreme Court, in Fuentes v. Shevin, Attorney General of Florida, 407 U.S. 67, 92 S.Ct. 1983, 32 L.Ed.2d 556 (1972), held that the Florida replevin statute which permitted a private party, without a hearing or prior notice to the other party, to obtain a prejudgment writ of replevin was a violation of the Fourteenth Amendment's prohibition of taking property without due process of law. The Florida and Pennsylvania statutes, held to be in violation of the Constitution in Fuentes and a companion case, *178 are substantially similar to the New Mexico statute. We hold that, in conformity with the views of the Fuentes case, supra, the New Mexico replevin statutes, in so far as they provide for a prejudgment taking of property without notice and hearing, are unconstitutional.
Appellants' final contention is that the writ of mandamus was improperly joined with the complaint for declaratory relief. We have held that mandamus was proper in the instant case and the trial court properly held the replevin statute to be unconstitutional in the mandamus action. We deem it unnecessary to decide appellants' final contention, that the mandamus and declaratory relief were improperly joined. The issuance of the permanent writ of mandamus by the trial court is affirmed.
It is so ordered.
COMPTON, C.J., and McMANUS, J., concur.
