
910 So.2d 763 (2005)
Ex parte John CHANDLER.
(In re State of Alabama
v.
John Chandler).
1040484.
Supreme Court of Alabama.
April 8, 2005.
John Chandler, pro se.
Jack W. Meigs, Circuit Judge, for respondent.
LYONS, Justice.
John Chandler, an inmate at the Bibb County Correctional Facility, petitions this Court for a writ of mandamus directing the Bibb Circuit Court to set aside its order dismissing Chandler's petition for a writ of habeas corpus and assessing against him the costs of that petition. We *764 grant the mandamus petition and issue the writ.

I.
In December 1988, Chandler was convicted in the Dallas Circuit Court of first-degree sodomy. See § 13A-6-63, Ala. Code 1975. In March 2004, while incarcerated in the Kilby Correctional Facility in Montgomery County, Chandler filed in the Montgomery Circuit Court a petition entitled "petition for writ of habeas corpus," in which he argued that he was being held in violation of his constitutional rights because, he claimed, he had never legally been "convicted" of a crime.[1]
In April 2004, Chandler was transferred from Montgomery County to the Bibb County Correctional Facility, and the Montgomery Circuit Court subsequently transferred Chandler's petition for the writ of habeas corpus to the Bibb Circuit Court. In September 2004, that court held that Chandler's habeas corpus petition was not the proper mechanism for challenging his conviction, and it therefore dismissed the petition without prejudice to allow him to file a petition pursuant to Rule 32, Ala. R.Crim. P. The court also taxed against Chandler the fee for filing the habeas corpus petition and ordered the warden of the Bibb County Correctional Facility to withhold 50% of Chandler's moneys until the filing fee was paid.
There is some dispute as to whether the Bibb Circuit Court ever granted Chandler in forma pauperis status. That court has provided us a copy of an affidavit of substantial hardship and an order signed by both Chandler and the judge of the Montgomery Circuit Court. Although the trial court case number appearing on the affidavit and the order is the same as the case number assigned to the instant case (CV-04-0083), Chandler contends that the affidavit and order were filed with an earlier petition that he later withdrew. The description of the parties and the subject matter of the affidavit and order bears out Chandler's contention. The respondents named in that affidavit and order are different from the respondent named in this proceeding, and the action is described as a civil action for a "civil rights violation." Under these circumstances, we must conclude that Chandler was not granted in forma pauperis status as to this proceeding.

II.
"`The writ of mandamus is a drastic and extraordinary writ, to be "issued only when there is: 1) a clear legal right in the petitioner to the order sought; 2) an imperative duty upon the respondent to perform, accompanied by a refusal to do so; 3) the lack of another adequate remedy; and 4) properly invoked jurisdiction of the court." Ex parte United Serv. Stations, Inc., 628 So.2d 501, 503 (Ala.1993); see also Ex parte Ziglar, 669 So.2d 133, 134 (Ala. 1995).' Ex parte Carter, [807 So.2d 534,] 536 [(Ala.2001)]."
Ex parte McWilliams, 812 So.2d 318, 321 (Ala.2001).
This case is correctly before this Court by way of a petition for a writ of mandamus. In Ex parte McWilliams, this Court stated:
"`[A]bsent the payment of a filing fee [required by § 12-19-70, Ala.Code *765 1975,] or the granting of a request to proceed in forma pauperis the trial court fails to obtain subject matter jurisdiction to consider a postconviction petition.' 782 So.2d 848, 849 (Ala.Crim.App.2000) (citing Goldsmith v. State, 709 So.2d 1352, 1352-53 (Ala.Crim.App.1997))."
812 So.2d at 322.
"The question of subject-matter jurisdiction is reviewable by a petition for a writ of mandamus." Ex parte Liberty Nat'l Life Ins. Co., 888 So.2d 478, 480 (Ala.2003). See also Ex parte Holley, 883 So.2d 266, 268 (Ala.Crim.App.2003) ("[The petitioner's] only remedy is to file a mandamus petition. [The petitioner] could not appeal the ruling entered by Judge McCooey because that ruling was `void,' and a void judgment will not support an appeal."). Because the Bibb Circuit Court did not collect a filing fee from Chandler and because the record does not allow us to conclude that either the Montgomery Circuit Court or the Bibb Circuit Court granted him in forma pauperis status in this proceeding, we have no alternative but to hold that the circuit court's ruling dismissing Chandler's petition and taxing against him the costs of filing that petition is void, and Chandler properly requested relief from that order by way of a petition for the writ of mandamus. Although the circuit court correctly concluded that Chandler's petition should be treated as a Rule 32 petition,[2] its order dismissing the petition and taxing costs to Chandler is void for lack of subject-matter jurisdiction and must be set aside.

III.
The petition for a writ of mandamus is granted, and the Bibb Circuit Court is directed to vacate its order dismissing Chandler's petition and taxing costs against him and to order that any funds deducted from Chandler's prison account as a result of the void order be restored to his account.
PETITION GRANTED; WRIT ISSUED.
NABERS, C.J., and WOODALL, SMITH, and PARKER, JJ., concur.
NOTES
[1]  Chandler contends in his habeas petition that "in order for a person to have a conviction, there must have been an adjudication of guilt." However, attached to his habeas petition is a portion of the trial transcript in which the trial court states: "Mr. Chandler, in accordance with the verdict of the jury, it is the judgment of this Court that you are guilty of sodomy in the first degree as charged in the indictment . . . ."
[2]  See Rule 32.4, Ala. R.Crim. P. ("Any other post-conviction petition seeking relief from a conviction or sentence shall be treated as a proceeding under [Rule 32].").
