
336 N.W.2d 658 (1983)
Michael TIBBETTS, Petitioner and Appellant,
v.
STATE of South Dakota, Appellee.
Nos. 13849, 13852.
Supreme Court of South Dakota.
Argued January 19, 1983.
Decided July 20, 1983.
*659 Kevin E. Looby, Minnehaha County Public Defender, Sioux Falls, for petitioner and appellant.
Jeffrey P. Hallem, Asst. Atty. Gen., Pierre, for appellee; Mark V. Meierhenry, Atty. Gen., Pierre, on brief.
WOLLMAN, Justice.
This is an appeal from a circuit court judgment denying petitioner habeas corpus relief. We hold that petitioner was not entitled to seek relief by way of habeas corpus.
Following his plea of guilty in May of 1977, petitioner was sentenced to serve concurrent sentences of five and eight years in the South Dakota State Penitentiary. In November of 1981, an officer of the penitentiary filed a rule infraction report alleging that petitioner had possessed marijuana in violation of an institutional rule. Petitioner subsequently pleaded guilty to the rule infraction before the disciplinary board and was sentenced to thirty days' punitive confinement.[1] Petitioner then automatically lost thirty days of good time pursuant to the amended version of SDCL 24-2-12.[2] Petitioner contends that this amended statute, which became effective July 1, 1981, is an ex post facto law. The relief sought by petitioner is the restoration of good time that he lost pursuant to SDCL 24-2-12 and the implementation of the provisions that governed the disciplinary process prior to the 1981 legislative enactments.[3] During *660 oral argument, petitioner conceded that he could lose as much or more good time under the pre-amendment provisions.
The circuit court concluded that it had jurisdiction to issue a writ under SDCL 21-27, but concluded that SDCL 24-2-12 was not an ex post facto law and that petitioner was therefore not entitled to the restoration of his good time. The State has filed a notice of review, contending that the trial court did not have jurisdiction to issue the writ in the first instance.
Although petitioner concedes that he does not fall within any of the categories enumerated in SDCL 21-27-16,[4] he contends that SDCL 21-27-1 has expanded habeas corpus relief to include a case such as his own. SDCL 21-27-1 provides:
When any person shall be committed or detained, imprisoned or restrained of his or her liberty, under any color or pretense whatever, civil or criminal, he or she may apply to the Supreme or circuit Court in term time, or any justice or judge thereof in vacation, for a writ of habeas corpus.
Petitioner relies on the United States Supreme Court's decision in Preiser v. Rodriguez, 411 U.S. 475, 93 S.Ct. 1827, 36 L.Ed.2d 439 (1973), to support his contention that SDCL 21-27-1 encompasses the type of relief he is seeking. Preiser held that when a state prisoner seeks immediate or speedier release from imprisonment, his sole federal remedy is a writ of habeas corpus. The Preiser case, however, dealt only with the federal habeas corpus statute and the federal courts.
Although illegal detention is the basis for issuance of a writ of habeas corpus, the scope of the writ has been enlarged to include such matters as child custody disputes, see, e.g., Application of G.K., 248 N.W.2d 380 (S.D.1976). Likewise, we have recognized that habeas corpus relief is appropriate in certain cases where an incarcerated defendant has been deprived of basic constitutional rights. See, Application of Kiser, 83 S.D. 272, 158 N.W.2d 596 (1968); State ex rel. Burns v. Erickson, 80 S.D. 639, 129 N.W.2d 712 (1964). Also, we have extended the availability of habeas corpus relief to pretrial detainment in exceptional cases. Matter of Kozak, 256 N.W.2d 717 (S.D.1977).
As pointed out by the Supreme Court of Oregon in Penrod v. Cupp, 283 Or. 21, 581 P.2d 934 (1978), it is the promptness of the relief available under a writ of habeas corpus that is the hallmark of that writ.
A central characteristic of the writ, the main purpose achieved by the Habeas Corpus Act of 1679, is the speed with which it triggers a judicial inquiry. The asserted deprivations may range from serious claims of present or impending cruel and unusual punishment as in Bekins [v. Cupp, 274 Or. 115, 545 P.2d 861 (1976)] or infringements of religious freedom as in Newton, [v. Cupp, 3 Or.App. 434, 474 P.2d 532 (1970)] which if valid require urgency, to many other kinds of claims for which another remedy available to prisoners is adequate. For instance, given access to other remedies, habeas corpus normally *661 should not be needed to challenge overcrowding, the quality of prison food, the opportunities for recreation or exercise, or similar conditions of imprisonment even when the challenge has merit. Whether the legal remedies opened to prisoners by ORS 137.275, or administrative remedies that may be developed, will be adequate for any given class of claims cannot be decided in the abstract .... Equity provides the flexible remedy of injunction for conditions found to be contrary to law, and temporary restraining orders, if timely available to petitioners when needed, may obviate the need for habeas corpus where that need rests only on speed. Other forms of effective and speedy independent inquiry outside the courts could be imagined.
581 P.2d at 934, 937 (footnote omitted).
We agree with the Oregon court's analysis. SDCL 21-27-12 requires a hearing to be held within five days after a return has been made upon a writ of habeas corpus. Moreover, SDCL 21-27-6 imposes a $500 forfeiture against a judge who "corruptly" refuses to issue a writ that should lawfully have been issued. These draconian provisions are consistent with the need for a speedy determination of a claim of unlawful detention within the traditional meaning of that term. Petitioner does not contend that he is entitled to immediate release. It would trivialize the great writ if every inmate grievance, real or imagined, stemming from penitentiary disciplinary actions could trigger the expedited procedures mandated by SDCL ch. 21-27. Accordingly, we, like the Supreme Court of Oregon, look to the existence of other remedies that may be available to redress legitimate inmate grievances.[5]
At oral argument, the State conceded that petitioner would be entitled to seek prospective relief by way of an application for a writ of prohibition against a threatened reduction in good time and by way of an application for a writ of mandamus to compel the restoration of good time.
In addition to the traditional extraordinary writs of prohibition and mandamus, petitioner had available the administrative remedy provided by ARSD 17:50:07:07, which authorizes an inmate to appeal to the Board of Charities and Corrections the disciplinary board's reduction of good time.[6]
A number of jurisdictions allow judicial review of penitentiary disciplinary actions under the Administrative Procedures Act. See Alvarez v. State, Dept. of Corrections, 638 P.2d 804 (Colo.App.1981); Bowling v. Florida Dept. of Corrections, 389 So.2d 1031 (Fla.App.1980); State ex rel. Armistead v. Phelps, 365 So.2d 468 (La.1978); Bryant v. Department of Pub. Saf. & Correc. Serv., 33 Md.App. 357, 365 A.2d 764 (1976); Meadows v. Marquette Prison Warden, 117 Mich.App. 794, 324 N.W.2d 507 (1982); Pruitt v. State, 274 S.C. 565, 266 S.E.2d 779 (1980), cert. denied, 449 U.S. 1036, 101 S.Ct. 613, 66 L.Ed.2d 498 (1980). Other jurisdictions do not allow such judicial review. See Langley v. Scurr, 305 N.W.2d 418 (Iowa 1981); Reed v. Parratt, 207 Neb. 796, 301 N.W.2d 343 (1981); Dawson v. Hearing Committee, 92 Wash.2d 391, 597 P.2d 1353 (1979).
The State argues that penitentiary inmates who seek a redress of grievances *662 relating to penitentiary disciplinary procedures should be relegated to the federal courts under 42 U.S.C.S. § 1983 or under the federal habeas corpus statute, 28 U.S. C.S. § 2254. Given the current workload of the federal courts, to adopt the State's position on this matter would constitute an abdication by the State of its responsibilities. See Posner, "Will the Federal Courts of Appeals Survive Until 1984? An Essay on Delegation and Specialization of the Judicial Function," 56 S.Cal.L.Rev. 761 (1983).
Although the State could no doubt effectively bar inmate access to judicial review under the Administrative Procedure Act, just as it has under the habeas corpus statutes, see footnote 5, supra, until the State has so acted, we are of the opinion that penitentiary inmates have a right to judicial review in the state courts of the administrative action taken by penitentiary officials to reduce their good time credit. Thus we reject the State's suggestion that we turn over to the federal courts the responsibility for providing such judicial review and join with those courts that have approved judicial review of penitentiary disciplinary actions pursuant to the Administrative Procedures Act. Accordingly, we hold that a penitentiary inmate is entitled to judicial review of the final decision of the Board of Charities and Corrections entered after an appeal to that Board pursuant to ARSD 17:50:07:07. To the extent that our decision in Matter of Maxwell, 248 N.W.2d 400 (S.D.1976), is inconsistent with our decision today, we no longer adhere to the views expressed in that case.
Because petitioner had available not only the remedies of the writs of prohibition and mandamus, those to be issued only when other relief is not available, of course, but also relief by way of administrative and ultimately judicial review of the disciplinary board's action, we conclude that the circuit court was without jurisdiction to issue a writ of habeas corpus under SDCL ch. 21-27. In view of this holding, we decline to consider the ex post facto issue.
Inasmuch as the trial court should not have issued the writ in the first instance, we reverse the judgment and remand the case to the circuit court with directions to quash the writ.
All the Justices concur.
NOTES
[1]  The disciplinary board is a creature of administrative rule, ARSD 17:50:04:01, which provides:

The penitentiary shall establish a disciplinary board which shall be the penitentiary's administrative body to hear disciplinary infractions and determine punishment consistent with the rules and regulations. The board shall meet as often as necessary, except on Saturdays, Sundays, and holidays and as soon as practical after the infraction is reported.
ARSD 17:50:04:10 provides:
In the event the disciplinary board finds the inmate guilty or he pleads no contest to having violated a rule of the penitentiary, the board may discipline the inmate by one or more of the following: referral to specific institutional programs and/or resources; reprimand; restriction of privileges; forfeiture of pay; loss of work; segregation; recommendation for loss of good time; or in any other manner considered necessary by the board which is consistent with state law. The board may consider the inmate's record, history, progress, or other pertinent information in determining disciplinary action.
[2]  SDCL 24-2-12 now provides:

Every convict against whom the disciplinary sanction of punitive confinement shall be awarded for violating any of the rules, regulations or policies of the penitentiary, unless otherwise determined by the warden, shall be housed in the adjustment center section of the penitentiary for a period deemed necessary for the best interest of discipline, justice, rehabilitation and the protection of self and others. While under conviction for violation of such rules, regulations or policies, whether or not confined on the adjustment center, such convict shall automatically forfeit one day of time granted for good conduct for each day served under such conviction.
[3]  Prior to the 1981 enactments, SDCL 24-2-17 and SDCL 24-2-18 provided that the warden would keep a record of each convict's conduct. The warden could remove from such a record an entry of an infraction of the rules of discipline or he could refer the matter to the board of charities and corrections for final decision. After hearing the warden's recommendation, the board would determine whether to grant or to withhold in full or in part a reduction of sentence for good conduct.
[4]  SDCL 21-27-16 provides:

If it appears on the return of a writ of habeas corpus that the applicant is in custody by virtue of process from any court legally constituted, he can be discharged only for one or more of the following causes:
(1) When the court has exceeded the limit of its jurisdiction, either as to the matter, place, sum, or person;
(2) Where, though the original imprisonment was lawful, yet by some act, omission, or event, which has subsequently taken place, the party has become entitled to his discharge;
(3) Where the process is defective in some substantial form required by law;
(4) Where the process, though in proper form, has been issued in a case or under circumstances where the laws do not allow process or orders for imprisonment or arrest to issue;
(5) When, although in proper form, the process has been issued or executed by a person either unauthorized to issue or execute the same, or where the person having the custody of the applicant, under the process, is not the person empowered by law to detain him;
(6) Where the process appears to have been obtained by fraud, false pretense, or bribery;
(7) Where there is no general law nor any judgment, order, or decree of a court to authorize the process, if in a civil suit, nor any conviction, if in a criminal proceeding.
[5]  If there was any doubt concerning the applicability of SDCL ch. 21-27 in cases like petitioner's, that doubt was removed by House Bill 1363, adopted by the 1983 Legislature, which provides:

A writ of habeas corpus is not a remedy available to an applicant who is incarcerated or detained under a lawful order, or judgment and sentence to seek relief from sanctions imposed upon an applicant or administrative decisions made with regard to such application arising out of disciplinary or administrative actions of the penal institution where the applicant is being confined.
This bill also repealed the post-conviction relief provisions of SDCL 23A-34-1 to 23A-34-23.
[6]  ARSD 17:50:07:07 provides:

Not less than three nor more than forty days after receiving a petition for review, the board of charities and corrections shall set the matter for a review hearing at which time the inmate may appear with his attorney and witnesses and present his case to the board of charities and corrections. The board of charities and corrections shall make its decision within ten days of the review hearing and shall notify the inmate of its decision within five days of the date of the decision.
