
901 N.E.2d 645 (2009)
Raphael L. MARTIN, Sr., Appellant-Defendant,
v.
STATE of Indiana, Appellee-Plaintiff.
No. 67A04-0808-CV-453.
Court of Appeals of Indiana.
February 26, 2009.
*646 Raphael L. Martin, Sr., Greencastle, IN, Appellant Pro Se.
Gregory F. Zoeller, Attorney General of Indiana, Michael Gene Worden, Deputy Attorney General, Indianapolis, IN, Attorneys for Appellee.

OPINION
BROWN, Judge.
Raphael L. Martin, Sr., appeals the trial court's denial of his petition for writ of habeas corpus. Martin raises five issues, which we consolidate and restate as whether the trial court erred by denying his petition for writ of habeas corpus. We reverse and remand with instructions.
The relevant facts follow. In 2003, Martin was convicted of arson as a class B felony and burglary as a class B felony, and the Allen County Superior Court sentenced him to fifteen years in the Indiana Department of Correction. We affirmed his convictions on direct appeal. See Martin v. State, No. 02A3-0402-CR-95, 813 N.E.2d 450 (Ind.Ct.App. Aug. 6, 2004). At some point, Martin filed a petition for post-conviction relief with the Allen County Superior Court. In June 2005, Martin apparently filed a motion to correct erroneous sentence, which the trial court denied.[1]
In May 2008, Martin filed a petition for writ of habeas corpus with the Putnam County Superior Court. Martin alleged that: (1) the trial court erred when it failed to remove the jury when the State's witness refused to answer questions; (2) his sentence was improperly enhanced; (3) the trial court improperly denied his motion to correct erroneous sentence; and (4) the trial court erred when it failed to give the jury an instruction on circumstantial evidence. The trial court denied Martin's petition as follows: "Court denied petition for writ of habeas corpus for reason that it finds that it has not jurisdiction to grant same. Petitioner should proceed by petition for post conviction relief in the sentencing court or by appeal to the court of appeals." Appellant's Appendix at 32.
*647 The issue on appeal is whether the trial court erred by denying Martin's petition for writ of habeas corpus. Ind. Code § 34-25.5-1-1 provides that "[e]very person whose liberty is restrained, under any pretense whatever, may prosecute a writ of habeas corpus to inquire into the cause of the restraint, and shall be delivered from the restraint if the restraint is illegal." "The purpose of the writ of habeas corpus is to bring the person in custody before the court for inquiry into the cause of restraint." Partlow v. Superintendent, Miami Correctional Facility, 756 N.E.2d 978, 980 (Ind.Ct.App.2001). "One is entitled to habeas corpus only if he is entitled to his immediate release from unlawful custody." Id. "[A] petitioner may not file a writ of habeas corpus to attack his conviction or sentence." Id.
First, we note that Martin's argument regarding the denial of his motion to correct erroneous sentence is not a proper subject for a petition for writ of habeas corpus. Rather, Martin should have brought a direct appeal from that denial, and the record provided to us does not indicate whether Martin did so. See Ind. Appellate Rule 9(A)(5) ("Unless the Notice of Appeal is timely filed, the right to appeal shall be forfeited except as provided by P.C.R. 2.").
Further, Martin's arguments are challenges to the validity of his convictions and sentences rather than an assertion that he is entitled to immediate release. "[A] petitioner must file a petition for post-conviction relief in the court of conviction (rather than a petition for a writ of habeas corpus in the court in the county of incarceration) when he attacks the validity of his conviction or sentence and/or does not allege that he is entitled to immediate discharge." Partlow, 756 N.E.2d at 980 (citing Ind. Post-Conviction Rule 1). Thus, his arguments are not properly brought as a petition for writ of habeas corpus, and the trial court correctly noted that Martin's arguments should be presented by way of a petition for post-conviction relief.
However, as the State notes, under Ind. Post-Conviction Rule 1(1)(c), "if a petitioner applies for a writ of habeas corpus, in the court having jurisdiction of his person, attacking the validity of his conviction or sentence, that court shall under this Rule transfer the cause to the court where the petitioner was convicted or sentenced, and the latter court shall treat it as a petition for relief under this Rule." Consequently, rather than simply denying Martin's petition for writ of habeas corpus, the trial court should have transferred the cause to the court where Martin was convicted and sentenced.[2]See, e.g., Miller v. Lowrance, 629 N.E.2d 846, 847 (Ind. 1994) (reversing the trial court's grant of habeas corpus and remanding with instructions to transfer the petition to the court where the petitioner was convicted and sentenced), reh'g denied.
For the foregoing reasons, we reverse the trial court's denial of Martin's petition for writ of habeas corpus and remand with instructions to transfer the cause to the court where Martin was convicted and sentenced.
Reversed and remanded.
ROBB, J. and CRONE, J. concur.
NOTES
[1]  Martin's appendix does not contain the petition for post-conviction relief, any resolution of that action, or the motion to correct erroneous sentence.
[2]  Martin's petition indicates that he has already filed a petition for post-conviction relief. If that assertion is correct, the court where Martin was convicted and sentenced may ultimately determine that Ind. Post-Conviction Rule 1(12), which governs successive petitions for post-conviction relief, is applicable.
