opinion: Mr. Justice Marshall
  delivered the opinion of the Court.
  Edward McNeil was convicted of two assaults in 1966, and sentenced to five years’ imprisonment. Instead of committing him to prison, the sentencing court referred him to the Patuxent Institution for examination, to determine whether he should be committed Jo that institution for an indeterminate term under.Maryland’s Defective Delinquency Law. Md. Ann. Code, Art, 31B (1971). No such determination has yet been made, his sentence has expired, and his confinement continues. The State contends that he has refused to cooperate with the examining psychiatrists,: that they have been unable to make •any valid assessment of his condition, and that consequently he may be confined indefinitely until he cooperates and the institution has succeeded in making its evaluation. . He claims that when his sentence expired, the State lost its power to hold him, and that his continued detention violates his rights under the Fourteenth Amendment. We agree.
  I
  The Maryland Defective Delinquency Law provides that a person convicted of any felony; or certain misdemeanors, may be committed to the Patuxent Institution for an indeterminate period, if it is judicially determined that he is a “defective delinquent.” A defective delinquent is defined as
  “an individual who, by the demonstration of persistent aggravated antisocial or criminal behavior," evidences a propensity toward criminal activity, and who is found to have either such intellectual deficiency or emotional unbalance, or both, as to clearly demonstrate an actual. danger to society so as to require such confinement and treatment, when appropriate, as may make it reasonably safe for society . to terminate the confinement and treatment.” Md. Ann. Code, Art. 31B, § 5.
  Defective-delinquency proceedings are ordinarily, instituted immediately after conviction and sentencing; they may also be instituted after the defendant has served part of his prison-term. §§ 6 (b),'6 (c). In either event, the process begins with a court order committing the prisoner to Patuxent for a psychiatric examination. §§ 6 (b), 6 (d). The institution is required to submit its report to the court within a fixed period of time. § 7 (a). If the report recommends commitment, then a hearing must be promptly held, with a jury trial if requested by' the prisoner, to determine whether he should be committed as a defective delinquent. § 8. If he is so committed, then the commitment. operates to suspend the prison sentence previously imposed. § 9 (b).
  In Murel v. Baltimore City Criminal Court, post, p. 355, several prisoners who had been committed as defective delinquents sought to challenge various aspects of the criteria and procedures that resulted in- their commitment; we granted certiorari in that case together . with this one, in order to consider together these challenges to . the Maryland statutory scheme. For various reasons we decline today to reach those questions, see Mur el, supra. But Edward McNeil presents a much more stark and simple claim. He has never been committed as a defective delinquent, and thus he has no cause to challenge the criteria and procedures that control a defective-delinquency hearing. His confinement rests wholly on the order committing him for examination, in preparation for such a commitment hearing. That order was made, not on the basis of an adversary hearing, but on the basis of an ex parte judicial determination that there was “reasonable cause to believe that the Defendant may' be a Defective Delinquent.” Petitioner does not challenge in this - Court the power of the sentencing court to issue such an order in the first instance, but he contends' that the State’s power to hold him on the basis of that order has expired. He filed a petition for state post-convictión relief on this ground, inter alia, pursuant to Md. Ann. Code, Art. 27, § 645A.-The trial court denied relief,, holding that “[a] person referred to Patuxent -under Section 6, Article 31B for the purpose of determining whether or not he is a defective- delinquent ,may be detained in Patuxent until the procedures for. such determination have been completed regardless of whether or not the criminal sentence has expired.” App. 35-36. The Court of Appeals of Maryland denied leave to appeal. App. 37-38. We granted certiorari, 404 U. S. 999 (1971).
  II
  The State of Maryland asserts the power to confine petitioner indefinitely, without ever obtaining a judicial determination that such confine'ment is warranted. Respondent advances several distinct arguments in support of that claim.
  A. First, respondent contends that petitioner has been committed merely for observation,, and that a commitment for observation need not be surrounded by the procedural safeguards (such as an adversary hearing) that are appropriate for a final determination of defective delinquency. Were .the commitment for observation limited in duration to a brief period, the argument might have some force. But petitioner has been committed “for observation” for' six years, and on respondent's theory of his confinement there is no reason to believe it likely that he will ever be released. A confinement that is in fact indeterminate cannot rest on procedures designed to authorize .a brief period of observation.
  We recently rejected a similar argument in Jackson v. Indiana, 406 U. S. 715 (1972), when the State sought to confine indefinitely a defendant who was mentally incompetent to stand trial on his criminal charges. The State sought to characterize the commitment as temporary, and on that basis to justify reduced substantive and procedural safeguards. We held that because the commitment was permanent in its practical effect, it required safeguards commensurate with a long-term commitment. Id., at 723-730. The other half, of' the Jackson argument is equally relevant here. If the- commitment is properly regarded as a short-term confinement with a limited purpose, as the respondent suggests, then lesser safeguards may be appropriate, büt by the same token, the duration of the confinement must be strictly limited. “[D]ue process'requires .that the nature and duration of commitment bear some reasonable relation to the purpose for which the individual is committed.” Id., at 738. Just as that principle limits the permissible length of a commitment on account of incompetence to stand trial, so it also limits the permissible length of a commitment “for observation.” We need not set a precise time limit here; it is noteworthy, however, that the Maryland statute itself limits the observation period to. a maximum of six months. While the state courts have apparently construed the statute to permit extensions of time, see n. 2, supra, nevertheless the initial legislative judgment provides a useful benchmark. In this case it is sufficient to note that the petitioner has been confined for six years, and there is no basis for anticipating that he will ever be easier to examine than he is today. In these circumstances, it is a denial of due process to continue to hold him on the basis of an ex parte order committing him for observation.
  B. A second argument advanced by the respondent relies on the claim that petitioner himself prevented the State from holding a hearing on his condition. Respondent contends that, by refusing to talk to the psychiatrists, petitioner has prevented them from evaluating him, and has made it impossible for the State to go forward with evidence at a hearing. Thus, it is argued, his continued confinement is analogous to civil contempt; he can terminate the confinement and bring about a hearing at any time by talking to the examining psychiatrists, and the State has the power to induce his cooperation by confining him.
  Petitioner claims that he has a right under the Fifth Amendment to withhold cooperation, a-claim we need not consider here. But putting that claim to one side, there is nevertheless a fatal flaw in the respondent’s argument. For if confinement is to rest on a theory of civil contempt, then due process requires a hearing to determine whether petitioner has in fact behaved in a manner that amounts to. contempt. At such a hearing it could be ascertained whether petitioner’s conduct is- willful, or whether it is a manifestation of mental illness, for which he Cannot fairly be held responsible. Robinson v. California, 370 U. S. 660 (1962). Civil contempt is coercive in nature, and consequently, there is no justification for confining ón a civil contempt theory a person who lacks the present ability to comply. Maggio v. Zeitz, 333 U. S. 56 (1948). Moreover, a hearing would provide the appropriate forum for resolution of petitioner’s Fifth Amendment claim. Finally, if the petitioner’s confinement were explicitly premised on a finding of contempt, then it would be appropriate to consider what limitations the Due Process Clause places on the contempt power. The precise contours of that power need not be traced here. It is enough to note that petitioner has been confined; potentially for life, although he has never been determined to be in contempt by a procedure that comports with due process. The contempt analogy cannot justify the State’s failure to provide a hearing of any kind.
  C. Finally, respondent suggests that petitioner is probably a defective delinquent, because' most noneooperators are. Hence, it is argued; his confinement rests not only on the purposes of observation, and of penalizing contempt, but also on the underlying purposes of the Defective Delinquency Law. But that argument proves too much. For if the Patuxent staff members were prepared to conclude, on the basis of petitioner’s silence and their observations of him over the years, that petitioner is a defective delinquent, then it is not true that he has prevented them from evaluating him". On that theory, they have long been ready to make their report to the court, and the hearing on defective' delinquency could' have gone forward.
  Ill
  ' Petitioner is presently confined, in Patuxent without ■any lawful authority to support that confinement. His sentence having expired, he is no longer within the class of persons eligible for commitment to thé Institution as a defective delinquent. Accordingly, he is entitled to be released. The judgment below is reversed, ánd the mandate shall issue forthwith.
  D , Reversed.
  But not after he Has served all of it. The statute has always provided that no examination may be ordered or held if the person has been released from" custody; since 1971 it has also prohibited the examination if the person is within six months of the expiration of sentence, §6 (c), as amended in 1971. The State asserts that about 98% of the referrals to Patuxent are made immediately after conviction. Tr. of Oral Arg. 27; see Respondent’s Brief 82 n. 33.
  The statute originally required the report to be submitted within six months, or before expiration of sentence, whichever later occurs. Since 1971, it has required a report within six months, or three months before expiration of sentence, whichever first occurs. § 7 (a), as amended in-1971. The state courts have construed the statute to permit extension of the allowable time, however, in the case of a noncooperative defendant' who resists examination: State v. Musgrove, 241 Md. 521, 217 A. 2d 247 (1966); Mullen v. Director, 6 Md. App. 120, 250 A. 2d 281 (1969).
  Brief for Petitioner 6 n. 5; see Art. 31B, § 6 (b): request for examination' is máde to court “on any knowledge or suspicion of the presence of defective delinquency in such person.” It appears that in this case the trial court issued the order sua sponte; prior to sentencing, the court had- ordered a psychiatric ¿valuation by its own medical officer, who in turn recommended referral to Patuxent for further evaluation and treatment.
choices: attorney general of the United States, or his office specified state board or department of education city, town, township, village, or borough government or governmental unit state commission, board, committee, or authority county government or county governmental unit, except school district court or judicial district state department or agency governmental employee or job applicant female governmental employee or job applicant minority governmental employee or job applicant minority female governmental employee or job applicant not listed among agencies in the first Administrative Action variable retired or former governmental employee U.S. House of Representatives interstate compact judge state legislature, house, or committee local governmental unit other than a county, city, town, township, village, or borough governmental official, or an official of an agency established under an interstate compact state or U.S. supreme court local school district or board of education U.S. Senate U.S. senator foreign nation or instrumentality state or local governmental taxpayer, or executor of the estate of state college or university United States State person accused, indicted, or suspected of crime advertising business or agency agent, fiduciary, trustee, or executor airplane manufacturer, or manufacturer of parts of airplanes airline distributor, importer, or exporter of alcoholic beverages alien, person subject to a denaturalization proceeding, or one whose citizenship is revoked American Medical Association National Railroad Passenger Corp. amusement establishment, or recreational facility arrested person, or pretrial detainee attorney, or person acting as such;includes bar applicant or law student, or law firm or bar association author, copyright holder bank, savings and loan, credit union, investment company bankrupt person or business, or business in reorganization establishment serving liquor by the glass, or package liquor store water transportation, stevedore bookstore, newsstand, printer, bindery, purveyor or distributor of books or magazines brewery, distillery broker, stock exchange, investment or securities firm construction industry bus or motorized passenger transportation vehicle business, corporation buyer, purchaser cable TV car dealer person convicted of crime tangible property, other than real estate, including contraband chemical company child, children, including adopted or illegitimate religious organization, institution, or person private club or facility coal company or coal mine operator computer business or manufacturer, hardware or software consumer, consumer organization creditor, including institution appearing as such; e.g., a finance company person allegedly criminally insane or mentally incompetent to stand trial defendant debtor real estate developer disabled person or disability benefit claimant distributor person subject to selective service, including conscientious objector drug manufacturer druggist, pharmacist, pharmacy employee, or job applicant, including beneficiaries of employer-employee trust agreement, employee health and welfare fund, or multi-employer pension plan electric equipment manufacturer electric or hydroelectric power utility, power cooperative, or gas and electric company eleemosynary institution or person environmental organization employer. If employer's relations with employees are governed by the nature of the employer's business (e.g., railroad, boat), rather than labor law generally, the more specific designation is used in place of Employer. farmer, farm worker, or farm organization father female employee or job applicant female movie, play, pictorial representation, theatrical production, actor, or exhibitor or distributor of fisherman or fishing company food, meat packing, or processing company, stockyard foreign (non-American) nongovernmental entity franchiser franchisee lesbian, gay, bisexual, transexual person or organization person who guarantees another's obligations handicapped individual, or organization of devoted to health organization or person, nursing home, medical clinic or laboratory, chiropractor heir, or beneficiary, or person so claiming to be hospital, medical center husband, or ex-husband involuntarily committed mental patient Indian, including Indian tribe or nation insurance company, or surety inventor, patent assigner, trademark owner or holder investor injured person or legal entity, nonphysically and non-employment related juvenile government contractor holder of a license or permit, or applicant therefor magazine male medical or Medicaid claimant medical supply or manufacturing co. racial or ethnic minority employee or job applicant minority female employee or job applicant manufacturer management, executive officer, or director, of business entity military personnel, or dependent of, including reservist mining company or miner, excluding coal, oil, or pipeline company mother auto manufacturer newspaper, newsletter, journal of opinion, news service radio and television network, except cable tv nonprofit organization or business nonresident nuclear power plant or facility owner, landlord, or claimant to ownership, fee interest, or possession of land as well as chattels shareholders to whom a tender offer is made tender offer oil company, or natural gas producer elderly person, or organization dedicated to the elderly out of state noncriminal defendant political action committee parent or parents parking lot or service patient of a health professional telephone, telecommunications, or telegraph company physician, MD or DO, dentist, or medical society public interest organization physically injured person, including wrongful death, who is not an employee pipe line company package, luggage, container political candidate, activist, committee, party, party member, organization, or elected official indigent, needy, welfare recipient indigent defendant private person prisoner, inmate of penal institution professional organization, business, or person probationer, or parolee protester, demonstrator, picketer or pamphleteer (non-employment related), or non-indigent loiterer public utility publisher, publishing company radio station racial or ethnic minority person or organization protesting racial or ethnic segregation or discrimination racial or ethnic minority student or applicant for admission to an educational institution realtor journalist, columnist, member of the news media resident restaurant, food vendor retarded person, or mental incompetent retired or former employee railroad private school, college, or university seller or vendor shipper, including importer and exporter shopping center, mall spouse, or former spouse stockholder, shareholder, or bondholder retail business or outlet student, or applicant for admission to an educational institution taxpayer or executor of taxpayer's estate, federal only tenant or lessee theater, studio forest products, lumber, or logging company person traveling or wishing to travel abroad, or overseas travel agent trucking company, or motor carrier television station union member unemployed person or unemployment compensation applicant or claimant union, labor organization, or official of veteran voter, prospective voter, elector, or a nonelective official seeking reapportionment or redistricting of legislative districts (POL) wholesale trade wife, or ex-wife witness, or person under subpoena network slave slave-owner bank of the united states timber company u.s. job applicants or employees Army and Air Force Exchange Service Atomic Energy Commission Secretary or administrative unit or personnel of the U.S. Air Force Department or Secretary of Agriculture Alien Property Custodian Secretary or administrative unit or personnel of the U.S. Army Board of Immigration Appeals Bureau of Indian Affairs Bonneville Power Administration Benefits Review Board Civil Aeronautics Board Bureau of the Census Central Intelligence Agency Commodity Futures Trading Commission Department or Secretary of Commerce Comptroller of Currency Consumer Product Safety Commission Civil Rights Commission Civil Service Commission, U.S. Customs Service or Commissioner of Customs Defense Base Closure and REalignment Commission Drug Enforcement Agency Department or Secretary of Defense (and Department or Secretary of War) Department or Secretary of Energy Department or Secretary of the Interior Department of Justice or Attorney General Department or Secretary of State Department or Secretary of Transportation Department or Secretary of Education U.S. Employees' Compensation Commission, or Commissioner Equal Employment Opportunity Commission Environmental Protection Agency or Administrator Federal Aviation Agency or Administration Federal Bureau of Investigation or Director Federal Bureau of Prisons Farm Credit Administration Federal Communications Commission (including a predecessor, Federal Radio Commission) Federal Credit Union Administration Food and Drug Administration Federal Deposit Insurance Corporation Federal Energy Administration Federal Election Commission Federal Energy Regulatory Commission Federal Housing Administration Federal Home Loan Bank Board Federal Labor Relations Authority Federal Maritime Board Federal Maritime Commission Farmers Home Administration Federal Parole Board Federal Power Commission Federal Railroad Administration Federal Reserve Board of Governors Federal Reserve System Federal Savings and Loan Insurance Corporation Federal Trade Commission Federal Works Administration, or Administrator General Accounting Office Comptroller General General Services Administration Department or Secretary of Health, Education and Welfare Department or Secretary of Health and Human Services Department or Secretary of Housing and Urban Development Interstate Commerce Commission Indian Claims Commission Immigration and Naturalization Service, or Director of, or District Director of, or Immigration and Naturalization Enforcement Internal Revenue Service, Collector, Commissioner, or District Director of Information Security Oversight Office Department or Secretary of Labor Loyalty Review Board Legal Services Corporation Merit Systems Protection Board Multistate Tax Commission National Aeronautics and Space Administration Secretary or administrative unit of the U.S. Navy National Credit Union Administration National Endowment for the Arts National Enforcement Commission National Highway Traffic Safety Administration National Labor Relations Board, or regional office or officer National Mediation Board National Railroad Adjustment Board Nuclear Regulatory Commission National Security Agency Office of Economic Opportunity Office of Management and Budget Office of Price Administration, or Price Administrator Office of Personnel Management Occupational Safety and Health Administration Occupational Safety and Health Review Commission Office of Workers' Compensation Programs Patent Office, or Commissioner of, or Board of Appeals of Pay Board (established under the Economic Stabilization Act of 1970) Pension Benefit Guaranty Corporation U.S. Public Health Service Postal Rate Commission Provider Reimbursement Review Board Renegotiation Board Railroad Adjustment Board Railroad Retirement Board Subversive Activities Control Board Small Business Administration Securities and Exchange Commission Social Security Administration or Commissioner Selective Service System Department or Secretary of the Treasury Tennessee Valley Authority United States Forest Service United States Parole Commission Postal Service and Post Office, or Postmaster General, or Postmaster United States Sentencing Commission Veterans' Administration War Production Board Wage Stabilization Board General Land Office of Commissioners Transportation Security Administration Surface Transportation Board U.S. Shipping Board Emergency Fleet Corp. Reconstruction Finance Corp. Department or Secretary of Homeland Security Unidentifiable International Entity