
336 N.W.2d 381 (1983)
Dale CLARK, Leland Rich, and Gary Offet, Petitioners and Appellants,
v.
Herman SOLEM, Warden, South Dakota State Penitentiary, Respondent, Appellee and Cross-Appellant.
Nos. 13947-13949 and 13967.
Supreme Court of South Dakota.
Argued May 23, 1983.
Decided July 20, 1983.
Joseph Neiles, Minnehaha County Public Defender, Sioux Falls, for petitioners and appellants.
Mark W. Barnett, Asst. Atty. Gen., Mark V. Meierhenry, Atty. Gen., Pierre, on brief, for respondent, appellee and cross-appellant.
MORGAN, Justice.
Appellants Dale Clark, Leland Rich and Gary Offet (Inmates), inmates of the South Dakota State Penitentiary (Penitentiary), appeal from a circuit court order denying relief, pursuant to an application for writ of habeas corpus. Herman Solem, Warden of the Penitentiary (Warden), filed a notice of review. We reverse and remand with instructions.
On August 18, 1981, the Disciplinary Board of the Penitentiary found Inmates guilty of assaulting another inmate Kevin Pack (Pack) on July 8, 1981. Inmates exhausted their administrative appeals by appealing this first decision to Warden and to the Board of Charities and Corrections. On September 23, 1981, Inmates filed the original petition for writ of habeas corpus in this action. The circuit court determined it had jurisdiction to issue the writ under SDCL ch. 21-27 and subsequently, at a hearing held on October 5, 1981, counsel for Warden moved the court to remand the case to the Penitentiary for a new hearing.[1] The circuit *382 court so ordered and a new hearing was held on October 14 and 15, 1981, at the Penitentiary. Inmates were again found guilty of assaulting Pack and the Disciplinary Board ordered Inmates to be placed in punitive segregation resulting in an automatic loss of good time.[2] On November 4, 1981, Inmates filed a new petition for writ of habeas corpus, alleging violation of their due process rights. Counsel for Inmates also filed a "petition for review" requesting the circuit court to review the procedures of the second disciplinary hearing. The hearing on the new writ was held on February 18, 1982. The circuit court entered an order denying the application for a writ of habeas corpus on July 12, 1982.
Inmates appeal from that order denying the writ. Warden filed a notice of review, contending the circuit court lacked jurisdiction under SDCL ch. 21-27 to hear the writ. We agree.
After this appeal was granted and the briefs filed in this case, we held in Tibbetts v. State, 336 N.W.2d 658 (S.D.1983), an action arising from a penitentiary disciplinary action 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....
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 21-27.
Id. at 662. Thereafter, in Phillips v. Solem, 336 N.W.2d 382 (S.D.1983), we followed Tibbetts, supra, and held "there is no habeas corpus jurisdiction under SDCL 21-27 in an action arising from a penitentiary disciplinary action in view of the alternative existing remedies." Phillips, 336 N.W. 2d at 383.
On this appeal, Inmates raise several issues of a constitutional dimension. However, "whenever it appears ... that the court lacks jurisdiction of the subject matter, the court shall dismiss the action." SDCL 15-6-12(h)(3). Since the circuit court lacks subject matter jurisdiction over writs of habeas corpus, Tibbetts, supra; Phillips, supra, we reverse the order appealed from and remand to the circuit court with instructions to quash the writ of habeas corpus.
We reverse and remand with instructions.
All the Justices concur.
NOTES
[1]  At the October 5, 1981, hearing, evidence was introduced that one of the original Disciplinary Board members had previous knowledge relating to this case, prior to sitting on the Board. Consequently, counsel for the Warden moved for remand and the circuit court agreed to the remand.
[2]  See ARSD 17:50:04:10 which 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.
