
386 So.2d 415 (1980)
Stanley Lee WILLIAMS and Johnny R. Null
v.
J. O. DAVIS, et al.
79-636.
Supreme Court of Alabama.
June 27, 1980.
Rehearing Denied July 25, 1980.
*416 George K. Elbrecht, Monroeville, for appellants.
Charles A. Graddick, Atty. Gen., and Jack M. Curtis, Asst. Atty. Gen., for appellees.
TORBERT, Chief Justice.
Petition of Stanley Lee Williams and Johnny R. Null for writs of habeas corpus (Count I) and injunctive and declaratory relief (Count II) was filed in the Circuit Court of Escambia County. The petition for writ of habeas corpus was denied and dismissed by the Escambia Circuit Court on December 17, 1979. Motions for change of venue were granted on the same day and venue transferred to Montgomery County; thereafter, the Circuit Court of Montgomery County dismissed the claim (Count II) for injunctive and declaratory relief. Petitioners appealed from the orders of both courts to the Court of Civil Appeals, which appeals were transferred to this Court.
Neither the order of the Escambia Circuit Court nor the order of the Montgomery Circuit Court contained findings of facts. The only statement of facts before this Court is found in the allegations contained in the sworn pleadings of Stanley Lee Williams and Johnny R. Null.
Stanley Lee Williams alleges that he is an inmate in the G. K. Fountain Correctional Center in Atmore, Alabama. Petitioner Williams alleges that on or about June 22, 1979, his status as a prisoner was that of Community I (IGT). In this status he was receiving two days' credit for every one day he actually served in the prison, the extra credit called "good time." In this status, with "good time" credit, petitioner Williams was scheduled to be released from the prison system August 19, 1979. On June 22, 1979, petitioner Williams was charged with the violation of prison Rule II-B-7 of the Handbook of Rules and Information for Inmates. Prisoner alleges that he was deprived of his liberty without due process of law as the result of the disciplinary hearing in that he designated one Jerry Dugger as a witness he wanted to testify on his behalf at the disciplinary hearing and prison officials denied his request to call Mr. Dugger as a witness. Mr. Dugger was a civilian employer in the Loxley area who employed and supervised petitioner Williams and others located at the Loxley Work Release Center. Petitioner alleges that the attendance of Mr. Dugger at the disciplinary hearing would not have been unduly hazardous to institutional safety or correctional goals. As a result of the guilty finding, petitioner was removed from IGT status, certain "good time" was taken away from him, and petitioner was therefore not released on August 19, 1979 as scheduled.
Petitioner Johnny Null alleges that he is an inmate in the G. K. Fountain Correctional Center in Atmore, Alabama, and that on or about August 24, 1979, he was receiving IGT "good time" in his status as a Community I prisoner. Petitioner Null alleges that he had an IGT release date of June 11, 1980. Petitioner alleges that he was charged with the violation of prison Rule II-B-1c of the Handbook of Rules and Information for *417 Inmates. Petitioner Null alleges that he filed a timely written request for documentary evidence on August 13, 1979, and again on August 24, 1979, and petitioner alleges that both requests were denied. Petitioner Null alleges that he designated as witnesses John Gardner (a correctional counselor) and Betty Carr (secretary for the director of the Work Release Center). Petitioner alleges that these witnesses could present relevant evidence which would aid the petitioner in his defense and that petitioner's request for these two witnesses was denied. Petitioner alleges that the attendance of John Gardner and Betty Carr at petitioner's disciplinary hearing would not have been unduly hazardous to the institutional safety or correctional goals. Petitioner Null alleges that as the result of the guilty finding at the disciplinary hearing, he was removed from his IGT status and therefore, petitioner Null would not be released on his IGT release date of June 11, 1980.
Count II of the complaint of petitioners Williams and Null is brought under 42 U.S.C. § 1983, alleging that Mr. J. O. Davis; Governor Forrest "Fob" James; Mr. R. G. Britton, Commissioner, Board of Corrections; and Mr. Andrew Cooper, Deputy Commissioner, Board of Corrections, in their official capacities, deprived them of constitutional rights under color of state law.

I. THE § 1983 ACTION
Count II of the petitioners' complaint is without merit because the United States Supreme Court has held that the duration of confinement cannot be challenged in a § 1983 action, but that the proper method by which a prisoner who claims to have been deprived of his "good time" credits without due process of law can challenge the results of such disciplinary hearings is a petition for a writ of habeas corpus.
In 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.. . . 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 confinement itself.
Preiser v. Rodriguez, 411 U.S. 475 at 487, 93 S.Ct. 1827 at 1835, 36 L.Ed.2d 439 (1973).
Therefore, the judgment dismissing the claim based on § 1983 is affirmed.

II. THE PETITION FOR WRIT OF HABEAS CORPUS
Respondents contend that "good time" is an administrative question which cannot be reviewed in a habeas corpus proceeding, relying on Cazalas v. State, 42 Ala.App. 72, 152 So.2d 444 (1963). Since the rendition of the Cazalas opinion, supra, the United States Supreme Court has held that a prisoner may not be stripped of "good time" credits without some modicum of due process being accorded to him at his disciplinary hearing. Wolff v. McDonnell, 418 U.S. 539, 94 S.Ct. 2963, 41 L.Ed.2d 935 (1974).
Lawful imprisonment necessarily makes unavailable many rights and privileges of the ordinary citizen, a "retraction justified by the considerations underlying our *418 penal system." Price v. Johnston, 334 U.S. 266, 285, 68 S.Ct. 1049, 1060, 92 L.Ed. 1356 (1948). But, though his rights may be diminished by the needs and exigencies of the institutional environment, a prisoner is not wholly stripped of constitutional protections when he is imprisoned for crime. . . . Prisoners may also claim the protections of the Due Process Clause. They may not be deprived of life, liberty, or property without due process of law. Haines v. Kerner, 404 U.S. 519, 92 S.Ct. 594, 30 L.Ed.2d 652 (1972); Wilwording v. Swenson, 404 U.S. 249, 92 S.Ct. 407, 30 L.Ed.2d 418 (1971); Screws v. United States, 325 U.S. 91, 65 S.Ct. 1031, 89 L.Ed. 1495 (1945).
Of course, as we have indicated, the fact that prisoners retain rights under the Due Process Clause in no way implies that these rights are not subject to restrictions imposed by the nature of the regime to which they have been lawfully committed. Cf. CSC v. Letter Carriers, 413 U.S. 548, 93 S.Ct. 2880, 37 L.Ed.2d 796 (1973); Broadrick v. Oklahoma, 413 U.S. 601, 93 S.Ct. 2908, 37 L.Ed.2d 830 (1973); Parker v. Levy, 417 U.S. 733, 94 S.Ct. 2547, 41 L.Ed.2d 439 (1974). Prison disciplinary proceedings are not part of a criminal prosecution, and the full panoply of rights due a defendant in such proceedings does not apply. Cf. Morrissey v. Brewer, 408 U.S. 471, at 488, 92 S.Ct. 2593, at 2603, 33 L.Ed.2d 484. In sum, there must be mutual accommodation between institutional needs and objectives and the provisions of the Constitution that are of general application.
We also reject the assertion of the State that whatever may be true of the Due Process Clause in general or of other rights protected by that Clause against state infringement, the interest of prisoners in disciplinary procedures is not included in that "liberty" protected by the Fourteenth Amendment. . . .
Wolff v. McDonnell, 418 U.S. 539 at 555, 556, 557, 94 S.Ct. 2963 at 2974, 2975, 41 L.Ed.2d 935 (1974).
In Wolff, supra, the United States Supreme Court held that due process required that prisoners in a disciplinary hearing, the result of which could be the revocation of their "good time" benefits, must be given advance written notice of the charges against them and a written statement of the evidence relied upon by the disciplinary board and the reasons for their action. The Court held that because the opportunity to be heard was an essential part of due process, a prisoner should be allowed to call witnesses and present documentary evidence. The Court did not hold that due process always required allowing prisoners to call witnesses but rather established a flexible standard to be used by courts in determining whether due process required allowing a prisoner to call witnesses in his own behalf. That standard is a balancing test between the interests of the prisoner in retaining his "good time" and the interests of the prison in institutional safety and correctional goals.
Two of the procedures that the Court held should be extended to parolees facing revocation proceedings are not, but must be, provided to prisoners in the Nebraska Complex if the minimum requirements of procedural due process are to be satisfied. These are advance written notice of the claimed violation and a written statement of the fact-finders as to the evidence relied upon and the reasons for the disciplinary action taken. . . .
Part of the function of notice is to give the charged party a chance to marshal the facts in his defense and to clarify what the charges are, in fact. See In re Gault, 387 U.S. 1, 33-34, and n. 54, 87 S.Ct. 1428, 1446-1447, and n. 54, 18 L.Ed.2d 527 (1967). . . .

. . . . .

We are also of the opinion that the inmate facing disciplinary proceedings should be allowed to call witnesses and present documentary evidence in his defense when permitting him to do so will not be unduly hazardous to institutional safety or correctional goals. . . . [H]ere we must balance the inmate's interest in avoiding loss of good time *419 against the needs of the prison and some amount of flexibility and accommodation is required. . . .
Wolff v. McDonnell, 418 U.S. 539 at 563, 564, 566, 94 S.Ct. 2963 at 2978-2979, 41 L.Ed.2d 935 (1974) (emphasis added).
The United States District Court for the Middle District of Alabama, Northern Division, held that loss of "good time" is a sufficient deprivation of liberty to warrant a prior due process hearing. Diamond v. Thompson, 364 F.Supp. 659 (M.D.Ala.1973). That Court also held:
[A]t a minimum, the prisoners transferred from Atmore to administrative segregation during the disturbance there were entitled to written notice of the charges against them, an opportunity to be heard and present witnesses and documentary evidence, if any, before an impartial board composed of persons who were not directly involved in the incident, the right to confront and cross-examine adverse witnesses, and a written statement of findings by the board. . . .
Diamond v. Thompson, 364 F.Supp. 659 at 665 (M.D.Ala.1973).
Surely, if the Due Process Clause requires at a minimum that prisoners have an opportunity to be heard, to present witnesses and documentary evidence, and to cross-examine and confront adverse witnesses before a change in the quality of their confinement, then likewise, prisoners should have the same rights before they are deprived of their "good time" credits.
We hold in accord with Wolff, supra, that due process requires that prisoners be allowed to produce documentary evidence and to introduce witnesses in their own behalf at a disciplinary hearing which may result in the revocation of their "good time" benefits, unless the production of such documentary evidence or the attendance of such witnesses would be unduly hazardous to institutional safety or correctional goals.
AFFIRMED IN PART, REVERSED IN PART AND REMANDED.
MADDOX, JONES, SHORES and BEATTY, JJ., concur.
