opinion: SHILLITANI v. UNITED STATES.
  No. 412.
  Argued March 2, 1966.
  Decided June 6, 1966.
  Albert J. Krieger argued the cause for petitioner in No. 412.
  Jacob Kossman argued the cause and filed briefs for petitioner in No. 442.
  Ralph S. Spritzer argued the cause for the United States in both cases. With him on the brief were As sistant Attorney General Vinson, Nathan Lewin, Beatrice Rosenberg and Sidney M. Glazer.
  Together with No. 442, Pappadio v. United States, also on certiorari to the same court.
  Mr. Justice Clark
  delivered the opinion of the Court.
  These consolidated cases again present the difficult question whether a charge of contempt against a witness for refusal to answer questions before a grand jury requires an indictment and jury trial. In both cases, contempt proceedings were instituted after petitioners had refused to testify under immunity granted by the respective District Courts. Neither petitioner was indicted or given a jury trial. Both were found guilty and sentenced to two years’ imprisonment, with the proviso that if either answered the questions before his sentence ended, he would be released. The opinion of the District Court in Pappadio is reported at 235 F. Supp. 887 (D. C. S. D. N. Y. 1964). In Shillitani, the District Court simply entered an order, which is not reported. The Court of Appeals for the Second Circuit affirmed each conviction in separate opinions. United States v. Pappadio, 346 F. 2d 5 (1965); United States v. Shillitani, 345 F. 2d 290 (1965). We granted certiorari to review the validity of the sentences imposed in both cases. 382 U. S. 913, 916 (1965). We hold that the conditional nature of these sentences renders each of the actions a civil contempt proceeding, for which indictment and jury trial are not constitutionally required. However, since the term of the grand jury before which petitioners were contumacious has expired, the judgments below must be vacated and the cases remanded for dismissal.
  I.
  No. 412, Shillitani v. United States.
  Shillitani appeared under subpoena before a grand jury investigating possible violations of the federal narcotics laws. On three occasions he refused to answer questions, invoking his privilege against self-incrimination. At the Government's request, the District Judge then granted him immunity under the Narcotic Control Act of 1956, 18 U. S. C. § 1406 (1964 ed.), and ordered him to answer certain questions. When called before the grand jury again, Shillitani persisted in his refusal. Thereafter, in a proceeding under Rule 42 (b) of the Federal Rules of Criminal Procedure, the District Court found him guilty of criminal contempt. No jury trial was requested. Shillitani was sentenced to prison for two years “or until the further order of this Court. Should . . . Mr. Shillitani answer those questions before the expiration of said sentence, or the discharge of the said grand jury, whichever may first occur, the further order of this Court may be made terminating the sentence of imprisonment.” The Court of Appeals affirmed, rejecting Shillitani’s constitutional objection to the imposition of a two-year sentence without indictment or trial by jury on the basis that “the contempt proceedings preceded any compliance” and the “sentence contained a purge clause.” It further construed the sentence as giving Shillitani an unqualified right to be released if and when he obeyed the order to testify. 345 F. 2d, at 294.
  No. 442, Pappadio v. United States.
  Pappadio appeared under subpoena before the same grand jury. He also refused three times to answer numerous questions on the ground that the answers would incriminate him. He was then granted immunity under 18 U. S. C. § 1406 and directed to testify. He continued to refuse to answer any questions except those of identification. In opposition to the grand jury’s subsequent request that the District Court require Pappadio to cooperate, his attorney claimed that he should not be called as a witness so long as a 1958 indictment charging him with conspiracy to violate the narcotics laws was pending. The District Court held that Pappadio had complete immunity, including any criminal proceeding then pending, and ordered him to answer all questions previously asked. Upon return to the grand jury, Pappadio did respond to numerous questions, but still refused to answer five questions pertaining to his alleged association with a group headed by Thomas Lucchese which engaged in narcotics traffic and other illicit activities. An order to show cause was issued, Pappadio’s demand for a jury was denied, and the District Court found him in contempt for willful disobedience of its order to testify. He received a sentence almost identical to that given Shillitani, and the Court of Appeals affirmed on the same grounds.
  II.
  We believe that the character and purpose of these actions clearly render them civil rather than criminal contempt proceedings. See Penfield Co. v. Securities & Exchange Comm’n, 330 U. S. 585, 590 (1947). As the distinction was phrased in Gompers v. Bucks Stove & Range Co., 221 U. S. 418, 449 (1911), the act of disobedience consisted solely “in refusing to do what had been ordered,” i. e., to answer the questions, not “in doing what had been prohibited.” And the judgments imposed conditional imprisonment for the obvious purpose of compelling the witnesses to obey the orders to testify. When the petitioners carry “the keys of their prison in their own pockets,” In re Nevitt, 117 F. 448, 461 (C. A. 8th Cir. 1902), the action “is essentially a civil remedy designed for the benefit of other parties and has quite properly been exercised for centuries to secure compliance with judicial decrees.” Green v. United States, 356 U. S. 165, 197 (1958) (Black, J., dissenting). In short, if the petitioners had chosen to obey the order they would not have faced jail. This is evident from the statement of the District Judge at the time he sentenced Shillitani:
  “I want to make it clear that the sentence of the Court is not intended so much by way of punishment as it is intended solely to secure for the grand jury answers to the questions that have been asked of you.” (Emphasis supplied.)
  The Court of Appeals also interpreted the sentence as conditional: “We construe the judgment in this case.. . . to mean that defendant has an unqualified right to be released from prison once he obeys Judge Wyatt's order. As thus construed, the sentence was entirely proper.” 345 F. 2d, at 294. While all of the parties before this Court briefed the issues with reference to criminal contempt, counsel for petitioners and the Government conceded at argument that the contempt orders were remedial, and, therefore, might well be deemed civil in nature rather than criminal.
  The fact that both the District Court and the Court of Appeals called petitioners’ conduct “criminal contempt” does not disturb our conclusion. Courts often speak in terms of criminal contempt and punishment for remedial purposes. See, e. g., United States v. Onan, 190 F. 2d 1 (C. A. 8th Cir. 1951). “It is not the fact of punishment but rather its character and purpose that often serve to distinguish” civil from criminal contempt. Gompers v. Bucks Stove & Range Co., 221 U. S. 418, 441 (1911). Despite the fact that Shillitani and Pappadio were ordered imprisoned for a definite period, their sentences were clearly intended to operate in a prospective manner — to coerce, rather than punish. As such, they relate to civil contempt. While any imprisonment, of course, has punitive and deterrent effects, it must be viewed as remedial if the court conditions release upon the contemnor’s willingness to testify. See Nye v. United States, 313 U. S. 33, 42-43 (1941). The test may be stated as: what does the court primarily seek to accomplish by imposing sentence? Here the purposé was to obtain answers to the questions for the grand jury.
  III.
  There can be no question that courts have inherent power to enforce compliance with their lawful orders through civil contempt. United States v. United Mine Workers, 330 U. S. 258, 330-332 (1947) (Black and Douglas, JJ., concurring in part and dissenting in part) ; United States v. Barnett, 376 U. S. 681, 753-754 (1964) (Goldberg, J., dissenting). And it is essential that courts be able to compel the appearance and testimony of witnesses. United States v. Bryan, 339 U. S. 323, 331 (1950). A grand jury subpoena must command the same respect. Cf. Levine v. United States, 362 U. S. 610, 617 (1960). Where contempt consists of a refusal to obey a court order to testify at any stage in judicial proceedings, the witness may be confined until compliance. McCrone v. United States, 307 U. S. 61 (1939); Giancana v. United States, 352 F. 2d 921 (C. A. 7th Cir.), cert. denied, 382 U. S. 959 (1965). The conditional nature of the imprisonment — based entirely upon the contemnor’s continued defiance — justifies holding civil contempt proceedings absent the safeguards of indictment and jury, Uphaus v. Wyman, 364 U. S. 388, 403-404 (1960) (Douglas, J., dissenting), provided that the usual due process requirements are met.
  However, the justification for coercive imprisonment as applied to civil contempt depends upon the ability of the contemnor to comply with the court’s order. Maggio v. Zeitz, 333 U. S. 56, 76 (1948). Where the grand jury has been finally discharged, a contumacious witness can no longer be confined since he then has no further opportunity to purge himself of contempt. Accordingly, the contempt orders entered against Shillitani and Pappadio were improper insofar as they imposed sentences that extended beyond the cessation of the grand jury’s inquiry into petitioners’ activities. Having sought to deal only with civil contempt, the District Courts lacked authority to imprison petitioners for a period longer than the term of the grand jury. This limitation accords with the doctrine that a court must exercise “[t]he least possible power adequate to the end proposed.” Anderson v. Dunn, 6 Wheat. 204, 231 (1821); In re Michael, 326 U. S. 224, 227 (1945). The objection that the length of imprisonment thus depends upon fortuitous circumstances, such as the life of the grand jury and when a witness appears, has no relevance to the present situation. That argument would apply only to unconditional imprisonment for punitive purposes, which involves different considerations. Once the grand jury ceases to function, the rationale for civil contempt vanishes, and the contemnor has to be released. Since the term of the grand jury in these cases expired in March 1965, the judgments here for review are vacated, and the cases remanded with directions that they be dismissed.
  It is so ordered.
  Mr. Justice Black concurs in the result.
  Mr. Justice White took no part in the decision of these cases.
  [For dissenting opinion of Mr. Justice Harlan, see post, p. 380.]
  This rule provides:
  “Disposition Upon Notice and Hearing. A criminal contempt except as provided in subdivision (a) of this rule shall be prosecuted on notice. The notice shall state the time and place of hearing, allowing a reasonable time for the preparation of the defense, and shall state the essential facts constituting the criminal contempt charged and describe it as such. The notice shall be given orally by the judge in open court in the presence of the defendant or, on application of the United States attorney or of an attorney appointed by the court for that purpose, by an order to show cause or an order of arrest. The defendant is entitled to a trial by jury in any case in which an act of Congress so provides. He is entitled to admission to bail as provided in these rules. If the contempt charged involves disrespect to or criticism of a judge, that judge is disqualified from presiding at the trial or hearing except with the defendant’s consent. Upon a verdict or finding of guilt the court shall enter an order fixing the punishment.”
  These questions were as follows:
  “Mr. Pappadio, who were the attorneys who were present at these meetings?”
  “Aside from the meetings which you described, which took place on the street, where else did you meet with Lucchese?”
  “Who else was present at these meetings besides yourself, Lucchese and the attorneys?”
  “All right; How many of such meetings were there?”
  “Where did the meetings take place?”
  Because of the similarity in language between the two contempt orders, it is reasonable to assume that the Court of Appeals also construed Pappadio’s sentence as giving him an absolute right to be released upon compliance, although the opinion was silent on this point.
  The record of the contempt proceedings in Pappadio’s ease further indicates that the District Judge viewed the matter as civil contempt. The following colloquy offers one example:
  “Mr. Lawler: Your Honor, since the primary purpose of this investigation is to obtain testimony or to obtain evidence so that indictments might be filed or voted upon, might I suggest . . . that you include a clause in the sentence that if Mr. Pappadio does answer the questions as directed, that a further application may be made to your Honor to reconsider this sentence, so that we will have some coercive effect on Mr. Pappadio.
  “The Court: Yes, I shall adopt the proposal presented by Assistant United States Attorney Lawler, and my decision shall be deemed to include a provision reading in the form and manner proposed . . . .” The Assistant United States Attorney again stressed the coercive function of the sentences when opposing applications for bail pending appeal by both Shillitani and Pappadio.
  On the contrary, a criminal contempt proceeding would be characterized by the imposition of an unconditional sentence for punishment or deterrence. See Cheff v. Schnackenberg, post, at 377.
  The court may also impose a determinate sentence which includes a purge clause. This type of sentence would benefit an incorrigible witness. It raises none of the problems surrounding a judicial command that unless the witness testifies within a specified time he will be imprisoned for a term of years. See Reina v. United States, 364 U. S. 507 (1960).
  See Parker v. United States, 153 F. 2d 66, 70 (C. A. 1st Cir. 1946).
  By the same token, the sentences of imprisonment may be continued or reimposed if the witnesses adhere to their refusal to testify before a successor grand jury.
  This doctrine further requires that the trial judge first consider the feasibility of coercing testimony through the imposition of civil contempt. The judge should resort to criminal sanctions only after he determines, for good reason, that the civil remedy would be inappropriate.