
    Inmate 115235, C.A. KRUGER, Petitioner-Appellant, v. Robert ERICKSON, Respondent-Appellee.
    No. 95-2714.
    United States Court of Appeals, Eighth Circuit.
    Submitted Feb. 15, 1996.
    Decided Feb. 28, 1996.
    
      Douglas Brian Altman, Minneapolis, Minnesota, argued, for appellant.
    M. Jacqueline Regis, Asst. Attorney General, St. Paul, Minnesota, argued, for appel-lee.
    Before HANSEN, LAY, and JOHN R. GIBSON, Circuit Judges.
   PER CURIAM.

Clark Kruger is serving a twenty-year sentence for kidnapping and criminal sexual conduct. Under Minnesota law, all inmates convicted of certain sexual offenses are required to submit a blood sample for placement in a DNA databank. See Minn.Stat. § 609.3461. Over his objection, prison officials took Kruger’s blood sample for DNA analysis. Kruger then brought a 42 U.S.C. § 1983 claim for money damages and injunctive relief in state court, which was decided against him on a summary judgment motion. The Minnesota Court of Appeals affirmed the district court’s ruling in an unpublished order, and the Minnesota Supreme Court denied further review. Kruger then filed a petition of habeas corpus in federal district court on the ground that by taking his blood sample, his constitutional rights had been violated.

Upon the magistrate judge’s recommendation, the district court denied his petition. The court reasoned that the blood-taking procedure did not amount to wanton infliction of pain and was not an unreasonable search and seizure, and that the Minnesota law in question was not penal in nature. On appeal, Kruger argues the retroactive application of the law violates the constitutional prohibition against ex post facto laws and the due process clause. Kruger seeks injunctive relief to have his blood sample destroyed or returned to him.

We affirm the judgment of the district court but on different grounds. Both Kruger and the state have failed to recognize that Kruger’s petition for habeas corpus is in actuality a § 1983 claim which has been previously rejected by the state courts. Although the district court dismissed his petition, it erred in issuing a certificate for probable cause under 28 U.S.C. § 2253. Such a certificate, if issued, informs the Court of Appeals that the petitioner presents a color-able issue worthy of an appeal.

In Preiser v. Rodriguez, 411 U.S. 475, 93 S.Ct. 1827, 36 L.Ed.2d 439 (1973), the Supreme Court delineated what constitutes a habeas action as opposed to a 42 U.S.C. § 1983 claim. The prisoner’s label cannot be controlling. See id. at 489-90, 93 S.Ct. at 1836-37. The essence of habeas corpus is an attack by a person in custody upon the legality of that custody. Id. at 484, 93 S.Ct. at 1833. If the prisoner is not challenging the validity of his conviction or the length of his detention, such as loss of good time, then a writ of habeas corpus is not the proper remedy. See id. at 499, 93 S.Ct. at 1841. It is the substance of the relief sought which counts. Where petitioner seeks a writ of habeas corpus and fails to attack the validity of his sentence or the length of his state custody, the district court lacks the power or subject matter jurisdiction to issue a writ. In the present case, the district court should have dismissed the petition for a writ of habeas corpus for lack of subject matter jurisdiction under Fed.R.Civ.P. 12(b)(1).

There are fundamental differences between a civil rights action under 42 U.S.C. § 1983, where a prisoner might seek money damages or injunctive relief from unlawful treatment, and a habeas action under 28 U.S.C. § 2254. Under a petition for a writ of habeas corpus, a petitioner must exhaust his state judicial remedies, see 28 U.S.C. § 2254(b); Heck v. Humphrey, - U.S. -,-, 114 S.Ct. 2364, 2369, 129 L.Ed.2d 383 (1994), whereas under a § 1983 action, exhaustion is not required. Wilwording v. Swenson, 404 U.S. 249, 251, 92 S.Ct. 407, 409, 30 L.Ed.2d 418 (1971). Furthermore, a state court judgment is not binding on the petitioner in a habeas action, whereas the doctrines of issue and claim preclusion, as well as 28 U.S.C. § 1738, apply to the issues in a § 1983 case which have been fully litigated in the state court. See Migra v. Warren City Sch. Dist. Bd. of Educ., 465 U.S. 75, 82-83, 104 S.Ct. 892, 896-97, 79 L.Ed.2d 56 (1984).

In the present case, the substance of Kruger’s claims shows he is attempting to state a successive § 1983 action. Kruger does not make any colorable allegation that his underlying conviction is invalid or that he is otherwise being denied his freedom from unlawful incarceration. In a successive § 1983 claim, we are required to give full faith and credit to a state court judgment under 28 U.S.C. § 1738. See Migra, 465 U.S. at 82-83, 104 S.Ct. at 896-97.

Full faith and credit to prior state court proceedings, as well as doctrines of preclusion, are important mechanisms for limiting frivolous prisoner litigation. In the present case, however, the state did not plead claim preclusion or assert its right to full faith and credit under 28 U.S.C. § 1738. If the state had done so, the magistrate judge would have had to confront the issue directly and would have recognized the need for recommended dismissal. The state perhaps did not do so because it mistakenly assumed the petition was as the prisoner alleged, a petition for a writ of habeas corpus. Notwithstanding the state’s omission, however, the magistrate judge, who made a thorough analysis of the substantive issues presented, still should have recommended a dismissal of the case for lack of jurisdiction. If the magistrate had considered the petition as stating a claim under § 1983, he should have dismissed it as having been fully litigated in the state court. Compounding the error, the district court on plenary review, although dismissing petitioner’s due process claim, nonetheless issued a certificate of probable cause as a necessary prerequisite for appeal to this court. See 28 U.S.C. § 2253. A district court should exercise close scrutiny of all habeas corpus claims before issuing a certificate of probable cause where, in fact, the claim lacks merit or is otherwise frivolous.

We do not intend these words as criticism; under our supervisory authority, we comment on the issue because of the continuing need for judicial economy for all judicial officers and courts. We also address these comments to the state because proper recognition of the substance of prisoner claims could have saved the state a great deal of time in defending a baseless claim in the district court and in preparing and filing a thorough brief on the merits on appeal.

We affirm the dismissal of the petition for a writ of habeas corpus, but we do so for lack of subject matter jurisdiction. 
      
      . This is nol to say that a state's prisoner's use of labels should always control. If a liberal reading of a prisoner's petition shows that he has made a well-stated claim under 42 U.S.C. § 1983, the mislabeling of the petition should not bar the court from entertaining the petition under the Civil Rights Act. However, where the claim for relief under § 1983 is otherwise baseless, the court should refrain from treating the petition as an otherwise well-pleaded claim under a different jurisdictional basis.
     
      
      . This, of course, is nol true where a petitioner exhausts state remedies in processing a writ of habeas corpus. See Sanders v. United States, 373 U.S. 1, 8, 83 S.Ct. 1068, 1073, 10 L.Ed.2d 148 (1963).
     
      
      . The magistrate should have intercepted Kruger's petition when his petition to proceed in forma pauperis was presented under Title 28 U.S.C. § 1915(d). We have emphasized on other occasions the dire need for magistrates to initially scrutinize all in forma pauperis petitions in terms of whether the petition is frivolous. See, e.g., Haugen v. Sutherlin, 804 F.2d 490, 491 (8th Cir.1986). Failure to do so sets forth an unfortunate chain reaction requiring response by the slate and further judicial involvement. All of this could have been avoided if the magistrate would have denied leave to the prisoner to proceed in forma pauperis on the ground his petition for a writ of habeas corpus was frivolous.
     
      
      .Under this court's internal procedures, the clerk's office is directed, upon the district court's issuance of a certificate of probable cause, to appoint counsel for appeal. See Internal Operating Procedure, Eighth Circuit II.C.l, pages 9-10. If the district court denies the certificate of probable cause, the petitioner must seek a certificate from this court to allow the appeal to proceed. Fed.R.App.P. 22(b). No such procedure is required in a § 1983 proceeding.
     