delivered the opinion of the Court.
The respondents in this case were state prisoners who were deprived of good-conduct-time credits by the New York State Department of Correctional Services as a result of disciplinary proceedings. They then brought actions in a federal district court, pursuant to the Civil Rights Act of 1871, 42 U. S. C. § 1983. Alleging that the Department had acted unconstitutionally in depriving them of the credits, they sought injunctive relief to compel restoration of the credits, which in each case would result in their immediate release from confinement in *477prison. The question before us is whether state prisoners seeking such redress may obtain equitable relief under the Civil Rights Act, even though the federal habeas corpus statute, 28 U. S. C. § 2254, clearly provides a specific federal remedy.
The question is of considerable practical importance. For if a remedy under the Civil Rights Act is available, a plaintiff need not first seek redress in a state forum. Monroe v. Pape, 365 U. S. 167, 183 (1961); McNeese v. Board of Education, 373 U. S. 668, 671 (1963); Damico v. California, 389 U. S. 416 (1967); King v. Smith, 392 U. S. 309, 312 n. 4 (1968); Houghton v. Shafer, 392 U. S. 639 (1968). If, on the other hand, habeas corpus is the exclusive federal remedy in these circumstances, then a plaintiff cannot seek the intervention of a federal court until he has first sought and been denied relief in the state courts, if a state remedy is available and adequate. 28 U. S. C. §2254 (b).
The present consolidated case originated in three separate actions, brought individually by the three respondents. The respondent Rodriguez, having been convicted in a New York state court of perjury and attempted larceny, was sentenced to imprisonment for an indeterminate term of from one and one-half to four years. Under New York Correction Law § 803 and Penal Law §§ 70.30 (4) (a), 70.40 (1)(b), a prisoner serving an indeterminate sentence may elect to participate in a conditional-release program by which he may earn up to 10 days per month good-behavior-time credit toward reduction of the maximum term of his sentence. Rodriguez elected to participate in this program. Optimally, such a prisoner may be released on parole after having served approximately two-thirds of his maximum sentence (20 days out of every 30); but accrued good-behavior credits so earned may at any time be withdrawn, in whole *478or in part, for bad behavior or for violation of the institutional rules. N. Y. Correction Law § 803 (1).
Rodriguez was charged in two separate disciplinary-action reports with possession of contraband material in his cell. The deputy warden determined that as punishment, 120 days of Rodriguez' earned good-conduct-time credits should be canceled, and that Rodriguez should be placed in segregation, where he remained for more than 40 days. In the “Remarks” section of the deputy warden's determination was a statement that Rodriguez had refused to disclose how he had managed to obtain possession of the items in question.
Rodriguez then filed in the District Court a complaint pursuant to § 1983, combined with a petition for a writ of habeas corpus. He asserted that he was not really being punished for possession of the contraband material, but for refusal to disclose how he had obtained it, and that he had received no notice or hearing on the charges for which he had ostensibly been punished. Thus, he contended that he had been deprived of his good-conduct-time credits without due process of law.
After a hearing, the District Court held that Rodriguez' suit had properly been brought under the Civil Rights Act, that the habeas corpus claim was “merely a proper adjunct to insure full relief if [Rodriguez] prevails in the dominant civil rights claim,” 307 F. Supp. 627, 628-629 (1969), and that therefore Rodriguez was not required to exhaust his state remedies, as he would have had to do if he had simply filed a petition for habeas corpus. On the merits, the District Court agreed with Rodriguez that the questioning of him by prison officials related solely to the issue of how he had obtained the contraband materials, and that he had been ostensibly punished for something different — possession of the materials — on which he had had no notice or opportunity to answer. This, the court found, denied him due process *479of law, particularly in light of the fact that the prison regulations prescribed no penalty for failure to inform. The District Court further found that the Prison Commutation Board had failed to forward to the Commissioner of Correction written reasons for the cancellation of Rodriguez’ good-conduct time, as required by former N. Y. Correction Law § 236, and that this, too, had deprived Rodriguez of due process and equal protection of the laws. Accordingly, the court declared the cancellation of 120 days’ good-behavior-time credits unconstitutional, and directed the Commissioner of Correction to restore those credits to Rodriguez. Since, at that time, Rodriguez’ conditional-release date had already passed, the District Court’s order entitled him to immediate release from prison on parole.
The Court of Appeals reversed this decision by a divided vote. The appellate court not only disagreed with the District Court on the merits, but also held that Rodriguez’ action was really a petition for habeas corpus and, as such, should not have been entertained by the District Court because Rodriguez had not exhausted his state remedies in accordance with § 2254(b). As the Court of Appeals put it:
“The present application, since it seeks release from custody, is in fact an application for habeas corpus. '[R]elease from penal custody is not an available remedy under the Civil Rights Act.’ Peinado v. Adult Authority of Dept, of Corrections, 405 F. 2d 1185, 1186 (9th Cir.), cert, denied, 395 U. S. 968 (1969). In Johnson v. Walker, 317 F. 2d 418, 419-420 (5th Cir. 1963) the court said: Use of the Civil Rights Statutes to secure release of persons imprisoned by State Courts would thus have the effect of repealing 28 U. S. C. § 2254; of course, such was not the intent of Congress.’ ” Rodriguez v. McGinnis, 451 F. 2d 730, 731 (1971).
*480The judgment of the Court of Appeals was subsequently set aside, and the ease was reheard en banc, as explained below.
The respondent Katzoff, who was serving a sentence of one to three years in prison following his conviction for possession of a dangerous weapon, also elected to participate in New York’s conditional-release program. Disciplinary charges were brought against him for making derogatory comments about prison officials in his diary. As punishment, the deputy warden deprived him of 30 days’ good-conduct time for these diary entries and confined him in segregation for 57 days. Katzoff ultimately lost 50 days’ good-behavior-time credits — 30 days directly and 20 additional days because he was unable to earn any good-conduct time while in segregation. He brought a civil rights complaint under § 1983, joined with a petition for habeas corpus, in Federal District Court, alleging that the prison officials had acted unconstitutionally.
The District Court held, in an unreported opinion, that Katzoff’s failure to exhaust state remedies was no bar to his suit, since it was a civil rights action and the petition for a writ of habeas corpus was only an incidental adjunct to assure enforcement of the judgment. On the merits, the District Court found that there was no prison regulation against the keeping of a diary; that punishment for entries in a private diary violated Katzoff’s constitutional rights to due process, equal protection, and freedom of thought; and that confining Katzoff in segregation for this offense constituted cruel and unusual punishment. The court, therefore, ordered that the 50 days’ good-behavior-time credits be restored to Katzoff, and since this restoration entitled him to immediate release on parole, the court ordered such release.
The Court of Appeals reversed by a divided vote. Without reaching the merits of Katzoff’s complaint, the appellate court held that his action was in essence an *481application for habeas corpus since it sought and obtained his immediate release from custody, and that therefore his complaint should have been dismissed because Katzoff had sought no relief whatever in the state courts and had made no showing that an adequate state remedy was unavailable. United States ex rel. Katzoff v. McGinnis, 441 F. 2d 558 (1971). This judgment of the Court of Appeals was subsequently set aside, and the case was reheard en banc, as explained below.
The respondent Kritsky’s case is similar. While serving a prison sentence of 15 to 18 years under a state court conviction for armed robbery, he was charged by prison officials with being a leader in a prison-wide protest demonstration and with advocating insurrection during that demonstration. When brought before the warden and asked how he would plead, Kritsky stated “Not guilty.” The warden then immediately and summarily imposed punishment on him — deprivation of 545 days’ good-conduct-time credits, and confinement in segregation for four and one-half months, where he lost another 45 days’ good time.
Kritsky subsequently filed a civil rights action, combined with a petition for habeas corpus, in Federal District Court, alleging that his summary punishment had deprived him of his good-time credits without due process of law. The District Court found Kritsky’s complaint to be a proper civil rights action, and went on to rule that he had been denied due process by the imposition of summary punishment and by the failure of the Prison Commutation Board to file with the Commissioner written reasons for cancellation of Kritsky’s good-time credits, as required by New York law. 313 F. Supp. 1247 (1970). Accordingly, the court ordered restoration of the 590 days’ good-conduct-time credits, which entitled Kritsky to immediate release on parole.
*482An appeal was argued before a panel of the Court of Appeals; but, before decision, that Court ordered the case to be reheard en banc, together with the Rodriguez and Katzoff cases. After rehearing en banc of the three now-consolidated cases, the Court of Appeals, with three dissents, affirmed the judgments of the District Court in all of the cases “upon consideration of the merits and upon the authority of Wilwording v. Swenson, [404 U. S. 249] decided by the Supreme Court of the United States on December 14, 1971.” Rodriguez v. McGinnis, 456 F. 2d 79, 80 (1972). Although eight judges wrote separate opinions, it is clear that the majority of the Court relied primarily on our opinion in the Wilwording case, holding that complaints of state prisoners relating to the conditions of their confinement were cognizable either in federal habeas corpus or under the Civil Rights Act, and that as civil rights actions they were not subject to any requirement of exhaustion of state remedies.
We granted certiorari sub nom. Oswald v. Rodriguez, 407 U. S. 919, in order to- consider the bearing of the Wilwording decision upon the situation before us — where state prisoners have challenged the actual duration of their confinement on the ground that they have been unconstitutionally deprived of good-conduct-time credits, and where restoration of those credits would result in their immediate release from prison or in shortening the length of their confinement. In that context, the question whether a state prisoner may bring an action for equitable relief pursuant to § 1983, or whether he is limited to the specific remedy of habeas corpus, presents an unresolved and important problem in the administration of federal justice.
The problem involves the interrelationship of two important federal laws. The relevant habeas corpus statutes are 28 U. S. C. §§ 2241 and 2254. Section 2241 (c) *483provides that “[t]he writ of habeas corpus shall not extend to a prisoner unless ... (3) [h]e is in custody in violation of the Constitution or laws or treaties of the United States . . . .” Section 2254 provides in pertinent part:
“(a) The Supreme Court, a Justice thereof, a circuit judge, or a district court shall entertain an application for a writ of habeas corpus in behalf of a person in custody pursuant to the judgment of a State court only on the ground that he is in custody in violation of the Constitution or laws or treaties of the United States.
“(b) An application for a writ of habeas corpus in behalf of a person in custody pursuant to the judgment of a State court shall not be granted unless it appears that the applicant has exhausted the remedies available in the courts of the State, or that there is either an absence of available State corrective process or the existence of circumstances rendering such process ineffective to protect the rights of the prisoner.
“(c) An applicant shall not be deemed to have exhausted the remedies available in the courts of the State, within the meaning of this section, if he has the right under the law of the State to raise, by any available procedure, the question presented.”1
The Civil Rights Act, 42 U. S. C. § 1983, provides:
“Every person who, under color of any statute, ordinance, regulation, custom, or usage, of any State or Territory, subjects, or causes to be subjected, any citizen ... or other person ... to the deprivation of any rights, privileges, or immunities secured by the Constitution and laws, shall be liable to the *484party injured in an action at law, suit in equity, or other proper proceeding for redress.”
It is clear, not only from the language of §§ 2241 (c) (3) and 2254 (a), but also from the common-law history of the writ, that the essence of habeas corpus is an attack by a person in custody upon the legality of that custody, and that the traditional function of the writ is to secure release from illegal custody. By the end of the 16th century, there were in England several forms of habeas corpus, of which the most important and the only one with which we are here concerned was habeas corpus ad subjiciendum, — the writ used to “inquir[e] into illegal detention with a view to an order releasing the petitioner.” Fay v. Noia, 372 U. S. 391, 399 n. 5 (1963).2 Whether the petitioner had been placed in physical confinement by executive direction alone,3 or by order of a court,4 or even by private parties,5 habeas corpus was the proper means of challenging that confinement and seeking release. Indeed, in 1670, the Chief Justice of the Common Pleas was able to say, in ordering the immediate *485discharge of a juror who had been jailed by a trial judge for bringing in a verdict of not guilty, that “[t]he writ of habeas corpus is now the most usual remedy by which a man is restored again to his liberty, if he have been against law deprived of it.” Bushell’s Case, Vaughan 135, 136, 124 Eng. Rep. 1006, 1007.
By the time the American Colonies achieved independence, the use of habeas corpus to secure release from unlawful physical confinement, whether judicially imposed or not, was thus an integral part of our common-law heritage. The writ was given explicit recognition in the Suspension Clause of the Constitution, Art. I, § 9, cl. 2;6 was incorporated in the first congressional grant of jurisdiction to the federal courts, Act of Sept. 24, 1789, c. 20, § 14, 1 Stat. 81-82; and was early recognized by this Court as a “great constitutional privilege.” Ex parte Bollman, 4 Cranch 75, 95 (1807). See Fay v. Noia, supra, at 399-415.
The original view of a habeas corpus attack upon detention under a judicial order was a limited one. The relevant inquiry was confined to determining simply whether or not the committing court had been possessed of jurisdiction. E. g., Ex parte Kearney, 7 Wheat. 38 (1822); Ex parte Watkins, 3 Pet. 193 (1830). But, over the years, the writ of habeas corpus evolved as a remedy available to effect discharge from any confinement contrary to the Constitution or fundamental law, even though imposed pursuant to conviction by a court of competent jurisdiction. See Ex parte Lange, 18 Wall. 163 (1874); Ex parte Siebold, 100 U. S. 371 (1880); Ex parte Wilson, 114 U. S. 417 (1885); Moore v. Dempsey, 261 U. S. 86 (1923); Johnson v. Zerbst, 304 U. S. *486458 (1938); and Waley v. Johnston, 316 U. S. 101 (1942). See also Fay v. Noia, supra, at 405-409, and cases cited at 409 n. 17. Thus, whether the petitioner’s challenge to his custody is that the statute under which he stands convicted is unconstitutional, as in Ex parte Siebold, supra; that he has been imprisoned prior to trial on account of a defective indictment against him, as in Ex parte Royall, 117 U. S. 241 (1886)that he is unlawfully confined in the wrong institution, as in In re Bonner, 151 U. S. 242 (1894), and Humphrey v. Cady, 405 U. S. 504 (1972); that he was denied his constitutional rights at trial, as in Johnson v. Zerbst, supra; that his guilty plea was invalid, as in Von Moltke v. Gillies, 332 U. S. 708 (1948); that he is being unlawfully detained by the Executive or the military, as in Parisi v. Davidson, 405 U. S. 34 (1972); or that his parole was unlawfully revoked, causing him to be reincarcerated in prison, as in Morrissey v. Brewer, 408 U. S. 471 (1972) — in each case his grievance is that he is being unlawfully subjected to physical restraint, and in each case habeas corpus has been accepted as the specific instrument to obtain release from such confinement.7 *487In the case before us, the respondents’ suits in the District Court fell squarely within this traditional scope of habeas corpus. They alleged that the deprivation of their good-conduct-time credits was causing or would cause them to be in illegal physical confinement, i. e., that once their conditional-release date had passed, any further detention of them in prison was unlawful; and they sought restoration of those good-time credits, which, by the time the District Court ruled on their petitions, meant their immediate release from physical custody.
Even if the restoration of the respondents’ credits would not have resulted in their immediate release, but only in shortening the length of their actual confinement in prison, habeas corpus would have been their appropriate remedy. For recent cases have established that habeas corpus relief is not limited to immediate release from illegal custody, but that the writ is available as well to attack future confinement and obtain future releases. In Peyton v. Rowe, 391 U. S. 54 (1968), the Court held that a prisoner may attack on habeas the second of two consecutive sentences while still serving the first. The Court pointed out that the federal habeas corpus statute “does not deny the federal courts power to fashion appropriate relief other than immediate release. Since 1874, the habeas corpus statute has directed the courts to determine the facts and dispose of the case summarily, ‘as law and justice require.’ Rev. Stat. § 761 (1874), superseded by 28 U. S. C. § 2243.” Id., at 66-67. See also Walker v. Wainwright, 390 U. S. 335 (1968); Carafas v. LaVallee, 391 U. S. 234, 239 (1968); Braden v. 30th Judicial Circuit Court of Kentucky, 410 U. S. 484 (1973). So, even if restoration of respondents’ good-time credits had merely shortened the length of their confinement, rather than required immediate discharge from that confinement, their suits would still have been within the core of habeas corpus in attacking the very duration of their physical *488confinement itself. It is beyond doubt, then, that the respondents could have sought and obtained fully effective relief through federal habeas corpus proceedings.8
Although conceding that they could have proceeded by way of habeas corpus, the respondents argue that the Court of Appeals was correct in holding that they were nonetheless entitled to bring their suits under § 1983 so as to avoid the necessity of first seeking relief in a state forum. Pointing to the broad language of § 1983,9 they argue that since their complaints plainly came within the literal terms of that statute, there is no justifiable reason to exclude them from the broad remedial protection provided by that law. According to the respondents, state prisoners seeking relief under the Civil Rights Act *489should be treated no differently from any other civil rights plaintiffs, when the language of the Act clearly covers their causes of action.
The broad language of § 1983, however, is not conclusive of the issue before us. The statute is a general one, and, despite the literal applicability of its terms, the question remains whether the specific federal habeas corpus statute, explicitly and historically designed to provide the means for a state prisoner to attack the validity of his confinement, must be understood to be the exclusive remedy available in a situation like this where it so clearly applies. The respondents’ counsel acknowledged at oral argument that a state prisoner challenging his underlying conviction and sentence on federal constitutional grounds in a federal court is limited to habeas corpus. It was conceded that he cannot bring a § 1983 action, even though the literal terms of § 1983 might seem to cover such a challenge, because Congress has passed a more specific act to cover that situation, and, in doing so, has provided that a state prisoner challenging his conviction must first seek relief in a state forum, if a state remedy is available. It is clear to us that the result must be the same in the case of a state prisoner’s challenge to the fact or duration of his confinement, based, as here, upon the alleged unconstitutionality of state administrative action. Such a challenge is just as close to the core of habeas corpus as an attack on the prisoner’s conviction, for it goes directly to the constitutionality of his physical confinement itself and seeks either immediate release from that confinement or the shortening of its duration.
In amending the habeas corpus laws in 1948, Congress clearly required exhaustion of adequate state remedies as a condition precedent to the invocation of federal judicial relief under those laws. It would wholly frustrate explicit congressional intent to hold that the respondents in the present case could evade this requirement by the *490simple expedient of putting a different label on their pleadings. In short, Congress has determined that habeas corpus is the appropriate remedy for state prisoners attacking the validity of the fact or length of their confinement, and that specific determination must override the general terms of § 1983.
The policy reasons underlying the habeas corpus statute support this conclusion. The respondents concede that the reason why only habeas corpus can be used to challenge a state prisoner’s underlying conviction is the strong policy requiring exhaustion of state remedies in that situation — to avoid the unnecessary friction between the federal and state court systems that would result if a lower federal court upset a state court conviction without first giving the state court system an opportunity to correct its own constitutional errors. Fay v. Noia, supra, at 419-420. But they argue that this concern applies only to federal interference with state court convictions; and to support this argument, they quote from Ex parte Royall, supra, the case that first mandated exhaustion of state remedies as a precondition to federal habeas corpus:
“The injunction to hear the case summarily, and thereupon ‘to dispose of the party as law and justice require’ does not deprive the court of discretion as to the time and mode in which it will exert the powers conferred upon it. That discretion should be exercised in the light of the relations existing, under our system of government, between the judicial tribunals of the Union and of the States, and in recognition of the fact that the public good requires that those relations be not disturbed by unnecessary conflict between courts equally bound to guard and protect rights secured by the- Constitution.” 117 U. S., at 251 (emphasis added).
In the respondents’ view, the whole purpose of the exhaustion requirement, now codified in § 2254 (b), is to *491give state courts the first chance at remedying their own mistakes, and thereby to avoid “the unseemly spectacle of federal district courts trying the regularity of proceedings had in courts of coordinate jurisdiction.” Parker, Limiting the Abuse of Habeas Corpus, 8 P. R. D. 171, 172-173 (1948) (emphasis added). This policy, the respondents contend, does not apply when the challenge is not to the action of a state court, but, as here, to the action of a state administrative body. In that situation, they say, the concern with avoiding unnecessary interference by one court with the courts of another sovereignty with concurrent powers, and the importance of giving state courts the first opportunity to correct constitutional errors made by them, do not apply; and hence the purpose of the exhaustion requirement of the habeas corpus statute is inapplicable.
We cannot agree. The respondents, we think, view the reasons for the exhaustion requirement of § 2254 (b) far too narrowly. The rule of exhaustion in federal habeas corpus actions is rooted in considerations of federal-state comity. That principle was defined in Younger v. Harris, 401 U. S. 37, 44 (1971), as “a proper respect for state functions,” and it has as much relevance in areas of particular state administrative concern as it does where state judicial action is being attacked. That comity considerations are not limited to challenges to the validity of state court convictions is evidenced by cases such as Morrissey v. Brewer, supra, where the petitioners’ habeas challenge was to a state administrative decision to revoke their parole, and Braden v. 30th Judicial Circuit Court of Kentucky, supra, where the petitioner’s habeas attack was on the failure of state prosecutorial authorities to afford him a speedy trial.
It is difficult to imagine an activity in which a State has a stronger interest, or one that is more intricately bound up with state laws, regulations, and procedures, *492than the administration of its prisons. The relationship of state prisoners and the state officers who supervise their confinement is far more intimate than that of a State and a private citizen. For state prisoners, eating, sleeping, dressing, washing, working, and playing are all done under the watchful eye of the State, and so the possibilities for litigation under the Fourteenth Amendment are boundless. What for a private citizen would be a dispute with his landlord, with his employer, with his tailor, with his neighbor, or with his banker becomes, for the prisoner, a dispute with the State. Since these internal problems of state prisons involve issues so peculiarly within state authority and expertise, the States have an important interest in not being bypassed in the correction of those problems. Moreover, because most potential litigation involving state prisoners arises on a day-to-day basis, it is most efficiently and properly handled by the state administrative bodies and state courts, which are, for the most part, familiar with the grievances of state prisoners and in a better physical and practical position to deal with those grievances. In New York, for example, state judges sit on a regular basis at all but one of the State’s correctional facilities, and thus inmates may present their grievances to a court at the place of their confinement, where the relevant records are available and where potential witnesses are located. The strong considerations of comity that require giving a state court system that has convicted a defendant the first opportunity to correct its own errors thus also require giving the States the first opportunity to correct the errors made in the internal administration of their prisons.10
*493Requiring exhaustion in situations like that before us means, of course, that a prisoner’s state remedy must be adequate and available, as indeed § 2254 (b) provides. The respondents in this case concede that New York provided them with an adequate remedy for the restoration of their good-time credits, through § 79-c of the New York Civil Rights Law, which explicitly provides for injunctive relief to a state prisoner “for improper treatment where such treatment constitutes a violation of his constitutional rights.” (Supp. 1972-1973.)
But while conceding the availability in the New York courts of an opportunity for equitable relief, the respondents contend that confining state prisoners to federal habeas corpus, after first exhausting state remedies, could deprive those prisoners of any damages remedy to which they might be entitled for their mistreatment, since damages are not available in federal habeas corpus proceedings, and New York provides no damages remedy at all for state prisoners. In the respondents’ view, if habeas corpus is the exclusive federal remedy for a state prisoner attacking his confinement, damages might never be obtained, at least where the State makes no provision for them. They argue that even if such a prisoner were to bring a subsequent federal civil rights action for damages, that action could be barred by principles of *494res judicata where the state courts had previously made an adverse determination of his underlying claim, even though a federal habeas court had later granted him relief on habeas corpus.
The answer to this contention is that the respondents here sought no damages, but only equitable relief — restoration of their good-time credits — and our holding today is limited to that situation. If a state prisoner is seeking damages, he is attacking something other than the fact or length of his confinement, and he is seeking something other than immediate or more speedy release — the traditional purpose of habeas corpus. In the case of a damages claim, habeas corpus is not an appropriate or available federal remedy. Accordingly, as petitioners themselves concede, a damages action by a state prisoner could be brought under the Civil Rights Act in federal court without any requirement of prior exhaustion of state remedies. Cf. Ray v. Fritz, 468 F. 2d 586 (CA2 1972).
The respondents next argue that to require exhaustion of state remedies in a case such as the one at bar would deprive a state prisoner of the speedy review of his grievance which is so often essential to any effective redress. They contend that if, prior to bringing an application for federal habeas corpus, a prisoner must exhaust state administrative remedies and then state judicial remedies through all available appeals, a very significant period of time might elapse before the prisoner could ever get into federal court. By that time, no matter how swift and efficient federal habeas corpus relief might be, the prisoner might well have suffered irreparable injury and his grievances might no longer be remediable.
It is true that exhaustion of state remedies takes time. But there is no reason to assume, that state prison ad*495ministrators or state courts will not act expeditiously. Indeed, new regulations established by the New York Department of Correctional Services provide for administrative review of a prisoner’s record in the institution shortly before the earliest possible release date, 7 N. Y. Codes, Rules & Regulations § 261.3 (b),11 and, as previously noted, state judges in New York actually sit in the institutions to hear prisoner complaints. Moreover, once a state prisoner arrives in federal court with his petition for habeas corpus, the federal habeas statute provides for a swift, flexible, and summary determination of his claim. 28 U. S. C. § 2243.12 See also Harris v. Nelson, 394 U. S. 286 (1969); and Hens*496ley v. Municipal Court, ante, at 349-350. By contrast, the filing of a complaint pursuant to § 1983 in federal court initiates an original plenary civil action, governed by the full panoply of the Federal Rules of Civil Procedure. That such a proceeding, with its discovery rules and other procedural formalities, can take a significant amount of time, very frequently longer than a federal habeas corpus proceeding, is demonstrated by the respondents’ actions in the present case. Although both Rodriguez and Kritsky initiated their actions before their conditional-release dates, the District Court did not reach its decisions until three and 10 months later, respectively — in both cases well after the conditional-release dates had passed. Only in Katzoff’s case was there a speedy determination, and his action was not initiated until after his alleged release date.
In any event, the respondents’ time argument would logically extend to a state prisoner who challenges the constitutionality of a conviction that carried a relatively *497short sentence; and yet such a prisoner is clearly covered by § 2254 (b). Arguably, in either case, if the prisoner could make out a showing that, because of the time factor, his otherwise adequate state remedy would be inadequate, a federal court might entertain his habeas corpus application immediately, under § 2254 (b)’s language relating to “the existence of circumstances rendering such [state] process ineffective to protect the rights of the prisoner.” But we need not reach that issue here.
Principles of res judicata are, of course, not wholly applicable to habeas corpus proceedings. 28 U. S. C. §2254 (d). See Salinger v. Loisel, 265 U. S. 224, 230 (1924). Hence, a state prisoner in the respondents’ situation who has been denied relief in the state courts is not precluded from seeking habeas relief on the same claims in federal court. On the other hand, res judicata has been held to be fully applicable to a civil rights action brought under § 1983. Coogan v. Cincinnati Bar Assn., 431 F. 2d 1209, 1211 (CA6 1970); Jenson v. Olson, 353 F. 2d 825 (CA8 1965); Rhodes v. Meyer, 334 F. 2d 709, 716 (CA8 1964); Goss v. Illinois, 312 F. 2d 257 (CA7 1963). Accordingly, there would be an inevitable incentive for a state prisoner to proceed at once in federal court by way of a civil rights action, lest he lose his right to do so. This would have the unfortunate dual effect of denying the state prison administration and the state courts the opportunity to correct the errors committed in the State’s own prisons, and of isolating those bodies from an understanding of and hospitality to the federal claims of state prisoners in situations such as those before us.13 Federal habeas corpus, on the other *498hand, serves the important function of allowing the State to deal with these peculiarly local problems on its own, while preserving for the state prisoner an expeditious federal forum for the vindication of his federally protected rights, if the State has denied redress.
The respondents place a great deal of reliance on our recent decisions upholding the right of state prisoners to bring federal civil rights actions to challenge the conditions of their confinement. Cooper v. Pate, 378 U. S. 546 (1964); Houghton v. Shafer, 392 U. S. 639 (1968); Wilwording v. Swenson, 404 U. S. 249 (1971); Haines v. Kerner, 404 U. S. 519 (1972). But none of the state prisoners in those cases was challenging the fact or duration of his physical confinement itself, and none was seeking immediate release or a speedier release from that confinement — the heart of habeas corpus. In Cooper, the prisoner alleged that, solely because of his religious beliefs, he had been denied permission to purchase certain religious publications and had been denied other privileges enjoyed by his fellow prisoners. In Houghton, the prisoner’s contention was that prison authorities had violated the Constitution by confiscating legal materials which he had acquired for pursuing his appeal, but which, in violation of prison rules, had been found in the possession of another prisoner. In Wilwording, the prisoners’ complaints related solely to their living conditions and disciplinary measures while confined in maximum security. And in Haines, the prisoner claimed that prison officials had acted unconstitutionally by placing him in solitary confinement as a disciplinary measure, and he sought damages for claimed physical injuries sustained while so segregated. It is clear, then, that in *499all those cases, the prisoners’ claims related solely to the States’ alleged unconstitutional treatment of them while in confinement. None sought, as did the respondents here, to challenge the very fact or duration of the confinement itself. Those cases, therefore, merely establish that a § 1983 action is a proper remedy for a state prisoner who is making a constitutional challenge to the conditions of his prison life, but not to the fact or length of his custody. Upon that understanding, we reaffirm those holdings. Cf. Humphrey v. Cady, 405 U. S., at 516-517, n. 18.14
This is not to say that habeas corpus may not also be available to challenge such prison conditions. See Johnson v. Avery, 393 U. S. 483 (1969); Wilwording v. Swenson, supra, at 251. When a prisoner is put under additional and unconstitutional restraints during his lawful custody, it is arguable that habeas corpus will lie to remove the restraints making the custody illegal. See Note, Developments in the Law — Habeas Corpus, 83 Harv. L. Rev. 1038, 1084 (1970).15
*500But we need not in this case explore the appropriate limits of habeas corpus as an alternative remedy to a proper action under § 1983. That question is not before us. What is involved here is the extent to which § 1983 is a permissible alternative to the traditional remedy of habeas corpus. Upon that question, we hold today that when a state prisoner is challenging the very fact or duration of his physical imprisonment, and the relief he seeks is a determination that he is entitled to immediate release or a speedier release from that imprisonment, his sole federal remedy is a writ of habeas corpus. Accordingly, we reverse the judgment before us.
It is so ordered.
See also 28 U. S. C. § 2243, quoted in n. 12, infra.
Other forms of habeas corpus include habeas corpus ad respondendum; ad satisfaciendum; ad prosequendum, testificandum, deliberandum; and ad faciendum et recipiendum. See Fay v. Noia, 372 U. S. 391, 399 n. 5 (1963). But when the words “habeas corpus” are used alone, they have been considered a generic term understood to refer to the common-law writ of habeas corpus ad subjiciendum, which was the form termed the “great writ.” Ex parte Bollman, 4 Cranch 75, 95 (1807).
See, e. g., Darnel’s Case, 3 How. St. Tr. 1-59 (K. B. 1627); Petition of Right, 3 Car. 1, c. 1 (1627); Habeas Corpus Act, 16 Car. 1, c. 10, §§ 3, 8 (1640). See also Ex parte Wells, 18 How. 307 (1856); Ex parte Milligan, 4 Wall. 2 (1866); Parisi v. Davidson, 405 U. S. 34 (1972).
See, e. g., Bushell’s Case, Vaughan 135, 124 Eng. Rep. 1006 (1670); Fay v. Noia, supra.
See, e. g., Rex v. Clarkson, 1 Strange 444, 93 Eng. Rep. 625 (K. B. 1721); Ford v. Ford, 371 U. S. 187 (1962).
“The Privilege of the Writ of Habeas Corpus shall not be suspended, unless when in Cases of Rebellion or Invasion the public Safety may require it.”
It was not until quite recently that habeas corpus was made available to challenge less obvious restraints. In 1963, the Court held that a prisoner released on parole from immediate physical confinement was nonetheless sufficiently restrained in his freedom as to be in custody for purposes of federal habeas corpus. Jones v. Cunningham, 371 U. S. 236. In Carafas v. LaVallee, 391 U. S. 234 (1968), the Court for the first time decided that once habeas corpus jurisdiction has attached, it is not defeated by the subsequent release of the prisoner. And just this Term, in H&nsley v. Municipal Court, ante, p. 345, we held that a person, who, after conviction, is released on bail or on his own recognizance, is “in custody” within the meaning of the federal habeas corpus statute. But those cases marked no more than a logical extension of the traditional meaning and purpose of habeas corpus — to effect release from illegal custody.
Our Brothers in dissent state that the respondents’ claims “could not, in all likelihood, have been heard on habeas corpus at the time the present habeas corpus statute was enacted in 1867, or at the time the exhaustion doctrine was first announced in Ex parte Royall, 117 U. S. 241 (1886), or at the time the requirement was codified in 1948 . . . Post, at 512-513. (Footnotes omitted.) This statement is apparently based on the assumption that, in those years, the respondents’ habeas actions would have been barred by the “prematurity” doctrine, which precluded habeas relief that would have merely reduced the length of the prisoner’s confinement rather than resulting in his immediate release, and which was not rejected until 1968, Peyton v. Rowe, 391 U. S. 54. We note, however, that the respondent Katzoff initiated his action more than a month after his alleged release date, and thus his claim, if accepted, entitled him to immediate release even as of the date on which he brought suit. Although Rodriguez initiated his action 15 days before his alleged release date, and Kritsky six months before such date, in both cases those dates had long passed at the time of the District Court’s decisions, and these respondents were thus entitled to immediate release at that time. In any event, the nature of the respondents’ suits was an attack on the legality of their physical confinement itself; and to deal with such attacks on physical custody, however imposed and whether or not related to conviction by a court, is the long-established function of habeas corpus. See supra, at 484-486.
See supra, at 483-484.
The dissent argues that the respondents’ attacks on the actions of the prison administration here are no different, in terms of the potential for exacerbating federal-state relations, from the attacks made by the petitioners in McNeese v. Board of Education, 373 *493U. S. 668 (1963), Damico v. California, 389 U. S. 416 (1967), and Monroe v. Pape, 365 U. S. 167 (1961), on the various state administrative actions there. Thus, it is said, since exhaustion of state remedies was not required in those cases, it is anomalous to require it here. Post, at 522. The answer, of course, is that in those cases, brought pursuant to § 1983, no other, more specific federal statute was involved that might have reflected a different congressional intent. In the present case, however, the respondents’ actions fell squarely within the traditional purpose of federal habeas corpus, and Congress has made the specific determination in § 2254 (b) that requiring the exhaustion of adequate state remedies in such cases will best serve the policies of federalism.
That section provides that each inmate’s file “shall be considered not more than three nor less than two months before the earliest possible date he would be entitled to consideration for parole or conditional or other release if that date depends upon the amount of good behavior allowance to be granted (based upon the assumption that he has earned all good behavior allowances that can be granted).”
That section provides
“A court, justice or judge entertaining an application for a writ of habeas corpus shall forthwith award the writ or issue an order directing the respondent to show cause why the writ should not be granted, unless it appears from the application that the applicant or person detained is not entitled thereto.
“The writ, or order to show cause shall be directed to the person having custody of the person detained. It shall be returned within three days unless for good cause additional time, not exceeding twenty days, is allowed.
“The person to whom the writ or order is directed shall make a return certifying the true cause of the detention.
“When the writ or order is returned a day shall be set for hearing, not more than five days after the return unless for good cause additional time is allowed.
“Unless the application for the writ and the return present only issues of law the person to whom the writ is directed shall be required to produce at the hearing the body of the person detained.
“The applicant or the person detained may, under oath, deny *496any of the facts set forth in the return or allege any other material facts.
“The return and all suggestions made against it may be amended, by leave of court, before or after being filed.
“The court shall summarily hear and determine the facts, and dispose of the matter as law and justice require.”
See also 28 U. S. C. § 2254 (e):
“If the applicant challenges the sufficiency of the evidence adduced in such State court proceeding to support the State court’s determination of a factual issue made therein, the applicant, if able, shall produce that part of the record pertinent to a determination of the sufficiency of the evidence to support such determination. If the applicant, because of indigency or other reason is unable to produce such part of the record, then the State shall produce such part of the record and the Federal court shall direct the State to do so by order directed to an appropriate State official. If the State cannot provide such pertinent part of the record, then the court shall determine under the existing facts and circumstances what weight shall be given to the State court’s factual determination.”
This isolation, of course, will not occur if the prisoner is required to proceed by way of federal habeas corpus, with its exhaustion requirement. For “exhaustion preserves the role of the state courts in the application and enforcement of federal law: Early federal intervention in state . . . proceedings would tend to remove *498federal questions from the state courts, isolate those courts from constitutional issues, and thereby remove their understanding of and hospitality to federally protected interests.” Note, Developments in the Law — Habeas Corpus, 83 Harv. L. Rev. 1038, 1094 (1970).
If a prisoner seeks to attack both the conditions of his confinement and the fact or length of that confinement, his latter claim, under our decision today, is cognizable only in federal habeas corpus, with its attendant requirement of exhaustion of state remedies. But, consistent with our prior decisions, that holding in no way precludes him from simultaneously litigating in federal court, under § 1983, his claim relating to the conditions of his confinement.
The parties disagree as to the original reason for the emergence of concurrent federal remedies in prison condition cases. According to the petitioners, the parallel development reflects the fact that prior to the Court’s decisions in Jones v. Cunningham, 371 U. S. 236 (1963), Carafas v. LaVallee, 391 U. S. 234 (1968), and Johnson v. Avery, 393 U. S. 483 (1969), the limits of the concept of custody for purposes of habeas corpus were uncertain, and so the clearest remedy for prisoners challenging their conditions was through a civil rights action.. The respondents take the converse position — that habeas corpus may originally have been made available for these challenges because there was no other remedy for in-prison abuses before the resurrection of *500§ 1983 in Monroe v. Pape, supra, and the affirmation of its availability for prisoners in Cooper v. Pate, 378 U. S. 546 (1964), and Houghton v. Shafer, 392 U. S. 639 (1968).