
562 N.W.2d 578 (1997)
1997 SD 42
Patrick BOHLMANN, Petitioner and Appellant,
v.
Steven LINDQUIST, Administrator of the South Dakota Human Services Center, a South Dakota State Facility, Appellee.
No. 19654.
Supreme Court of South Dakota.
Considered on Briefs February 18, 1997.
Decided April 16, 1997.
Douglas R. Kettering of Hosmer and Kettering, Yankton, for Petitioner and Appellant.
Michael E. Ridgway, Yankton County State's Attorney, Yankton, for Appellee.
MILLER, Chief Justice.
[¶ 1.] Patrick Bohlmann, a patient at the South Dakota Human Services Center (HSC), appeals the dismissal of his application for a writ of habeas corpus. We affirm.

FACTS
[¶ 2.] Bohlmann was charged with several crimes committed between May 12 and May 30, 1994.[1] Based upon stipulated facts, the trial court found him mentally ill and incapable of knowing the wrongfulness of his actions at the time of the crimes. The trial court further found Bohlmann not guilty by reason of insanity. Bohlmann was therefore acquitted of all charges and committed to the HSC "until such time that he is eligible for release pursuant to SDCL 23A-26-12.5." He was placed in the security treatment unit at the HSC.
*579 [¶ 3.] Bohlmann waived his right to a later statutory hearing and stipulated to the court's consideration of a supplemental report by Dr. William Grant.[2] On November 29, 1994, based on Dr. Grant's recommendation, the court ordered Bohlmann to "continue his commitment at the South Dakota Human Services Center until such time as he is eligible for release pursuant to SDCL 23A-26-12.5." Bohlmann remained in the security treatment unit.
[¶ 4.] On February 20, 1996, Bohlmann filed an application for a writ of habeas corpus. His written application requested that he be released from the HSC's custody. At hearing, however, Bohlmann agreed he requested only that he be transferred to a less restrictive ward within the HSC. He acknowledged that he is not an appropriate candidate for release. After review of the application, the habeas court concluded Bohlmann did not comply with the procedural requirements of SDCL 23A-26-12.5 and dismissed his application. He appeals.

DECISION
[¶ 5.] Bohlmann was committed to the HSC pursuant to SDCL 23A-26-12, which provides the procedure for detaining a defendant acquitted of a crime by reason of insanity:
When the jury has returned a verdict acquitting the defendant upon the ground of insanity, the court shall order that the defendant be committed to the human services center until such time as he is eligible for release pursuant to § 23A-26-12.5.
Following a verdict of not guilty by reason of insanity, a defendant is entitled to a hearing within forty days. SDCL 23A-26-12.2.
If, after the hearing, the court fails to find by the standard specified in § 23A-26-12.3 that the person's release would not create a substantial risk of bodily injury to another person or serious damage to property of another due to a present mental disease or defect, the court shall order that the defendant be committed to the human services center for treatment until the person's mental condition is such that his release, or his conditional release under a prescribed regimen of medical, psychiatric or psychological care or treatment, would not create a substantial risk of bodily injury to another person or serious damage to property of another.
SDCL 23A-26-12.4. A defendant committed to the HSC pursuant to SDCL 23A-26-12 is subject to the supervision and custody of the Department of Human Services until such time as the court finds the conditions for release set forth in SDCL 23A-26-12.5 are satisfied. SDCL 23A-26-12.5; SDCL 1-36A-1.3.
[¶ 6.] SDCL 23A-26-12.5 provides, in pertinent part:
When the administrator of the human services center determines that the person has recovered from his mental disease or defect to such an extent that his release, or conditional release ... would no longer create a substantial risk of bodily injury to another person or serious damage to property of another, he shall promptly file a certificate to that effect with the clerk of the court that ordered the commitment.... The court shall order the discharge of the acquitted person, or, on the motion of the prosecuting attorney or on its own motion, shall hold a hearing, conducted pursuant to the provisions of § 23A-46-3, to determine whether he should be released. If, after the hearing, the court finds by the standards specified in § 23A-26-12.3 that the person has recovered from his mental disease or defect to such an extent that:
(1) His release would no longer create a substantial risk of bodily injury to another person or serious damage to property of another, the court shall order that he be immediately discharged; or
(2) His conditional release under a prescribed regimen of medical, psychiatric or psychological care or treatment would not create a substantial risk of bodily injury to another person or serious *580 damage to property of another, the court shall
(a) Order that he be conditionally discharged under a prescribed regimen of medical, psychiatric or psychological care or treatment that has been prepared for him, that has been certified to the court as appropriate by the administrator of the human services center and that has been found by the court to be appropriate; and
(b) Order, as an explicit condition of release, that he comply with the prescribed regimen of medical, psychiatric or psychological care or treatment.
The court at any time may, after hearing, employing the same criteria, modify or eliminate the regimen of medical, psychiatric or psychological care or treatment.
[¶ 7.] The habeas court, in concluding SDCL 23A-26-12.5 applied to Bohlmann's transfer request, stated:
Okay, I'm going to dismiss the Writ because I don't think it is a proper procedure. I think he has to comply with [SDCL 23A-26-12.5]. And you can't, according to this, you can't just come into court without some kind of certification by the administrator, so he has to go through that procedure. So this will be dismissed.[3]
[¶ 8.] As noted earlier, Bohlmann requested only that he be transferred to a less restrictive ward within the facility, not that he be released from the HSC's custody.[4] SDCL 23A-26-12.5 does not provide for intra-facility transfers at the direction of the court. The statute only provides authority for the court to grant a complete or conditional release from the custody of the HSC upon completion of the statutory conditions.[5] Therefore, we conclude the procedural requirements of SDCL 23A-26-12.5 are inapplicable to Bohlmann's transfer request and the habeas court's application of SDCL 23A-26-12.5 was in error.
[¶ 9.] The habeas court's dismissal of Bohlmann's writ of habeas corpus, though for the wrong reason, reached the right result. See Kehn v. Hoeksema, 524 N.W.2d 879, 881 (S.D.1994); Sommervold v. Grevlos, 518 N.W.2d 733, 740 (S.D.1994); Cowell v. Leapley, 458 N.W.2d 514, 519 (S.D.1990).
[¶ 10.] Jurisdiction may be raised by this Court sua sponte. See Lehr v. Dep't of Labor, 391 N.W.2d 205, 206 (S.D.1986); State v. Huftile, 367 N.W.2d 193, 195 (S.D. 1985); Long v. Knight Constr. Co., Inc., 262 N.W.2d 207, 209 (S.D.1978). "[A]lthough a jurisdictional issue was not raised below or on appeal, we are required to address the issue." State v. Waldner, 381 N.W.2d 273, 275 (S.D.1986) (citations omitted) (emphasis in original). Because we conclude the habeas court is without jurisdiction to hear Bohlmann's transfer request at this time, we affirm the dismissal of the writ.
[¶ 11.] The HSC is an administrative agency within the Department of Human Services, an executive department. SDCL 1-36A-1.3. "Under the doctrine of separation of powers, an administrative agency, a branch of the executive department[,] is empowered to determine its own jurisdiction." Rapid City Area School Dist. No. 51-4 v. de Hueck, 324 N.W.2d 421, 422 (S.D.1982) (citing *581 Myers v. Bethlehem Shipbuilding Corp., 303 U.S. 41, 58 S.Ct. 459, 82 L.Ed. 638 (1938)). The Department's jurisdiction specifically includes the authority and responsibility for treatment and case management of persons committed to the HSC. See SDCL 1-36A-1.26; SDCL 27A-12-3.6; ARSD title 46:20 to 46:21.
[¶ 12.] We have consistently held that "once an offender is within the jurisdiction of the executive branch of government, the judicial branchthe circuit courtloses jurisdiction and control." State v. Hurst, 507 N.W.2d 918, 923 (S.D.1993); State v. Wolff, 438 N.W.2d 199, 201 (S.D.1989); State v. Oban, 372 N.W.2d 125, 129 (S.D.1985); Huftile, 367 N.W.2d at 197. The judiciary's relinquishment of jurisdiction to the executive branch upon commitment of a defendant to an executive agency avoids the chaos and confusion that would result from simultaneous jurisdiction. State v. Wooley, 461 N.W.2d 117, 121 (S.D.1990) (noting chaos would result if a parolee was required to satisfy supervisors in both the executive and judicial branches); Huftile, 367 N.W.2d at 196, (stating a defendant has an expectation of certainty concerning the process and requirements of his incarceration). This well-established principle is consistent with the concept of separation of powers, Oban, 372 N.W.2d at 128-29, and clearly delineates which authority has jurisdiction over the defendant during all stages of his commitment or incarceration.
[¶ 13.] In the instant case, the HSC assumed jurisdiction and control of Bohlmann when he was committed to the facility pursuant to his acquittal by reason of insanity. The HSC is statutorily charged with the treatment and care of Bohlmann while he is committed to the facility. SDCL 1-36A-1.26. The plan of treatment prescribed, including the appropriate level of security for Bohlmann and his assignment to a ward, directly relates to the level of care and supervision that he requires. See ARSD title 46:20 to 46:21. Analogous to the placement of a prisoner within the Department of Corrections following sentencing, the HSC is in the best position, based on its experience and expertise in the field of mental illness, to determine the appropriate placement and treatment of a patient committed to the facility. See State v. Beck, 545 N.W.2d 811, 815 (S.D. 1996) (quoting United States v. Newby, 11 F.3d 1143, 1146 (3rd Cir.1993) (noting the adoption and execution of policies designed to preserve internal order in a penal institution are "`peculiarly within the province and professional expertise of corrections officials'"). Accordingly, the HSC has jurisdiction to determine whether a transfer of Bohlmann to a less restrictive ward is appropriate based on his mental health status. If Bohlmann feels he has inappropriately been assigned to the maximum security unit and a transfer is warranted, he is entitled to request a transfer and pursue administrative relief. SDCL 27A-12-32.1 In the event Bohlmann is denied relief, he is entitled to judicial review of the denial. SDCL 1-26-30.[6]
[¶ 14.] Bohlmann, however, has not made an administrative request to be transferred. Rather than requesting the HSC evaluate his placement, he filed an application for a writ of habeas corpus with the court. This application is premature due to Bohlmann's failure to pursue appropriate administrative remedies to obtain the requested transfer and precludes judicial jurisdiction to review the request. We are without jurisdiction to entertain Bohlmann's appeal at this time. The dismissal of Bohlmann's application for a writ of habeas corpus is affirmed.
[¶ 15.] AMUNDSON, KONENKAMP, and GILBERTSON, JJ., concur.
[¶ 16.] SABERS, J., concurs specially.
SABERS, Justice (concurring specially).
[¶ 17.] I agree that a transfer request is not the proper basis for a petition for writ of habeas corpus.[7] I write specially to point out *582 several pertinent statutes not addressed by either party or the majority opinion. First, in ¶ 5, the majority opinion incorrectly states that a court may order the release of a person such as Bohlmann pursuant to one statute only:
A defendant committed to the HSC pursuant to SDCL 23A-26-12 is subject to the supervision and custody of the Department of Human Services until such time as the court finds the conditions for release set forth in SDCL 23A-26-12.5.
Clearly, he does not have to wait for the administrator to file a certificate before he can seek release by having his mental condition assessed under the authority of the circuit court. SDCL 23A-46-7 provides one alternative procedure to achieve this:
Regardless of whether the director of the facility in which a person is hospitalized has filed a certificate as provided in this chapter, §§ 23A-10A-3 to 23A-10A-4.2, inclusive, §§ 23A-26-12 to 23A-26-12.6, inclusive, or §§ 23A-27-42 to 23A-27-46, inclusive, counsel for the person or his guardian may, at any time during such person's hospitalization, file with the court that ordered the commitment a motion for a hearing to determine whether the person should be discharged from such facility, but no such motion may be filed within one hundred eighty days of a court determination that the person should continue to be hospitalized. A copy of the motion shall be sent to the director of the facility in which the person is hospitalized and to the prosecuting attorney.
(Emphasis added).
[¶ 18.] Additionally, a person confined to the HSC has the absolute, indisputable right to seek habeas corpus relief to contest the legality of the detention. See SDCL 23A-46-6:
Nothing contained in § 23A-26-12[8] or § 23A-46-10[9] precludes a person who is committed under either of such sections from establishing by writ of habeas corpus the illegality of his detention.
It is agreed that Bohlmann was committed to the HSC pursuant to SDCL 23A-26-12. There is another statute which provides that a mentally ill person confined to the HSC may seek relief via a habeas corpus writ. See SDCL 27A-12-32.2:
Any person involuntarily committed by a board of mental illness and any person confined or in any manner detained or restrained is entitled to the benefit of the writ of habeas corpus. If the court finds that the criteria in § 27A-10-9.1 are met, the court may authorize continued involuntary commitment. Such authorization is not a bar to the issuing of the writ the second time if it is alleged that the criteria in § 27A-10-9.1 are no longer met.
(Emphasis added); see also SDCL 21-27-1, which provides:
Any person committed or detained, imprisoned or restrained of his liberty, under any color or pretense whatever, civil or criminal, except as provided herein, may apply to the Supreme or circuit Court, or any justice or judge thereof, for a writ of habeas corpus.
SDCL 21-27-9.2 also discusses the procedure for production of the applicant to the court for habeas proceedings when the applicant *583 is confined to the state penitentiary or the state hospital.[10] Finally, this court has previously reviewed a habeas corpus appeal brought by a patient seeking release from the Yankton facility,[11] where he was confined after being found not guilty of murder by reason of insanity. See State ex rel. Barnes v. Behan, 80 S.D. 370, 124 N.W.2d 179 (1963) (denying relief because patient did not demonstrate regained sanity).
[¶ 19.] I agree that if Bohlmann seeks transfer to a less restrictive ward within the HSC, he is entitled to judicial review if his transfer is denied, but not until he has exhausted his administrative remedies. SDCL Chapter 27A-12, "Care, Treatment and Rights of Mental Patients," contains a provision which allows Bohlmann to assert a grievance:
A person may assert grievances with respect to infringement of the rights described in this chapter, including the right to have such grievances considered in a fair, timely and impartial grievance procedure which provides a meaningful review.
SDCL 27A-12-32.1. For example, this chapter provides that Bohlmann has the right to "the implementation of a comprehensive individualized treatment program" in which he has some input. SDCL 27A-12-3.6. If Bohlmann feels this statute is being ignored with regard to his desire for a transfer, he can file a grievance. The procedure for hearings is codified at SDCL Chapter 27A-11A, and includes a provision for an appeal of a final order. SDCL 27A-11A-25 ("The appeal shall be conducted in accordance with the provisions of chapter 1-26."). Chapter 1-26, of course, outlines administrative procedure and rules; obviously, judicial review is available. See SDCL 1-26-30.
[¶ 20.] Denial of relief should be affirmed under these circumstances, but only because a writ of habeas corpus is not the proper vehicle to seek transfer within the facility. Compare Tibbetts v. State, 336 N.W.2d 658 (S.D.1983), where a unanimous court agreed that habeas corpus was not the appropriate remedy by which a penitentiary inmate could challenge a reduction in his good-time credit. The court reasoned the inmate had access to other adequate remedies, negating the necessity for the expedited procedure mandated by SDCL ch. 21-27. Id. at 660-62 (finding that an inmate is entitled to judicial review of disciplinary actions following an administrative appeal). Bohlmann may seek relief via habeas corpus as provided by statute if he claims he should be released or that he is illegally detained. If he seeks a transfer, he must pursue and exhaust his administrative remedies before he is entitled to judicial review. Therefore, I concur specially because the majority writing ignores other remedies available to an HSC patient.
NOTES
[1]  Bohlmann was charged with resisting arrest (SDCL 22-11-4(1)), two counts of intentional damage to property (SDCL 22-34-1), two counts at aggravated assault (SDCL 22-18-1.1(3)), and malicious destruction of property (SDCL 49-32-2) in connection with an incident of forced entry and a high-speed chase with law enforcement.
[2]  Pursuant to SDCL 23A-26-12.2, "[a] hearing shall be conducted pursuant to the provisions of § 23A-46-3, and shall take place not later than forty days following the special verdict."
[3]  This constitutes the entire oral decision of the habeas court.
[4]  Bohlmann argues he is entitled to placement in the least restrictive ward at the HSC allowed by his condition based on SDCL 27A-10-9 and 27A-10-9.1. While not relevant to our disposition of this appeal, we note that these statutes set forth the alternatives available to a person involuntarily committed by the county board of mental illness. SDCL 27A-10-9 sets forth the procedure for determining if placement at the facility is proper for someone involuntarily committed and requires a determination of the least restrictive alternative before commitment to the HSC may be imposed. In Bohlmann's case, placement at the HSC was deemed proper by virtue of his acquittal by reason of insanity pursuant to SDCL 23A-26-12. The option of outpatient treatment was not available to Bohlmann under the circumstances of his commitment because SDCL 23A-26-12 mandates that he be committed to the HSC. Bohlmann's reliance on SDCL 27A-10-9 and 27A-10-9.1 is misplaced.
[5]  A person conditionally released from the HSC under a prescribed regimen of medical, psychiatric or psychological care may be remanded to the custody of the HSC for failure to comply with the prescribed regimen if the court finds his continued release would create a substantial risk to another person or property. SDCL 23A-26-12.6.
[6]  Prior to judicial review, Bohlmann must exhaust all available administrative remedies. Failure to do so is a jurisdictional defect. State Bd. of Regents v. Heege, 428 N.W.2d 535, 539 (S.D.1988).
[7]  I am not sure the circuit court was aware of Bohlmann's "agreement" that his request was for a transfer, not a release, as the court's decision rests solely upon SDCL 23A-26-12.5, which provides for release only, not transfer, and even then, only at the prompting of the HSC administrator.
[8]  SDCL 23A-26-12 provides:

If a verdict of guilty or "guilty but mentally ill" is returned against the defendant, he shall be remanded, if in custody, to the proper officer of the county to await the judgment of the court upon the verdict. When the jury has returned a verdict acquitting the defendant upon the ground of insanity, the court shall order that the defendant be committed to the human services center until such time as he is eligible for release pursuant to § 23A-26-12.5.
[9]  SDCL 23A-46-10 provides:

If, after the hearing, the court finds by clear and convincing evidence that the person is presently suffering from a mental disease or defect as a result of which his release would create a substantial risk of bodily injury to another person or serious damage to property of another, the court shall commit the person to the human services center for treatment until the person's mental condition is such that his release or conditional release under a prescribed regimen of medical, psychiatric, psychological care or treatment would not create a substantial risk of bodily injury to another person or serious damage to property of another.
[10]  See also OpAttyGen No. 86-33, which provides, in relevant part:

With regard to your question concerning whether a patient will be able to initiate a writ [of habeas corpus] every time a previous writ has been denied, I believe that the answer is again provided for by SDCL 27A-12-4 [now codified at SDCL 27A-12-32.2]. That statute, as set out above, provides that, "If the judge or court shall decide that the person is mentally ill, such decision shall not be a bar to the issuing of the writ the second time if it is alleged that the person's behavior is no longer that which precipitated or caused his admission to a facility for treatment." This provision has been construed to mean that no person confined as insane is entitled to a second writ of habeas corpus unless it is alleged that he has been restored to reason. It follows that this one question of fact as to present sanity is the only matter that can properly be considered upon a second writ, and that the order upon the prior writ stands as res judicata upon all matters that could have been presented upon such writ. McMahon v. Mead, 30 S.D. 515, 139 N.W. 122 (1912).
While providing for a somewhat expedited procedure (court may inquire as to the sole issue of whether the individual has been restored to reason), this statute does not place any limitation on the number of times a person so confined can petition for a writ of habeas corpus. Therefore, an individual has a right to renew his application as often as he sees fit, even if it only be to relitigate this one issue of whether he has been restored to reason.
[11]  At that time, the HSC was known as the "State Hospital for the Insane."
