ORDER AND JUDGMENT*
Jose C. Atencio, appearing pro se, filed suit in federal district court under 42 U.S.C. § 1983, alleging that he was denied a fair trial. Atencio named as defendants his court-appointed trial attorney, the state court judge who presided over his trial, and the two deputy district attorneys who prosecuted him. After recharacterizing Atencio’s claim as one arising under 28 U.S.C. § 2254 rather than under § 1983, the district court concluded that the § 2254 habeas petition could not succeed because Atencio failed to exhaust state remedies as required under subsection (b)(1), and dismissed the case without prejudice. On appeal, Atencio argues that the district court erroneously characterized his complaint as a § 2254 petition and improperly dismissed his claim without affording him the opportunity to amend his pleadings. We exercise jurisdiction under 28 U.S.C. § 1291 and affirm.
In his complaint, Atencio challenged the constitutionality of his criminal trial and conviction. It is axiomatic that when a *857state prisoner, though asserting jurisdiction under § 1983, challenges the existence of confinement rather than the conditions of confinement, the writ of habeas corpus constitutes the sole remedy available. Heck v. Humphrey, 512 U.S. 477, 481, 114 S.Ct. 2364, 129 L.Ed.2d 383 (1994); Preiser v. Rodriguez, 411 U.S. 475, 500, 93 S.Ct. 1827, 36 L.Ed.2d 439 (1973). Notwithstanding Atencio’s failure to state a valid claim under § 1983, the district court dutifully carried out its obligation to construe Atencio’s pleading liberally under Haines v. Kerner, 404 U.S. 519, 520-21, 92 S.Ct. 594, 30 L.Ed.2d 652 (1972), by recharacterizing his claim as if it were properly brought in a habeas petition. We conclude that the district court acted properly in recharacterizing Atencio’s claim as a habeas petition under § 2254. Moreover, the district court also properly dismissed Atencio’s claim without affording him the opportunity to amend his pleadings. Dismissal of a pro se complaint is proper where “it is obvious that the plaintiff cannot prevail on the facts he has alleged and it would be futile to give him an opportunity to amend.” Gaines v. Stenseng, 292 F.3d 1222, 1224 (10th Cir.2002).
On appeal, Atencio gives no indication of facts or theories that would merit relief under either § 1983 or § 2254. As discussed above, permitting Atencio to amend his pleading under § 1983 would be futile because Atencio challenges the existence of his conviction, rather than the conditions of his confinement. The futility of permitting Atencio to amend his pleading to state a § 2254 habeas claim is also apparent. A state prisoner bears the burden of showing that he has exhausted state remedies in order to bring a habeas action. Miranda v. Cooper, 967 F.2d 392, 398 (10th Cir.1992). Atencio fails to identify any facts suggesting he properly exhausted state remedies and that a § 2254 action is ripe for review. Given the futility of permitting Atencio to amend his pleadings, the dismissal without prejudice was more than appropriate.
For the foregoing reasons, we AFFIRM the judgment of the district court. Because Atencio paid the full $150 filing fee for commencing a § 1983 action, however, the amount paid should be refunded to him, to the extent it exceeds the fee chargeable for the filing of a petition for habeas corpus.