Mr. Justice Douglas
delivered the opinion of the Court.
Samuels registered under the Selective Training and Service Act of 1940, as amended, and thereafter claimed exemption from military service under § 5 (d) of the Act. That exemption includes not only regular or duly ordained ministers of religion but also “students who are preparing for the ministry in theological or divinity schools recognized as such for more than one year prior” to the Act. He was classified I-A and inducted into the Army. Thereafter he filed a petition for a writ of habeas corpus in the District Court, seeking release from military custody on the ground that he was entitled to an exemption under § 5 (d) of the Act and that his classification as I-A was unlawful. There was a return and a hearing, and the District Court ordered the writ dismissed. On appeal the Circuit Court of Appeals, in reliance on United States v. Cain, 149 F. 2d 338, reversed and remanded the cause to the District Court with directions to “discharge” Samuels “from military custody, without prejudice to further lawful proceedings under the Selective Service Act.” 151 F. 2d 801, 802.
The case is here on a petition for a writ of certiorari which we granted in order to resolve the conflict between the decision below and United States v. Hearn, 153 F. 2d 186, in the Fifth Circuit Court of Appeals.
First. A question of mootness lies at the threshold of the case presented here. We are advised that after remand of the cause the District Court ordered the release of Samuels and that he was thereupon unconditionally released from military custody. Samuels contends that the case is moot since he'is no longer in custody of the military or of any one else but is free to come and go as he pleases.
Under our decisions the case would be moot if the writ of habeas corpus had been denied below and, pending disposition of the petition here, Samuels had received a discharge from the army. Zimmerman v. Walker, 319 U. S. 744. And see Weber v. Squier, 315 U. S. 810; Tornello v. Hudspeth, 318 U. S. 792. That situation, like the case of a prisoner who, pending an appeal from denial of a writ of habeas corpus, is granted bail, Johnson v. Hoy, 227 U. S. 245; Wales v. Whitney, 114 U. S. 564, 572-574, would present no existing controversy. Habeas corpus is the means of making a judicial “inquiry into the cause of restraint of liberty.” R. S. § 752, 28 U. S. C. § 452. As stated in McNally v. Hill, 293 U. S. 131, 137, “There is no warrant in either the statute or the writ for its use to invoke judicial determination of questions which could not affect the lawfulness of the custody and detention.” If the custody or restraint of liberty is terminated without use of the writ, the case is finished. Different considerations are brought into play if custody is ended through the writ itself.
Our rules recognize the beneficent function of the writ, Bowen v. Johnston, 306 U. S. 19, 26-27; People v. Jennings, 246 N. Y. 258, 158 N. E. 613, by providing that a prisoner to whom the writ has been granted may, pending appeal, be enlarged on a recognizance. Rule 45. The fact that he has been so enlarged does not render the appeal of the custodian moot. Carr v. Zaja, 283 U. S. 52, 53. In such a case the release is obtained through the assertion of judicial power. It is the propriety of the exercise of that power which is in issue in the appellate court, whether the prisoner is discharged or remanded to custody. Though the writ has been granted and the prisoner released, the appellate court by what it does is not rendering an opinion and issuing an order which cannot affect the litigants in the case before it. Cf. St. Pierre v. United States, 319 U. S. 41, 42, and cases cited. Affirmance makes the prisoner’s release final and unconditional. Reversal undoes what the habeas corpus court did and makes lawful a resumption of the custody. Knewel v. Egan, 268 U. S. 442, 448; Haddox v. Richardson, 168 F. 635; James v. Amrine, 157 Kan. 397, 140 P. 2d 362; State v. Langum, 135 Minn. 320, 160 N. W. 858.
Second. On the merits the case involves primarily the use by the Selective Service System in New York City of advisory panels on theological classifications. Under the Act the President is authorized to establish “civilian local boards, civilian appeal boards, and such other agencies, including agencies of appeal, as may be necessary to carry out the provisions of this Act.” Section 10 (a) (2), 57 Stat. 597, 598, 50 U. S. C. App. Supp. III, § 310 (a) (2). With exceptions not material here, the President is authorized to delegate to the Director of Selective Service any authority vested in him under the Act. Section 10 (b), 57 Stat. 597, 598, 50 U. S. C. App. Supp. III, §310 (b). And the Director may redelegate that authority. Id. The administration of the system in each State is delegated under the regulations to a state director. Sections 603.11, 603.12, 6 Fed. Reg. 6827. In New York City, however, a city director has been appointed who performs within that area the functions of the state director. Section 603.12-1, 8 Fed. Reg. 3514. The city director supervises the local boards and boards of appeal in New York City. He may require a local board to reopen and consider anew the classification of a registrant. Section 626.2 (b), 9 Fed. Reg. 11619, § 626.2-1, 10 Fed. Reg. 9210. He may appeal to a board of appeal any determination of a local board. Section 627.1, 8 Fed. Reg. 16720,10 Fed. Reg. 9210. He may require a board of appeal to reconsider its decision, § 627.61, 8 Fed. Reg. 6017, or appeal from it to the President. Section 628.1,7 Fed. Reg. 10521.
It appears that the city director, in aid of these functions, established theological panels. It was thought desirable to give the selective service personnel the benefit of the advice of those familiar with the educational practices of various religious groups so that Selective Service might exercise a more informed judgment in evaluating claims to classifications in IV-D. Accordingly, theological panels were constituted, one of which consisted of prominent laymen and rabbis of the Jewish faith who gave advisory opinions on those who sought a IV-D classification on the grounds that they were either rabbis or students preparing for the ministry in the Jewish religion. The members of the panel were volunteers, as permitted by the regulations. Section 602.2, 6 Fed. Reg. 6826. And pursuant to the regulations each took the oath of office. Section 602.4 (a), 6 Fed. Reg. 6826.
Samuels registered under the Act in February, 1942. In May and July, 1942, he filed with his local board questionnaires stating that he had had two years of high school education; that he was a student at the Mesifta Theological Seminary preparing for the rabbinate; that since 1940 his regular occupation was that of a clerk; that for the past two years he had been employed by a textile company; and that the job for which he was best fitted was that of a spiritual leader and a teacher of Hebrew or rabbinical duties. The local board was advised by the seminary that Samuels had attended there since he was six years old, that he had finished the eight-year elementary course and the four-year pre-rabbinical course, that he had been admitted to the rabbinical division in 1937, that he left the school in 1939 to seek employment, that he returned to the evening school in September, 1941, and that he was transferred to the day session in July, 1942, which, as later appeared, was a few days before the school closed for the summer.
In August, 1942, the local board classified him IV-D. Section 622.44 (a), 6 Fed. Reg. 6607, 6610. In May, 1944, he was given a physical examination and found acceptable for military service. Thereafter the city director requested that he appear before the theological panel in respect to his claim to a IV-D classification. He appeared before the panel in June, 1944, stating, inter alia, that he expected to graduate from the seminary in 1945, that ill health caused him to leave the school in 1939, that between 1940 and 1942 he worked as a clerk, and that he returned to the seminary as a full-time student at about the time he filed his selective service questionnaire.
The panel reported that the seminary which Samuels attended was not preparing men exclusively for the rabbinate, that orthodox tradition encouraged advanced study of the subjects in which students for the ministry were trained, and that students ultimately intending to enter business or a profession or some non-rabbinic activity in the field of religion may be enrolled in the same classes as those preparing for the rabbinate. The panel stated that it therefore seemed essential to determine in each case what the registrant had in mind in pursuing his course of study; that to make that determination the character of the seminary, the sincerity of the registrant’s declared purpose, his demeanor, and the impression as to his candor and honesty should be considered. It concluded that Samuels was not “preparing in good faith for a career of service in the practicing rabbinate.” Its recommendation and the transcript of the hearing before it were sent to the city director who forwarded them to the local board with a request that Samuels’ classification be reopened and with the statement that “while the Local Board should give careful consideration to the recommendation of the advisory panel, the responsibility of determining the registrant’s classification must rest with the Local Board itself, or the appropriate agency of appeal.”
The local board reclassified Samuels I-A in August, 1944. He submitted additional evidence and requested a hearing. One was had in September, 1944 and another in October, 1944. There is no showing that the recommendation of the panel or the transcript of the hearing before it was kept from Samuels. They were not marked confidential in the file. The local board, indeed, allowed Samuels to correct alleged inaccuracies in the transcript. The local board ordered him continued in I-A and, on appeal, the board of appeal also classified him as I-A. A few days later Samuels filed additional information with the local board and requested that his classification be reopened. Another hearing was held, Samuels being present. He advised the board that he had appeared of his own volition before a committee representing the Union of Orthodox Rabbis (but not connected with the selective service system) and that the committee concluded he was a student preparing in good faith for the ministry. What facts that committee may have acted upon do not appear. In any event, the local board denied Samuels’ request to reopen the classification by a divided vote; and shortly thereafter he was inducted into the army.
Congress made the decisions of the local boards and of the boards of appeal “final,” except as appeals from them may be authorized, § 10 (a) (2), withholding from the courts the customary power of review of administrative action. See Estep v. United States, 327 U. S. 114.
It is elementary that habeas corpus may not be used as a writ of error. Tisi v. Tod, 264 U. S. 131; Woolsey v. Best, 299 U. S. 1. The function of habeas corpus is exhausted when it is ascertained that the agency under whose order the petitioner is being held had jurisdiction to act. If the writ is to issue, mere error in the proceeding which resulted in the detention is not sufficient. Tisi v. Tod, supra. Deprivation of petitioner of basic and fundamental procedural safeguards, an assertion of power to act beyond the authority granted the agency, and action without evidence to support its order, are familiar examples of the showing which is necessary. See Johnson v. Zerbst, 304 U. S. 458; Bridges v. Wixon, 326 U. S. 135, 149. But it is not enough to show that the decision was wrong, Tisi v. Tod, supra, or that incompetent evidence was admitted and considered. Vajtauer v. Commissioner, 273 U. S. 103. If it cannot be said that there were procedural irregularities of such a nature or magnitude as to render the hearing unfair, Bridges v. Wixon, supra, p. 156, or that there was no evidence to support the order, Vajtauer v. Commissioner, supra, the inquiry is at an end.
We do not think that the use of the theological panel per se infected the whole administrative proceeding and rendered it so unfair as to be nugatory. The task of the local boards in evaluating claims to exemption is almost certain to raise perplexing problems, especially in large centers where the status and activities of registrants are not so well known in the community. The local boards will frequently have to make inquiries on their own. And when it comes to exemptions claimed under § 5 (d), the variety of religious faiths and the differing educational practices of the churches or of sects within one faith may create difficult questions for the boards.
We agree with the court in United States v. Hearn, supra, p. 188, that advice from well-informed members of the faith in question may “both help and speed just classification.” Congress wrote into the Act a comparable procedure for the handling of claims for exemtion by conscientious objectors. Where such claims are denied by the local board and appealed, they are referred to the Department of Justice for a hearing and an advisory report. Section 5 (g). But the fact that there is no specific statutory provision for the creation of theological panels does not make their use improper. Wise administration may call for the expert advice which they alone can offer. And we see no difference in principle if they are formally constituted and regularly used in lieu of inquiry to members of the particular faith as individual cases arise. The administrative function entrusted to the Selective Service is an enormous one. The Act contemplates an administrative organization highly decentralized so as to operate effectively at the local level. More than the director, local boards, and boards of appeal were authorized. For § 10 (a) (2), as we have noted, authorized the creation of “other agencies” as well. A theological advisory panel, serving solely in an advisory capacity, would seem to be included in that category. The information received by the board from the panel, like information from any other source, must be put in writing in the file so that the registrant may examine it, explain or correct it, or deny it. There is, moreover, no confidential information which can be kept from the registrant under the regulations. With those safeguards a truly expert panel might serve a most useful function without the administrative process being corrupted by any unfair procedure.
Distinct questions would be raised if a registrant of one faith were referred to a theological panel on which his faith was not represented. See United States v. Balogh, 157 F. 2d 939. But it has not been shown that such a condition obtained here.
The court in United States v. Cain, supra, p. 341, held that though the propriety of the use of a theological panel be assumed, it must be limited by two conditions: the names of the members of the panel must be disclosed to the registrant so that he may be in a position to challenge it; the advice or answers which it gives must be limited to ecclesiastical questions.
In the statement which the panel filed in this case the names are not disclosed. But we, do not think that fact rendered the administrative proceedings invalid per se. This is not a case of a registrant being passed upon by a secret group. He appeared before them, saw them face to face, and indeed recognized one of them. There is no showing that Samuels tried to ascertain who the panel members were, either at the time or subsequently, and was denied the information. Though we assume that the regulations require the file to disclose the names and affiliations of the panel members, the mere absence of a formal disclosure is not, without more, so grave an omission as to undermine the whole administrative proceeding.
The question is not whether the allegations of the petition are sufficient to justify the grant of the writ or the issuance of a rule to show cause, so that the facts can be ascertained in accord with the procedure outlined in Walker v. Johnston, 312 U. S. 275. In this case there was a return to the writ, a full hearing was had, and all evidence offered was received. Samuels had the burden of showing that he was unlawfully detained. Walker v. Johnston, supra. Not every procedural error, but only those so flagrant as to result in an unfair hearing render the proceedings vulnerable in a collateral attack. Tisi v. Tod, supra, p. 133; Bridges v. Wixon, supra, pp. 152-156. On the case Samuels has made out, the most that has been shown is that the use of the theological panel might result in a hearing so unfair as to deprive the administrative proceedings of vitality. Samuels has failed to show that in his case it had that effect. He has therefore failed to sustain the burden of proof which was on him.
Secrecy and anonymity are not congenial to our traditions of procedure, nor in keeping with the regulations under this Act. But as we have said, the range of inquiry in a habeas corpus proceeding is limited. We are not sitting in review of action of federal agencies over which we have the power of supervision. Cf. McNabb v. United States, 318 U. S. 332. The function of habeas corpus is not to correct a practice but only to ascertain whether the procedure complained of has resulted in an unlawful detention. It is the impact of the procedure on the person seeking the writ that is crucial. Whatever potentialities of abuse a particular procedure may have, the case is at an end if the challenged proceeding cannot be said to have been so corrupted as to have made it unfair. Samuels points to possibilities of abuse. But he fails to establish prejudice in his case.
If, as was held in United States v. Cain, supra, the panel must be restricted to answering ecclesiastical questions, Samuels should prevail. For the panel in question not only gave the board information concerning the seminary which Samuels-attended but also rendered an advisory opinion on the bona fides of his claim. The argument for restricting the panel to ecclesiastical questions is based on the thought that it is only on such subjects that the board needs specialized information, while if the board relies on a general advisory opinion of the panel, it is devolving its administrative responsibility. See United States v. Cain, supra, pp. 341-342.
It is plain that the local boards and the boards of appeal may not abdicate their duty by delegating to others the responsibility for making classifications. That is their statutory function. Section 10 (a) (2). But no such case is made out in this record. The city director submitted the panel’s report with the admonition that it was advisory only and that it was the board’s responsibility to make the classification. The recommendation of the panel was followed. But Samuels was subsequently given not only one but two hearings before the local board and a hearing before the board of appeal. There is no indication that either board relied solely on the panel’s report or considered itself bound by it. In fact both boards received additional evidence submitted by Samuels and considered it. The record does not bear out the suggestion that either board was a rubber stamp for the panel.
Nor do we think that the range of inquiry and recommendation of the panel was too broad. If a panel is truly expert in the field, its expertness is not necessarily limited to knowledge of the theological schools, the course of training, and the educational practices and traditions. Its acquaintance with the ministry of that faith and with the norms of the profession may well give it special insight into the claims of those seeking exemption. To draw the line at questions technically ecclesiastical is to make a distinction which may be wholly arbitrary in terms of the panel’s expertness. A panel might act on irrelevancies; it might usurp the functions of a board. We discover nothing of the kind here. The fact that the board follows the advice of the panel does not necessarily mean that it functions in a subservient way. The fact is that the local board and the board of appeal gave Samuels further hearings and received and considered all evidence submitted. We find no procedural error of such magnitude as to warrant an uprooting of the entire administrative proceeding in this collateral attack upon it.
Nor can we say there was no evidence to support the final classification made by the board of appeal. Samuels’ statement that he was best fitted to be a Hebrew school teacher and spiritual leader, the two-year interruption in his education, his return to the day session of the seminary in the month when his selective service questionnaire was returned, and the fact that the seminary in question was apparently not preparing men exclusively for the rabbinate make questionable his claim that he was preparing in good faith for the rabbinate. A registrant might seek a theological school as a refuge for the duration of the war. Congress did not create the exemption in § 5 (d) for him. There was some evidence that this was Samuels’ plan; and that evidence, coupled with his demeanor and attitude, might have seemed more persuasive to the boards than it does in the cold record. Our inquiry is ended when we are unable to say that the board flouted the command of Congress in denying Samuels the exemption.
Reversed.
54 Stat. 885, 55 Stat. 211, 621, 845, 56 Stat. 386, 50 U. S. C. App., 50 U. S. C. App. Supp. I, and 50 U. S. C. App. Supp. II, § 301 et seq.
Our citations of the Act and the regulations throughout the opinion refer to the provisions applicable at the times relevant here.
In that case Mr. Justice Cardozo, then Chief Judge of the New York Court of Appeals, said, “It would be intolerable that a custodian adjudged to be at fault, placed by the judgment of the court in the position of a wrongdoer, should automatically, by a mere notice of appeal, prolong the term of imprisonment, and frustrate the operation of the historic writ of liberty.” 246 N. Y. p. 260, 158 N. E. 613.
It appears from the briefs in that case that after the writ had issued in the lower court the petitioner had been discharged, pending appeal, on a recognizance.
The regulations provide that in classifying a registrant, “Oral information should not be considered unless it is summarized in writing and the summary placed in the registrant’s file. Under no circumstances should the local board rely upon information received by a member personally unless such information is reduced to writing and placed in the registrant’s file.” Section 623.2, 9 Fed. Reg. 437, 10 Fed. Reg. 8541.
See § 605.32 (a), 9 Fed. Reg. 9190.