
445 P.2d 674 (1968)
Joseph Weldon ROBERTS, Appellant,
v.
STATE of Alaska, Appellee.
No. 886.
Supreme Court of Alaska.
October 7, 1968.
John McCrea III, Allen McGrath, Anchorage, for appellant.
Leroy J. Barker, Chief Deputy Dist. Atty., Douglas B. Baily, Dist. Atty., Anchorage, for appellee.
Before NESBETT, C.J., and DIMOND and RABINOWITZ, JJ.

OPINION
RABINOWITZ, Justice.
In this appeal appellant, Joseph Weldon Roberts, seeks review of the superior court's denial of his petition for a writ of habeas corpus.
On January 11, 1967, appellant was indicted for the crime of murder in the first degree. Seven days later appellant was arrested under a warrant which had been issued on the basis of this indictment. Then, on June 8, 1967, the superior court, on its own motion, dismissed the indictment on the grounds that it was obtained through the use of hearsay evidence.[1]
*675 Acting pursuant to that portion of Criminal Rule 12(b) (5) which provides that
[i]f the court grants a motion based on a defect in the institution of the prosecution or in the indictment or information, it may also order that the defendant be held in custody or that his bail be continued for a specified time pending the filing of a new indictment or information.
the superior court, as part of its June 8 order dismissing the indictment, further ordered appellant held in custody until the "next regular meeting of the grand jury." Subsequent to the entry of this order, appellant filed a petition for a writ of habeas corpus. In this petition he contended the trial court had applied Criminal Rule 12(b) (5) in a manner which unconstitutionally deprived him of his liberty. The primary argument advanced in support of the petition was that once the murder indictment had been dismissed there was no further basis for detention since there had never been any prior determination of probable cause other than that which flowed from the indictment which was dismissed by the superior court.[2] On June 28, 1967, the superior court denied the habeas corpus application and again ordered appellant held pursuant to Criminal Rule 12(b) (5).[3] A motion for a stay of all proceedings in the superior court pending determination of the merits of the appeal was filed in this court by appellant. This was denied and on July 5, 1967, a second first degree murder indictment was returned against appellant. For a portion of the time prior to trial on this second indictment, appellant was imprisoned because of his inability to raise bail. A jury trial was commenced on October 9, 1967, on this second indictment, and on November 9, 1967, a judgment and commitment was entered upon a guilty verdict of murder in the second degree.
In his appeal to this court, appellant requests that the superior court's ruling on the merits of his habeas corpus application be reversed, and that the judgment and commitment be set aside. Initially, we must resolve an issue which has been characterized as one involving "mootness." The state's primary contention is that this appeal has been rendered moot by virtue of appellant's present, concededly lawful detention *676 under the judgment and commitment for murder in the second degree.[4]
It is generally held that habeas corpus will lie only to determine the legality of the particular sentence for which a petitioner is held in custody. Habeas corpus is not available to review questions, no matter how important, which are not related to the cause of petitioner's detention.[5] These general principles are reflected in Crow v. United States[6] where it was stated:
It [habeas corpus] does not lie to secure a judicial decision which, even if determined in the prisoner's favor, would not result in his immediate release.
The habeas corpus provisions of Alaska's Code of Criminal Procedure are in conformity with these general rules. AS 12.75.020 provides that:
A person properly imprisoned or restrained by virtue of the legal judgment of a competent tribunal of civil or criminal jurisdiction, or by virtue of an execution regularly and lawfully issued upon that judgment or decree shall not be allowed to prosecute the writ.[7]
Thus, the determinative issue here is whether a decision holding unconstitutional the superior court's order which incarcerated appellant pursuant to Criminal Rule 12(b) (5) would effect appellant's immediate release. If answered in the negative, relief by way of habeas corpus will not lie. This established rule of law is also reflected in the text of AS 12.75.090 which, in regard to habeas corpus proceedings, provides that, "The court shall remand the party if it appears that he is legally detained in custody."[8]
Numerous courts have reached the conclusion that the illegal arrest or detention of a petitioner will not result in his discharge in a habeas corpus proceeding where the illegality did not contaminate the trial which led to petitioner's present incarceration. The authorities are typified by the statement which was made by the *677 Supreme Court of the United States in Stallings v. Splain.[9] There the court said:
Where it appears that sufficient ground for detention exists, a prisoner will not be discharged for defects in the original arrest or commitment.[10]
Also typical of the decisions in this area is the following statement from the court's opinion in D'Agostino v. Sahli:[11]
The only determination which we need make is whether appellant can be lawfully detained. If, as here, sufficient grounds for his detention are shown, he is not to be discharged even if there were defects in his original arrest or commitment.[12]
It has not been demonstrated in this appeal that the purported illegal detention of appellant for approximately 30 days under Criminal Rule 12(b) (5) in any way tainted the subsequent indictment which was returned against him or in any manner infected or influenced the outcome of the trial which was held following the return of the second indictment. Since appellant is presently lawfully incarcerated under a sentence for second degree murder, we hold that this appeal from the superior court's denial of the habeas corpus application should be dismissed.
The result we reach today is in accord with the decisions of the United States Supreme Court and other federal courts on same and related questions. In St. Pierre v. United States[13] the Supreme Court said:
We are of opinion that the case is moot because, after petitioner's service of his sentence and its expiration, there was no longer a subject matter on which the judgment of this Court could operate. A federal court is without power to decide moot questions or to give advisory opinions which cannot affect the rights of the litigants in the case before it. United States v. Alaska S.S. Co., 253 U.S. 113, 115, 116, 40 S.Ct. 448, 64 L.Ed. 808 [809, 810 * * *] and cases cited; United States v. Hamburg-Amerikanische Packet-Fahrt-Actien Gesellschaft Co., 239 U.S. 466, 475-477, 36 S.Ct. 212, 216, 60 L.Ed. 387 [391, 392 * * *].
This reasoning was followed in Boggess v. Berry Corp.[14] where the Ninth Circuit Court of Appeals said in part:
Where subsequent events, such as extinguishment of the obligation in controversy * * * or change in the law involved, United States v. Alaska S.S. Co., 1920, 253 U.S. 113, 40 S.Ct. 448, 64 L.Ed. 808, render immaterial the merits *678 of a case at bar, and it does not appear probable the subject matter is of a continuing nature in the sense that a like controversy depending upon a like question of law will arise in the immediate future involving some party to the pending appeal, the reviewing court will dismiss the appeal as moot. Brownlow v. Schwartz, 1923, 261 U.S. 216, 43 S.Ct. 263, 67 L.Ed. 620; Heitmuller v. Stokes, 1921, 256 U.S. 359, 41 S.Ct. 522, 65 L.Ed. 990; United States v. Hamburg-Amerikanische Packet-Fahrt-Actien Gesellschaft, 1916, 239 U.S. 466, 36 S.Ct. 212, 60 L.Ed. 387; Jones v. Montague, 1904, 194 U.S. 147, 24 S.Ct. 611, 48 L.Ed. 913; Mills v. Green, 1895, 159 U.S. 651, 16 S.Ct. 132, 40 L.Ed. 293.
We are not unmindful of recent Supreme Court decisions which have made substantial modifications of prior precedents dealing with issues of mootness. In Carafas v. LaVallee[15] the Supreme Court of the United States held that expiration of petitioner's sentence did not moot his federal habeas corpus appeal which was awaiting appellate review at the time his sentence expired. In reaching the conclusion that petitioner's habeas corpus proceeding under the federal act was not rendered moot, the United States Supreme Court said in part:
It is clear that petitioner's cause is not moot. In consequence of his conviction, he cannot engage in certain businesses; he cannot serve as an official of a labor union for a specified period of time; he cannot vote in any election held in New York State; he cannot serve as a juror. Because of these `disabilities or burdens [which] may flow from' petitioner's conviction, he has `a substantial stake in the judgment of conviction which survives the satisfaction of the sentence imposed on him.' Fiswick v. United States, 329 U.S. 211, 222, 67 S.Ct. 224, 230, 91 L.Ed. 196 (1946). On account of these `collateral consequences, the case is not moot. Ginsberg v. New York, 390 U.S. 629, 633-634, n. 2, 88 S.Ct. 1274, 1277, 20 L.Ed.2d 195 (1968); Fiswick v. United States, supra, 329 U.S. at 222, n. 10, 67 S.Ct. at 230; United States v. Morgan, 346 U.S. 502, 512-513, 74 S.Ct. 247, 253, 98 L.Ed. 248 (1954).[16]
Of significance is the fact that the court in Carafas based its holding upon an interpretation of the federal habeas corpus statute. The court's construction discloses the significant differences between the federal act and Alaska's code provisions relating to habeas corpus. For in Carafas, Mr. Justice Fortas wrote:
But the statute does not limit the relief that may be granted to discharge of the applicant from physical custody. Its mandate is broad with respect to the relief that may be granted. It provides that `[t]he court shall * * * dispose of the matter as law and justice require.' 28 U.S.C. § 2243. The 1966 amendments to the habeas corpus statute seem specifically to contemplate the possibility of relief other than immediate release from physical custody. At one point, the new § 2244(b) (1964 ed., Supp. II) speaks in terms of `release from custody or other remedy.' See Peyton v. Rowe, supra, 391 U.S. 54, 88 S.Ct. 1549, 20 L.Ed.2d 426; Walker v. Wainwright, 390 U.S. 335, 88 S.Ct. 962, 19 L.Ed.2d 1215 (1968). Cf. Ex parte Hull, 312 U.S. 546, 61 S.Ct. 640, 85 L.Ed. 1034 (1941).[17]
Alaska's statutes pertaining to the writ of habeas corpus do not authorize the granting of as broad relief as is possible under the federal act. Further, unlike *679 Carafas, appellant's current incarceration, and "any collateral consequences" which might follow from his conviction of the crime of murder in the second degree, are matters which are separate and apart from any considerations of the merits of the superior court's administration of Criminal Rule 12(b) (5) and its denial of appellant's application for habeas corpus. In such circumstances we will not pass upon the correctness of the superior court's ruling concerning the habeas corpus petition.[18]
The appeal is dismissed.
NOTES
[1]  The superior court's ruling was based on the holding which had been previously reached by the same court in State v. Parks, Cr. Nos., 67-92, 67-95, and 67-115. The Parks case was subsequently appealed to this court where earlier this year we reversed the superior court's ruling as to the use of hearsay evidence in grand jury proceedings. In State v. Parks, 437 P.2d 642, 644-645 (Alaska 1968), we said that the question was whether any evidence was "presented to the grand jury that rationally established the facts," and then held "that hearsay evidence may rationally establish facts and therefore may be sufficient evidence to justify the findings of an indictment by a grand jury."
[2]  Before this court appellant has advanced the additional argument that Crim.R. 43(c) and (d) is controlling rather than Crim.R. 12(b) (5). Under Crim.R. 43(c) and (d), appellant argues that once the indictment was dismissed the rule requires the discharge of the defendant from custody. Crim.R. 43(c) provides:

The court may, either on its own motion or upon the application of the prosecuting attorney, and in furtherance of justice, order an action, after indictment or waiver of indictment, to be dismissed. The reasons for the dismissal must be set forth in the order. Subsection (d) of this rule provides:
When dismissal is ordered pursuant to this rule the defendant must be discharged from custody, or, if admitted to bail, his bail exonerated, or money deposited in lieu thereof refunded to the depositors.
[3]  In its June 28, 1967, order, the superior court stated in part:

[T]hat the petitioner * * * is legally and rightfully held in custody by virtue of this court's commitment of petitioner under the authority of Rule 12(b) (5) of the Alaska Rules of Criminal Procedure.
The text of the order then reads:
[A]nd the said Warden holds said petitioner under the previous commitment of this court pursuant to Rule 12(b) (5) of the Alaska Rules of Criminal Procedure * * *.
[4]  Here the state argues that, assuming arguendo that appellant's original commitment under Crim.R. 12(b) (5) was unlawful,

the present detention is not based on the `original commitment', but on a subsequent conviction and sentence by the Superior Court. This `shows sufficient grounds for his detention' * * *. To secure his release at this time, the appellant must show some reason why commitment under the present conviction is unlawful.
[5]  United States ex rel. Konigsberg v. McFarland, 348 F.2d 215 (3d Cir.1965); Browning v. Crouse, 327 F.2d 529 (10th Cir.1964); Gailes v. Yeager, 324 F.2d 630 (3d Cir.1963).
[6]  186 F.2d 704, 706 (9th Cir.1950) (footnote omitted). In Hoffman v. State, 404 P.2d 644, 647 n. 11 (Alaska 1965), we said, "Habeas corpus is a proper remedy for an imprisonment or restraint that is contrary to fundamental law."
[7]  AS 12.75.010 and AS 12.75.110 of our Code of Criminal Procedure are also relevant here. AS 12.75.010 provides:

A person imprisoned or otherwise restrained of his liberty under any pretense whatsoever, except in the cases specified in [AS 12.75.020] * * *, may prosecute a writ of habeas corpus to inquire into the cause of the imprisonment or restraint, and, if illegal, to be delivered therefrom. Procedure may be as prescribed in the Rules of Civil Procedure.
The text of AS 12.75.110 reads as follows:
No court or judge, on the return of a writ of habeas corpus, may inquire into the legality or justice of any order, judgment, or process specified in [AS 12.75.020] * * *.
[8]  See also AS 12.75.170 which reads in part:

No person who has been discharged by the order of a court upon habeas corpus shall again be imprisoned, restrained, or kept in custody for the same cause except in the following cases:
* * * * *
(2) if, after a judgment or discharge for a defect of evidence, or for a material defect in the commitment, in a criminal case, the party is again arrested on sufficient evidence and committed by legal process for the same offense * * *.
[9]  253 U.S. 339, 343, 40 S.Ct. 537, 539, 64 L.Ed. 940, 943 (1920).
[10]  In Townsend v. Burke, 334 U.S. 736, 737-738, 68 S.Ct. 1252, 1254, 92 L.Ed. 1690, 1692 (1948), the petitioner alleged a "violation of his constitutional rights in that * * * he was held incommunicado for a period of 40 hours between his arrest and his plea of guilty." The United States Supreme Court pointed out that petitioner did not allege that the illegal detention resulted in a coerced plea or the introduction of other damaging evidence against him. The Court then went on to state:

Hence, lawfulness of the detention is not a factor in determining admissibility of any confession and if he were temporarily detained illegally it would have no bearing on the validity of his present confinement based on his plea of guilty, particularly since he makes no allegation that it induced the plea.
[11]  230 F.2d 668, 671 (5th Cir.1956).
[12]  See Reid v. Bannan, 234 F.2d 654, 655 (6th Cir.1956); Latimer v. Cranor, 214 F.2d 926, 928 (9th Cir.1954); Griffin v. Ross, 259 F. Supp. 594, 598 (E.D.N.C. 1966); Pappillion v. Beto, 257 F. Supp. 502, 503 (S.D.Tex. 1966); United States ex rel. Gary v. Hendrick, 238 F. Supp. 757, 759 (E.D.Pa. 1965); United States ex rel. Brink v. Claudy, 96 F. Supp. 220, 223-224 (W.D.Pa. 1951). Of significance is the following portion of the court's opinion in the Gary case:

Relator's assertion that he was illegally arrested, even if true, does not vitiate the constitutionality of his present confinement. Relator is deprived of his liberty today because he was found guilty of burglary and sentenced to imprisonment after indictment and a fair trial, not because of any illegality in his initial arrest.
[13]  319 U.S. 41, 42, 63 S.Ct. 910, 87 L.Ed. 1199, 1201 (1943).
[14]  233 F.2d 389, 390-391 (9th Cir.1956).
[15]  391 U.S. 234, 88 S.Ct. 1556, 20 L.Ed.2d 554 (1968).
[16]  Id. 88 S.Ct. 1559, 20 L.Ed.2d 558 (1968) (footnotes omitted). See Sibron v. State of New York, 392 U.S. 40, 88 S.Ct. 1889, 20 L.Ed.2d 917 (1968). For earlier cases on the subject, see also Parker v. Ellis, 362 U.S. 574, 80 S.Ct. 909, 4 L.Ed.2d 963 (1960); Pollard v. United States, 352 U.S. 354, 77 S.Ct. 481, 1 L.Ed.2d 393 (1957).
[17]  Carafas v. LaVallee, 391 U.S. 234, 239, 88 S.Ct. 1556, 1560, 20 L.Ed. 559 (1965).
[18]  We are in accord with the statement made by the court in Clayton v. Stone, 123 U.S.App.D.C. 181, 358 F.2d 548, 549 (1966), where it was said:

If a substantial and recurring issue is repeatedly mooted before it can be adjudicated, a federal court is not without power to decide the issue in an appropriate case. See Southern Pac. Terminal Co. v. ICC, 219 U.S. 498, 515, 31 S.Ct. 279, 55 L.Ed. 310 (1911). See also Diamond, Federal Jurisdiction to Decide Moot Cases, 94 U.Pa.L.Rev. 125, 135-37 (1946).
Here there is no intimation that the Crim.R. 12(b) (5) issue which appellant seeks to raise has been "repeatedly mooted" or that it is a "recurring issue." Nor was appellant "utterly remediless and defenseless" against such purported unconstitutional conduct. Compare Sibron v. State of New York, 392 U.S. 40, 88 S.Ct. 1889, 20 L.Ed.2d 917 (1968).
