Mr. Justice Rehnquist
delivered the opinion of the Court.
Over the past five Terms, this Court has in several decisions considered constitutional challenges to prison conditions or practices by convicted prisoners. This case requires us to examine the constitutional rights of pretrial detainees — those persons who have been charged with a crime but who have not yet been tried on the charge. The parties concede that to ensure their presence at trial, these persons legitimately may be incarcerated by the Government prior to a determination of their guilt or innocence, infra, at 533-535, and n. 15; see 18 U. S. C. §§ 3146, 3148, and it is the scope of their rights during this period of confinement prior to trial that is the primary focus of this case.
This lawsuit was brought as a class action in the United States District Court for the Southern District of New York to challenge numerous conditions of confinement and practices at the Metropolitan Correctional Center (MCC), a federally operated short-term custodial facility in New York City designed primarily to house pretrial detainees. The District Court, in the words of the Court of Appeals for the Second Circuit, “intervened broadly into almost every facet of the institution” and enjoined no fewer than 20 MCC practices on constitutional and statutory grounds. The Court ' of Appeals largely affirmed the District Court’s constitutional rulings and in the process held that under the Due Process Clause of the Fifth Amendment, pretrial detainees may “be subjected to only those 'restrictions and privations’ which 'inhere in their confinement itself or which are justified by compelling necessities of jail administration.’ ” Wolfish v. Levi, 573 F. 2d 118, 124 (1978), quoting Rhem v. Malcolm, 507 F. 2d 333, 336 (CA2 1974). We granted certiorari to consider the important constitutional questions raised by these decisions and to resolve an apparent conflict among the Circuits. 439 U. S. 816 (1978). We now reverse.
I
The MCC was constructed in 1975 to replace the converted waterfront garage on West Street that had served as New York City’s federal jail since 1928. It is located adjacent to the Foley Square federal courthouse and has as its primary objective the housing of persons who are being detained in custody prior to trial for federal criminal offenses in the United States District Courts for the Southern and Eastern Districts of New York and for the District of New Jersey. Under the Bail Reform Act, 18 U. S. C. § 3146, a person in the federal system is committed to a detention facility only because no other less drastic means can reasonably ensure his presence at trial. In addition to pretrial detainees, the MCC also houses some convicted inmates who are awaiting sentencing or transportation to federal prison or who are serving generally relatively short sentences in a service capacity at the MCC, convicted prisoners who have been lodged at the facility under writs of habeas corpus ad prosequendum or ad testificandum issued to ensure their presence at upcoming trials, witnesses in protective custody, and persons incarcerated for contempt.
The MCC differs markedly from the familiar image of a jail; there are no barred cells, dank, colorless corridors, or clanging steel gates. It was intended to include the most advanced and innovative features of modern design of detention facilities. As the Court of Appeals stated: “{I]t represented the architectural embodiment of the best and most progressive penological planning.” 573 F. 2d, at 121. The key design element of the 12-story structure is the “modular” or “unit” concept, whereby each floor designed to house inmates has one or two largely self-contained residential units that replace the traditional cellblock jail construction. Each unit in turn has several clusters or corridors of private rooms or dormitories radiating from a central 2-story “multipurpose” or common room, to which each inmate has free access approximately 16 hours a day. Because our analysis does not turn on the particulars of the MCC concept or design, we need not discuss them further.
When the MCC opened in August 1975, the planned capacity was 449 inmates, an increase of 50% over the former West Street facility. Id., at 122. Despite some dormitory accommodations, the MCC was designed primarily to house these inmates in 389 rooms, which originally were intended for single occupancy. While the MCC was under construction, however, the number of persons committed to pretrial detention began to rise at an “unprecedented” rate. Ibid. The Bureau of Prisons took several steps to accommodate this unexpected flow of persons assigned to the facility, but despite these efforts, the inmate population at the MCC rose above its planned capacity within a short time after its opening. To provide sleeping space for this increased population, the MCC replaced the single bunks in many of the individual rooms and dormitories with double bunks. Also, each week some newly arrived inmates had to sleep on cots in the common areas until they could be transferred to residential rooms as space became available. See id., at 127-128.
On November 28, 1975, less than four months after the MCC had opened, the named respondents initiated this action by filing in the District Court a petition for a writ of habeas corpus. The District Court certified the case as a class action on behalf of all persons confined at the MCC, pretrial detainees and sentenced prisoners alike. The petition served up a veritable potpourri of complaints that implicated virtually every facet of the institution’s conditions and practices. Respondents charged, inter alia, that they had been deprived of their statutory and constitutional rights because of overcrowded conditions, undue length of confinement, improper searches, inadequate recreational, educational, and employment opportunities, insufficient staff, and objectionable restrictions on the purchase and receipt of personal items and books.
In two opinions and a series of orders, the District Court enjoined numerous MCC practices and conditions. With respect to pretrial detainees, the court held that because they are “presumed to be innocent and held only to ensure their presence at trial, 'any deprivation or restriction of . . . rights beyond those which are necessary for confinement alone, must be justified by a compelling necessity.’ ” United States ex rel. Wolfish v. Levi, 439 F. Supp. 114, 124 (1977), quoting Detainees of Brooklyn House of Detention v. Malcolm, 520 F. 2d 392, 397 (CA2 1975). And while acknowledging that the rights of sentenced inmates are to be measured by the different standard of the Eighth Amendment, the court declared that to house “an inferior minority of persons ... in ways found unconstitutional for the rest” would amount to cruel and unusual punishment. United States ex rel. Wolfish v. United States, 428 F. Supp. 333, 339 (1977).
Applying these standards on cross-motions for partial summary judgment, the District Court enjoined the practice of housing two inmates in the individual rooms and prohibited enforcement of the so-called “publisher-only” rule, which at the time of the court’s ruling prohibited the receipt of all books and magazines mailed from outside the MCC except those sent directly from a publisher or a book club. After a trial on the remaining issues, the District Court enjoined, inter alia, the doubling of capacity in the dormitory areas, the use of the common rooms to provide temporary sleeping accommodations, the prohibition against inmates’ receipt of packages containing food and items of personal property, and the practice of requiring inmates to expose their body cavities for visual inspection following contact visits. The court also granted relief in favor of pretrial detainees, but not convicted inmates, with respect to the requirement that detainees remain outside their rooms during routine inspections by MCC officials.
The Court of Appeals largely affirmed the District Court’s rulings, although it rejected that court’s Eighth Amendment analysis of conditions of confinement for convicted prisoners because the “parameters of judicial intervention into . . . conditions ... for sentenced prisoners are more restrictive than in the case of pretrial detainees.” 573 F. 2d, at 125. Accordingly, the court remanded the matter to the District Court for it to determine whether the housing for sentenced inmates at the MCC was constitutionally “adequate.” But the Court of Appeals approved the due process standard employed by the District Court in enjoining the conditions of pretrial confinement. It therefore held that the MCC had failed to make a showing of “compelling necessity” sufficient to justify housing two pretrial detainees in the individual rooms. Id., at 126-127. And for purposes of our review (since petitioners challenge only some of the Court of Appeals’ rulings), the court affirmed the District Court’s granting of relief against the “publisher-only” rule, the practice of conducting body-cavity searches after contact visits, the prohibition against receipt of packages of food and personal items from outside the institution, and the requirement that detainees remain outside their rooms during routine searches of the rooms by MCC officials. Id., at 129-132.
II
As a first step in our decision, we shall address “double-bunking” as it is referred to by the parties, since it is a condition of confinement that is alleged only to deprive pretrial detainees of their liberty without due process of law in contravention of the Fifth Amendment. We will treat in order the Court of Appeals’ standard of review, the analysis which we believe the Court of Appeals should have employed, and the conclusions to which our analysis leads us in the case of “double-bunking.”
A
The Court of Appeals did not dispute that the Government may permissibly incarcerate a person charged with a crime but not yet convicted to ensure his presence at trial. However, reasoning from the “premise that an individual is to be treated as innocent until proven guilty,” the court concluded that pretrial detainees retain the “rights afforded unincar-cerated individuals,” and that therefore it is not sufficient that the conditions of confinement for pretrial detainees “merely comport with contemporary standards of decency prescribed by the cruel and unusual punishment clause of the eighth amendment.” 573 F. 2d, at 124. Rather, the court held, the Due Process Clause requires that pretrial detainees “be subjected to only those 'restrictions and privations’ which ‘inhere in their confinement itself or which are justified by compelling necessities of jail administration.’ ” Ibid., quoting Rhem v. Malcolm, 507 F. 2d, at 336. Under the Court of Appeals’ “compelling necessity” standard, “deprivation of the rights of detainees cannot be justified by the cries of fiscal necessity, . . . administrative convenience, ... or by the cold comfort that conditions in other jails are worse.” 573 F. 2d, at 124. The court acknowledged, however, that it could not “ignore” our admonition in Procunier v. Martinez, 416 U. S. 396, 405 (1974), that “courts are ill equipped to deal with the increasingly urgent problems of prison administration,” and concluded that it would “not [be] wise for [it] to second-guess the expert administrators on matters on which they are better informed.” 573 F. 2d, at 124.
Our fundamental disagreement with the Court of Appeals is that we fail to find a source in the Constitution for its compelling-necessity standard. Both the Court of Appeals and the District Court seem to have relied on the “presumption of innocence” as the source of the detainee’s substantive right to be free from conditions of confinement that are not justified by compelling necessity. 573 F. 2d, at 124; 439 F. Supp., at 124; accord, Campbell v. McGruder, 188 U. S. App. D. C. 258, 266, 580 F. 2d 521, 529 (1978); Detainees of Brooklyn House of Detention v. Malcolm, 520 F. 2d 392, 397 (CA2 1975) ; Rhem v. Malcolm, supra, at 336. But see Feeley v. Sampson, 570 F. 2d 364, 369 n. 4 (CA1 1978); Hampton v. Holmesburg Prison Officials, 546 F. 2d 1077, 1080 n. 1 (CA3 1976). But the presumption of innocence provides no support for such a rule.
The presumption of innocence is a doctrine that allocates the burden of proof in criminal trials; it also may serve as an admonishment to the jury to judge an accused’s guilt or innocence solely on the evidence adduced at trial and not on the basis of suspicions that may arise from the fact of his arrest, indictment, or custody, or from other matters not introduced as proof at trial. Taylor v. Kentucky, 436 U. S. 478, 485 (1978); see Estelle v. Williams, 425 U. S. 501 (1976); In re Winship, 397 U. S. 358 (1970); 9 J. Wigmore, Evidence § 2511 (3d ed. 1940). It is “an inaccurate, shorthand description of the right of the accused to 'remain inactive and secure, until the prosecution has taken up its burden and produced evidence and effected persuasion; . . .’ an ‘assumption’ that is indulged in the absence of contrary evidence.” Taylor v. Kentucky, supra, at 484 n. 12. Without question, the presumption of innocence plays an important role in our criminal justice system. “The principle that there is a presumption of innocence in favor of the accused is the undoubted law, axiomatic and elementary, and its enforcement lies at the foundation of the administration of our criminal law.” Coffin v. United States, 156 U. S. 432, 453 (1895). But it has no application to a determination of the rights of a pretrial detainee during confinement before his trial has even begun.
The Court of Appeals also relied on what it termed the “indisputable rudiments of due process” in fashioning its compelling-necessity test. We do not doubt that the Due Process Clause protects a detainee from certain conditions and restrictions of pretrial detainment. See infra, at 535-540. Nonetheless, that Clause provides no basis for application of a compelling-necessity standard to conditions of pretrial confinement that are not alleged to infringe any other, more specific guarantee of the Constitution.
It is important to focus on what is at issue here. We are not concerned with the initial decision to detain an accused and the curtailment of liberty that such a decision necessarily entails. See Gerstein v. Pugh, 420 U. S. 103, 114 (1975) ; United States v. Marion, 404 U. S. 307, 320 (1971). Neither respondents nor the courts below question that the Government may permissibly detain a person suspected of committing a crime prior to a formal adjudication of guilt. See Gerstein v. Pugh, supra, at 111-114. Nor do they doubt that the Government has a substantial interest in ensuring that persons accused of crimes are available for trials and, ultimately, for service of their sentences, or that confinement of such persons pending trial is a legitimate means of furthering that interest. Tr. of Oral Arg. 27; see Stack v. Boyle, 342 U. S. 1, 4 (1951). Instead, what is at issue when an aspect of pretrial detention that is not alleged to violate any express guarantee of the Constitution is challenged, is the detainee’s right to be free from punishment, see infra, at 535-537, and his understandable desire to be as comfortable as possible during his confinement, both of which may conceivably coalesce at some point. It seems clear that the Court of Appeals did not rely on the detainee’s right to be free from punishment, but even if it had that right does not warrant adoption of that court’s compelling-necessity test. See infra, at 535-540. And to the extent the court relied on the detainee’s desire to be free from discomfort, it suffices to say that this desire simply does not rise to the level of those fundamental liberty interests delineated in cases such as Roe v. Wade, 410 U. S. 113 (1973) ; Eisenstadt v. Baird, 405 U. S. 438 (1972); Stanley v. Illinois, 405 U. S. 645 (1972); Griswold v. Connecticut, 381 U. S. 479 (1965); Meyer v. Nebraska, 262 U. S. 390 (1923).
B
In evaluating the constitutionality of conditions or restrictions of pretrial detention that implicate only the protection against deprivation of liberty without due process of law, we think that the proper inquiry is whether those conditions amount to punishment of the detainee. For under the Due Process Clause, a detainee may not be punished prior to an adjudication of guilt in accordance with due process of law. See Ingraham v. Wright, 430 U. S. 651, 671-672 n. 40, 674 (1977); Kennedy v. Mendoza-Martinez, 372 U. S. 144, 165-167, 186 (1963); Wong Wing v. United States, 163 U. S. 228, 237 (1896). A person lawfully committed to pretrial detention has not been adjudged guilty of any crime. He has had only a “judicial determination of probable cause as a prerequisite to [the] extended restraint of [his] liberty following arrest.” Gerstein v. Pugh, supra, at 114; see Virginia v. Paul, 148 U. S. 107, 119 (1893). And, if he is detained for a suspected violation of a federal law, he also has had a bail hearing. See 18 U. S. C. §§ 3146, 3148. Under such circumstances, the Government concededly may detain him to ensure his presence at trial and may subject him to the restrictions and conditions of the detention facility so long as those conditions and restrictions do not amount to punishment, or otherwise violate the Constitution.
Not every disability imposed during pretrial detention amounts to “punishment” in the constitutional sense, however. Once the Government has exercised its conceded authority to detain a person pending trial, it obviously is entitled to employ devices that are calculated to effectuate this detention. Traditionally, this has meant confinement in a facility which, no matter how modern or how antiquated, results in restricting the movement of a detainee in a manner in which he would not be restricted if he simply were free to walk the streets pending trial. Whether it be called a jail, a prison, or a custodial center, the purpose of the facility is to detain. Loss of freedom of choice and privacy are inherent incidents of confinement in such a facility. And the fact that such detention interferes with the detainee’s understandable desire to live as comfortably as possible and with as little restraint as possible during confinement does not convert the conditions or restrictions of detention into “punishment.”
This Court has recognized a distinction between punitive measures that may not constitutionally be imposed prior to a determination of guilt and regulatory restraints that may. See, e. g., Kennedy v. Mendoza-Martinez, supra, at 168; Flemming v. Nestor, 363 U. S. 603, 613-614 (1960); cf. DeVeau v. Braisted, 363 U. S. 144, 160 (1960). In Kennedy v. Mendoza-Martinez, supra, the Court examined the automatic forfeiture-of-citizenship provisions of the immigration laws to determine whether that sanction amounted to punishment or a mere regulatory restraint. While it is all but impossible to compress the distinction into a sentence or a paragraph, the Court there described the tests traditionally applied to determine whether a governmental act is punitive in nature:
“Whether the sanction involves an affirmative disability or restraint, whether it has historically been regarded as a punishment, whether it comes into play only on a finding of scienter, whether its operation will promote the traditional aims of punishment — retribution and deterrence, whether the behavior to which it applies is already a crime, whether an alternative purpose to which it may rationally be connected is assignable for it, and whether it appears excessive in relation to the alternative purpose assigned are all relevant to the inquiry, and may often point in differing directions.” 372 U. S., at 168-169 (footnotes omitted).
Because forfeiture of citizenship traditionally had been considered punishment and the legislative history of the forfeiture provisions “conclusively” showed that the measure was intended to be punitive, the Court held that forfeiture of citizenship in such circumstances constituted punishment that could not constitutionally be imposed without due process of law. Id., at 167-170, 186.
The factors identified in Mendoza-Martinez provide useful guideposts in determining whether particular restrictions and conditions accompanying pretrial detention amount to punishment in the constitutional sense of that word. A court must decide whether the disability is imposed for the purpose of punishment or whether it is but an incident of some other legitimate governmental purpose. See Flemming v. Nestor, supra, at 613-617. Absent a showing of an expressed intent to punish on the part of detention facility officials, that determination generally will turn on “whether an alternative purpose to which [the restriction] may rationally be connected is assignable for it, and whether it appears excessive in relation to the alternative purpose assigned [to it].” Kennedy v. Mendoza-Martinez, supra, at 168-169; see Flemming v. Nestor, supra, at 617. Thus, if a particular condition or restriction of pretrial detention is reasonably related to a legitimate governmental objective, it does not, without more, amount to “punishment.” Conversely, if a restriction or condition is not reasonably related to a legitimate goal — if it is arbitrary or purposeless — a court permissibly may infer that the purpose of the governmental action is punishment that may not constitutionally be inflicted upon detainees qua detainees. See ibid. Courts must be mindful that these inquiries spring from constitutional requirements and that judicial answers to them must reflect that fact rather than a court’s idea of how best to operate a detention facility. Cf. United States v. Lovasco, 431 U. S. 783, 790 (1977); United States v. Russell, 411 U. S. 423, 435 (1973).
One further point requires discussion. The petitioners assert, and respondents concede, that the “essential objective of pretrial confinement is to insure the detainees’ presence at trial.” Brief for Petitioners 43; see Brief for Respondents 33. While this interest undoubtedly justifies the original decision to confine an individual in some manner, we do not accept respondents’ argument that the Government’s interest in ensuring a detainee’s presence at trial is the only objective that may justify restraints and conditions once the decision is lawfully made to confine a person. “If the government could confine or otherwise infringe the liberty of detainees only to the extent necessary to ensure their presence at trial, house arrest would in the end be the only constitutionally justified form of detention.” Campbell v. McGruder, 188 U. S. App. D. C., at 266, 580 F. 2d, at 529. The Government also has legitimate interests that stem from its need to manage the facility in which the individual is detained. These legitimate operational concerns may require administrative measures that go beyond those that are, strictly speaking, necessary to ensure that the detainee shows up at trial. For example, the Government must be able to take steps to maintain security and order at the institution and make certain no weapons or illicit drugs reach detainees. Restraints that are reasonably related to the institution’s interest in maintaining jail security do not, without more, constitute unconstitutional punishment, even if they are discomforting and are restrictions that the detainee would not have experienced had he been released while awaiting trial. We need not here attempt to detail the precise extent of the legitimate governmental interests that may justify conditions or restrictions of pretrial detention. It is enough simply to recognize that in addition to ensuring the detainees’ presence at trial, the effective management of the detention facility once the individual is confined is a valid objective that may justify imposition of conditions and restrictions of pretrial detention and dispel any inference that such restrictions are intended as punishment.
c
Judged by this analysis, respondents’ claim that “double-bunking” violated their due process rights fails. Neither the District Court nor the Court of Appeals intimated that it considered “double-bunking” to constitute punishment; instead, they found that it contravened the compelling-necessity test, which today we reject. On this record, we are convinced as a matter of law that “double-bunking” as practiced at the MCC did not amount to punishment and did not, therefore, violate respondents’ rights under the Due Process Clause of the Fifth Amendment.
Each of the rooms at the MCC that house pretrial detainees has a total floor space of approximately 75 square feet. Each of them designated for “double-bunking,” see n. 4, supra, contains a double bunkbed, certain other items of furniture, a wash basin, and an uncovered toilet. Inmates generally are locked into their rooms from 11 p.m. to 6:30 a.m. and for brief periods during the afternoon and evening head counts. During the rest of the day, they may move about freely between their rooms and the common areas.
Based on affidavits and a personal visit to the facility, the District Court concluded that the practice of “double-bunking” was unconstitutional. The court relied on two factors for its conclusion: (1) the fact that the rooms were designed to house only one inmate, 428 F. Supp., at 336-337; and (2) its judgment that confining two persons in one room or cell of this size constituted a “fundamental denia[l] of decency, privacy, personal security, and, simply, civilized humanity . . . .” Id., at 339. The Court of Appeals agreed with the District Court. In response to petitioners’ arguments that the rooms at the MCC were larger and more pleasant than the cells involved in the cases relied on by the District Court, the Court of Appeals stated:
“ [W] e find the lack of privacy inherent in double-celling in rooms intended for one individual a far more compelling consideration than a comparison of square footage or the substitution of doors for bars, carpet for concrete, or windows for walls. The government has simply failed to show any substantial justification for double-celling.” 573 F. 2d, at 127.
We disagree with both the District Court and the Court of Appeals that there is some sort of “one man, one cell” principle lurking in the Due Process Clause of the Fifth Amendment. While confining a given number of people in a given amount of space in such a manner as to cause them to endure genuine privations and hardship over an extended period of time might raise serious questions under the Due Process Clause as to whether those conditions amounted to punishment, nothing even approaching such hardship is shown by this record.
Detainees are required to spend only seven or eight hours each day in their rooms, during most or all of which they presumably are sleeping. The rooms provide more than adequate space for sleeping. During the remainder of the time, the detainees are free to move between their rooms and the common area. While “double-bunking” may have taxed some of the equipment or particular facilities in certain of the common areas, United States ex rel. Wolfish v. United States, 428 F. Supp., at 337, this does not mean that the conditions at the MCC failed to meet the standards required by the Constitution. Our conclusion in this regard is further buttressed by the detainees’ length of stay at the MCC. See Hutto v. Finney, 437 U. S. 678, 686-687 (1978). Nearly all of the detainees are released within 60 days. See n. 3, supra. We simply do not believe that requiring a detainee to share toilet facilities and this admittedly rather small sleeping place with another person for generally a maximum period of 60 days violates the Constitution.
Ill
Respondents also challenged certain MCC restrictions and practices that were designed to promote security and order at the facility on the ground that these restrictions violated the Due Process Clause of the Fifth Amendment, and certain other constitutional guarantees, such as the First and Fourth Amendments. The Court of Appeals seemed to approach the challenges to security restrictions in a fashion different from the other contested conditions and restrictions. It stated that “once it has been determined that the mere fact of confinement of the detainee justifies the restrictions, the institution must be permitted to use reasonable means to insure that its legitimate interests in security are safeguarded.” 573 F. 2d, at 124. The court might disagree with the choice of means to effectuate those interests, but it should not “second-guess the expert administrators on matters on which they are better informed .... Concern with minutiae of prison administration can only distract the court from detached consideration of the one overriding question presented to it: does the practice or condition violate the Constitution?” Id., at 124—125. Nonetheless, the court affirmed the District Court’s injunction against several security restrictions. The court rejected the arguments of petitioners that these practices served the MCC’s interest in security and order and held that the practices were unjustified interferences with the retained constitutional rights of both detainees and convicted inmates. Id., at 129-132. In our view, the Court of Appeals failed to heed its own admonition not to “second-guess” prison administrators.
Our cases have established several general principles that inform our evaluation of the constitutionality of the restrictions at issue. First, we have held that convicted prisoners do not forfeit all constitutional protections by reason of their conviction and confinement in prison. See Jones v. North Carolina Prisoners’ Labor Union, 433 U. S. 119, 129 (1977); Meachum v. Fano, 427 U. S. 215, 225 (1976); Wolff v. McDonnell, 418 U. S. 539, 555-556 (1974); Pell v. Procunier, 417 U. S. 817, 822 (1974). “There is no iron curtain drawn between the Constitution and the prisons of this country.” Wolff v. McDonnell, supra, at 555-556. So, for example, our cases have held that sentenced prisoners enjoy freedom of speech and religion under the First and Fourteenth Amendments, see Pell v. Procunier, supra; Cruz v. Beto, 405 U. S. 319 (1972); Cooper v. Pate, 378 U. S. 546 (1964); that they are protected against invidious discrimination on the basis of race under the Equal Protection Clause of the Fourteenth Amendment, see Lee v. Washington, 390 U. S. 333 (1968); and that they may claim the protection of the Due Process Clause to prevent additional deprivation of life, liberty, or property without due process of law, see Meachum v. Fano, supra; Wolff v. McDonnell, supra. A fortiori, pretrial detainees, who have not been convicted of any crimes, retain at least those constitutional rights that we have held are enjoyed by convicted prisoners.
But our cases also have insisted on a second proposition: simply because prison inmates retain certain constitutional rights does not mean that these rights are not subject to restrictions and limitations. “Lawful incarceration brings about the necessary withdrawal or limitation of many privileges and rights, a retraction justified by the considerations underlying our penal system.” Price v. Johnston, 334 U. S. 266, 285 (1948); see Jones v. North Carolina Prisoners’ Labor Union, supra, at 125; Wolff v. McDonnell, supra, at 555; Pell v. Procunier, supra, at 822. The fact of confinement as well as the legitimate goals and policies of the penal institution limits these retained constitutional rights. Jones v. North Carolina Prisoners’ Labor Union, supra, at 125; Pell v. Procunier, supra, at 822. There must be a “mutual accommodation between institutional needs and objectives and the provisions of the Constitution that are of general application.” Wolff v. McDonnell, supra, at 556. This principle applies equally to pretrial detainees and convicted prisoners. A detainee simply does not possess the full range of freedoms of an unincarcerated individual.
Third, maintaining institutional security and preserving internal order and discipline are essential goals that may require limitation or retraction of the retained constitutional rights of both convicted prisoners and pretrial detainees. “[Cjentral to all other corrections goals is the institutional consideration of internal security within the corrections facilities themselves.” Pell v. Procunier, supra, at 823; see Jones v. North Carolina Prisoners’ Labor Union, supra, at 129; Procunier v. Martinez, 416 U. S. 396, 412 (1974). Prison officials must be free to take appropriate action to ensure the safety of inmates and corrections personnel and to prevent escape or unauthorized entry. Accordingly, we have held that even when an institutional restriction infringes a specific constitutional guarantee, such as the First Amendment, the practice must be evaluated in the light of the central objective of prison administration, safeguarding institutional security. Jones v. North Carolina Prisoners’ Labor Union, supra, at 129; Pell v. Procunier, supra, at 822, 826; Procunier v. Martinez, supra, at 412-414.
Finally, as the Court of Appeals correctly acknowledged, the problems that arise in the day-to-day operation of a corrections facility are not susceptible of easy solutions. Prison administrators therefore should be accorded wide-ranging deference in the adoption and execution of policies and practices that in their judgment are needed to preserve internal order and discipline and to maintain institutional security. Jones v. North Carolina Prisoners’ Labor Union, supra, at 128; Procunier v. Martinez, supra, at 404-405; Cruz v. Beto, supra, at 321; see Meachum v. Fano, 427 U. S., at 228-229. “Such considerations are peculiarly within the province and professional expertise of corrections officials, and, in the absence of substantial evidence in the record to indicate that the officials have exaggerated their response to these considerations, courts should ordinarily defer to their expert judgment in such matters.” Pell v. Procunier, 417 U. S., at 827. We further observe that, on occasion, prison administrators may be “experts” only by Act of Congress or of a state legislature. But judicial deference is accorded not merely because the administrator ordinarily will, as a matter of fact in a particular case, have a better grasp of his domain than the reviewing judge, but also because the operation of our correctional facilities is peculiarly the province of the Legislative and Executive Branches of our Government, not the Judicial. Procunier v. Martinez, supra, at 405; cf. Meachum v. Fano, supra, at 229. With these teachings of our cases in mind, we turn to an examination of the MCC security practices that are alleged to violate the Constitution.
A
At the time of the lower courts’ decisions, the Bureau of Prisons’ “publisher-only” rule, which applies to all Bureau facilities, permitted inmates to receive books and magazines from outside the institution only if the materials were mailed directly from the publisher or a book club. 573 F. 2d, at 129-130. The warden of the MCC stated in an affidavit that “serious” security and administrative problems were caused when bound items were received by inmates from unidentified sources outside the facility. App. 24. He noted that in order to make a “proper and thorough” inspection of such items, prison officials would have to remove the covers of hardback books and to leaf through every page of all books and magazines to ensure that drugs, money, weapons, or other contraband were not secreted in the material. “This search process would take a substantial and inordinate amount of available staff time.” Ibid. However, “there is relatively little risk that material received directly from a publisher or book club would contain contraband, and therefore, the security problems are significantly reduced without a drastic drain on staff resources.” Ibid.
The Court of Appeals rejected these security and administrative justifications and affirmed the District Court’s order enjoining enforcement of the “publisher-only” rule at the MCC. The Court of Appeals held that the rule “severely and impermissibly restricts the reading material available to inmates” and therefore violates their First Amendment and due process rights. 573 F. 2d, at 130.
It is desirable at this point to place in focus the precise question that now is before this Court. Subsequent to the decision of the Court of Appeals, the Bureau of Prisons amended its “publisher-only” rule to permit the receipt of books and magazines from bookstores as well as publishers and book clubs. 43 Fed. Reg. 30576 (1978) (to be codified in 28 CFR §540.71). In addition, petitioners have informed the Court that the Bureau proposes to amend the rule further to allow receipt of paperback books, magazines, and other soft-covered materials from any source. Brief for Petitioners 66 n. 49, 69, and n. 51. The Bureau regards hardback books as the “more dangerous source of risk to institutional security,” however, and intends to retain the prohibition against receipt of hardback books unless they are mailed directly from publishers, book clubs, or bookstores. Id.., at 69 n. 51. Accordingly, petitioners request this Court to review the District Court’s injunction only to the extent it enjoins petitioners from prohibiting receipt of hard-cover books that are not mailed directly from publishers, book clubs, or bookstores. Id., at 69; Tr. of Oral Arg. 59-60.
We conclude that a prohibition against receipt of hardback books unless mailed directly from publishers, book clubs, or bookstores does not violate the First Amendment rights of MCC inmates. That limited restriction is a rational response by prison officials to an obvious security problem. It hardly needs to be emphasized that hardback books are especially serviceable for smuggling contraband into an institution; money, drugs, and weapons easily may be secreted in the bindings. E. g., Woods v. Daggett, 541 F. 2d 237 (CA10 1976). They also are difficult to search effectively. There is simply no evidence in the record to indicate that MCC officials have exaggerated their response to this security problem and to the administrative difficulties posed by the necessity of carefully inspecting each book mailed from unidentified sources. Therefore, the considered judgment of these experts must control in the absence of prohibitions far more sweeping than those involved here. See Jones v. North Carolina Prisoners’ Labor Union, 433 U. S., at 128; Pell v. Procunier, 417 U. S., at 827.
Our conclusion that this limited restriction on receipt of hardback books does not infringe the First Amendment rights of MCC inmates is influenced by several other factors. The rule operates in a neutral fashion, without regard to the content of the expression. Id., at 828. And there are alternative means of obtaining reading material that have not been shown to be burdensome or insufficient. “[W]e regard the available ‘alternative means of [communication as] a relevant factor’ in a case such as this where ‘we [are] called upon to balance First Amendment rights against [legitimate] governmental . . . interests.’ ” Id., at 824, quoting Kleindienst v. Mandel, 408 U. S. 753, 765 (1972); see Cruz v. Beto, 405 U. S., at 321, 322 n. 2. The restriction, as it is now before us, allows soft-bound books and magazines to be received from any source and hardback books to be received from publishers, bookstores, and book clubs. In addition, the MCC has a “relatively large” library for use by inmates. United States ex rel. Wolfish v. United States, 428 F. Supp., at 340. To the limited extent the rule might possibly increase the cost of obtaining published materials, this Court has held that where “other avenues” remain available for the receipt of materials by inmates, the loss of “cost advantages does not fundamentally implicate free speech values.” See Jones v. North Carolina Prisoners’ Labor Union, supra, at 130-131. We are also ififluenced in our decision by the fact that the rule’s impact on pretrial detainees is limited to a maximum period of approximately 60 days. See n. 3, supra. In sum, considering all the circumstances, we view the rule, as we now find it, to be a “reasonable ‘time, place and manner’ regulatio[n that is] necessary to further significant governmental interests . . . .” Grayned v. City of Rockford, 408 U. S. 104, 115 (1972); see Cox v. New Hampshire, 312 U. S. 569, 575-576 (1941); Cox v. Louisiana, 379 U. S. 536, 554-555 (1965); Adderley v. Florida, 385 U. S. 39, 46-48 (1966).
B
Inmates at the MCC were not permitted to receive packages from outside the facility containing items of food or personal property, except for one package of food at Christmas. This rule was justified by MCC officials on three grounds. First, officials testified to “serious” security problems that arise from the introduction of such packages into the institution, the “traditional file in the cake kind of situation” as well as the concealment of drugs “in heels of shoes [and] seams of clothing.” App. 80; see id., at 24, 84-85. As in the case of the “publisher-only” rule, the warden testified that if such packages were allowed, the inspection process necessary to ensure the security of the institution would require a “substantial and inordinate amount of available staff time.” Id., at 24. Second, officials were concerned that the introduction of personal property into the facility would increase the risk of thefts, gambling, and inmate conflicts, the “age-old problem of you have it and I don’t.” Id., at 80; see id., at 85. Finally, they noted storage and sanitary problems that would result from inmates’ receipt of food packages. Id., at 67, 80. Inmates are permitted, however, to purchase certain items of food and personal property from the MCC commissary.
The District Court dismissed these justifications as “dire predictions.” It was unconvinced by the asserted security problems because other institutions allow greater ownership of personal property and receipt of packages than does the MCC. And because the MCC permitted inmates to purchase items in the commissary, the court could not accept official fears of increased theft, gambling, or conflicts if packages were allowed. Finally, it believed that sanitation could be assured by proper housekeeping regulations. Accordingly, it ordered the MCC to promulgate regulations to permit receipt of at least items of the kind that are available in the commissary. 439 F. Supp., at 152-153. The Court of Appeals accepted the District Court’s analysis and affirmed, although it noted that the MCC could place a ceiling on the permissible dollar value of goods received and restrict the number of packages. 573 F. 2d, at 132.
Neither the District Court nor the Court of Appeals identified which provision of the Constitution was violated by this MCC restriction. We assume, for present purposes, that their decisions were based on the Due Process Clause of the Fifth Amendment, which provides protection for convicted prisoners and pretrial detainees alike against the deprivation of their property without due process of law. See supra, at 545. But as we have stated, these due process rights of prisoners and pretrial detainees are not absolute; they are subject to reasonable limitation or retraction in light of the legitimate security concerns of the institution.
We think that the District Court and the Court of Appeals have trenched too cavalierly into areas that are properly the concern of MCC officials. It is plain from their opinions that the lower courts simply disagreed with the judgment of MCC officials about the extent of the security interests affected and the means required to further those interests. But our decisions have time and again emphasized that this sort of unguided substitution of judicial judgment for that of the expert prison administrators on matters such as this is inappropriate. See Jones v. North Carolina Prisoners’ Labor Union; Pell v. Procunier; Procunier v. Martinez. We do not doubt that the rule devised by the District Court and modified by the Court of Appeals may be a reasonable way of coping with the problems of security, order, and sanitation. It simply is not, however, the only constitutionally permissible approach to these problems-. Certainly, the Due Process Clause does not mandate a “lowest common denominator” security standard, whereby a practice permitted at one penal institution must be permitted at all institutions.
Corrections officials concluded that permitting the introduction of packages of personal property and food would increase the risks of gambling, theft, and inmate fights over that which the institution already experienced by permitting certain items to be purchased from its commissary. “It is enough to say that they have not been conclusively shown to be wrong in this view.” Jones v. North Carolina Prisoners’ Labor Union, 433 U. S., at 132. It is also all too obvious that such packages are handy devices for the smuggling of contraband. There simply is no basis in this record for concluding that MCC officials have exaggerated their response to these serious problems or that this restriction is irrational. It does not therefore deprive the convicted inmates or pretrial detainees of the MCC of their property without due process of law in contravention of the Fifth Amendment.
C
The MCC staff conducts unannounced searches of inmate living areas at irregular intervals. These searches generally are formal unit “shakedowns” during which all inmates are cleared of the residential units, and a team of guards searches each room. Prior to the District Court’s order, inmates were not permitted to watch the searches. Officials testified that permitting inmates to observe room inspections would lead to friction between the inmates and security guards and would allow the inmates to attempt to frustrate the search by distracting personnel and moving contraband from one room to another ahead of the search team.
The District Court held that this procedure could not stand as applied to pretrial detainees because MCC officials had not shown that the restriction was justified by “compelling necessity.” The court stated that “[a]t least until or unless [petitioners] can show a pattern of violence or other disruptions taxing the powers of control — a kind of showing not remotely approached by the Warden’s expressions — the security argument for banishing inmates while their rooms are searched must be rejected.” 439 F. Supp., at 149. It also noted that in many instances inmates suspected guards of thievery. Id., at 148-149. The Court of Appeals agreed with the District Court. It saw “no reason whatsoever not to permit a detainee to observe the search of his room and belongings from a reasonable distance,” although the court permitted the removal of any detainee who became “obstructive.” 573 F. 2d, at 132.
The Court of Appeals did not identify the constitutional provision on which it relied in invalidating the room-search rule. The District Court stated that the rule infringed the detainee’s interest in privacy and indicated that this interest in privacy was founded on the Fourth Amendment. 439 F. Supp., at 149-150. It may well be argued that a person confined in a detention facility has no reasonable expectation of privacy with respect to his room or cell and that therefore the Fourth Amendment provides no protection for such a person. Cf. Lanza v. New York, 370 U. S. 139, 143-144 (1962). In any case, given the realities of institutional confinement, any reasonable expectation of privacy that a detainee retained necessarily would be of a diminished scope. Id., at 143. Assuming, arguendo, that a pretrial detainee retains such a diminished expectation of privacy after commitment to a custodial facility, we nonetheless find that the room-search rule does not violate the Fourth Amendment.
It is difficult to see how the detainee’s interest in privacy is infringed by the room-search rule. No one can rationally doubt that room searches represent an appropriate security measure and neither the District Court nor the Court of Appeals prohibited such searches. And even the most zealous advocate of prisoners’ rights would not suggest that a warrant is required to conduct such a search. Detainees’ drawers, beds, and personal items may be searched, even after the lower courts’ rulings. Permitting detainees to observe the searches does not lessen the invasion of their privacy; its only conceivable beneficial effect would be to prevent theft or misuse by those conducting the search. The room-search rule simply facilitates the safe and effective performance of the search which all concede may be conducted. The rule itself, then, does not render the searches “unreasonable” within the meaning of the Fourth Amendment.
D
Inmates at all Bureau of Prisons facilities, including the MCC, are required to expose their body cavities for visual inspection as a part of a strip search conducted after every contact visit with a person from outside the institution. Corrections officials testified that visual cavity searches were necessary not only to discover but also to deter the smuggling of weapons, drugs, and other contraband into the institution. App. 70-72, 83-84. The District Court upheld the strip-search procedure but prohibited the body-cavity searches, absent probable cause to believe that the inmate is concealing contraband. 439 F. Supp., at 147-148. Because petitioners proved only one instance in the MCC’s short history where contraband was found during a body-cavity search, the Court of Appeals affirmed. In its view, the “gross violation of personal privacy inherent in such a search cannot be outweighed by the government’s security interest in maintaining a practice of so little actual utility.” 573 F. 2d, at 131.
Admittedly, this practice instinctively gives us the most pause. However, assuming for present purposes that inmates, both convicted prisoners and pretrial detainees, retain some Fourth Amendment rights upon commitment to a corrections facility, see Lanza v. New York, supra; Stroud v. United States, 251 U. S. 15, 21 (1919), we nonetheless conclude that these searches do not violate that Amendment. The Fourth Amendment prohibits only unreasonable searches, Carroll v. United States, 267 U. S. 132, 147 (1925), and under the circumstances, we do not believe that these searches are unreasonable.
The test of reasonableness under the Fourth Amendment is not capable of precise definition or mechanical application. In each case it requires a balancing of the need for the particular search against the invasion of personal rights that the search entails. Courts must consider the scope of the particular intrusion, the manner in which it is conducted, the justification for initiating it, and the place in which it is conducted. E. g., United States v. Ramsey, 431 U. S. 606 (1977); United States v. Martinez-Fuerte, 428 U. S. 543 (1976); United States v. Brignoni-Ponce, 422 U. S. 873 (1975); Terry v. Ohio, 392 U. S. 1 (1968); Katz v. United States, 389 U. S. 347 (1967); Schmerber v. California, 384 U. S. 757 (1966). A detention facility is a unique place fraught with serious security dangers. Smuggling of money, drugs, weapons, and other contraband is all too common an occurrence. And inmate attempts to secrete these items into the facility by concealing them in body cavities are documented in this record, App. 71-76, and in other cases. E. g., Ferraro v. United States, 590 F. 2d 335 (CA6 1978); United States v. Park, 521 F. 2d 1381, 1382 (CA9 1975). That there has been only one instance where an MCC inmate was discovered attempting to smuggle contraband into the institution on his person may be more a testament to the effectiveness of this search technique as a deterrent than to any lack of interest on the part of the inmates to secrete and import such items when the opportunity arises.
We do not underestimate the degree to which these searches may invade the personal privacy of inmates. Nor do we doubt, as the District Court noted, that on occasion a security guard may conduct the search in an abusive fashion. 439 F. Supp., at 147. Such abuse cannot be condoned. The searches must be conducted in a reasonable manner. Schmerber v. California, supra, at 771-772. But we deal here with the question whether visual body-cavity inspections as contemplated by the MCC rules can ever be conducted on less than probable cause. Balancing the significant and legitimate security interests of the institution against the privacy interests of the inmates, we conclude that they can.
IV
Nor do we think that the four MCC security restrictions and practices described in Part III, supra, constitute “punishment” in violation of the rights of pretrial detainees under the Due Process Clause of the Fifth Amendment. Neither the District Court nor the Court of Appeals suggested that these restrictions and practices were employed by MCC officials with an intent to punish the pretrial detainees housed there. Respondents do not even make such a suggestion; they simply argue that the restrictions were greater than necessary to satisfy petitioners’ legitimate interest in maintaining security. Brief for Respondents 51-53. Therefore, the determination whether these restrictions and practices constitute punishment in the constitutional sense depends on whether they are rationally related to a legitimate nonpunitive governmental purpose and whether they appear excessive in relation to that purpose. See supra, at 538-539. Ensuring security and order at the institution is a permissible nonpunitive objective, whether the facility houses pretrial detainees, convicted inmates, or both. Supra, at 539-540; see supra, at 546-547, and n. 28. For the reasons set forth in Part III, supra, we think that these particular restrictions and practices were reasonable responses by MCC officials to legitimate security concerns. Respondents simply have not met their heavy burden of showing that these officials have exaggerated their response to the genuine security considerations that actuated these restrictions and practices. See n. 23, supra. And as might be expected of restrictions applicable to pretrial detainees, these restrictions were of only limited duration so far as the MCC pretrial detainees were concerned. See n. 3, supra.
V
There was a time not too long ago when the federal judiciary took a completely “hands-off” approach to the problem of prison administration. In recent years, however, these courts largely have discarded this “hands-off” attitude and have waded into this complex arena. The deplorable conditions and Draconian restrictions of some of our Nation’s prisons are too well known to require recounting here, and the federal courts rightly have condemned these sordid aspects of our prison systems. But many of these same courts have, in the name of the Constitution, become increasingly enmeshed in the minutiae of prison operations. Judges, after all, are human. They, no less than others in our society, have a natural tendency to believe that their individual solutions to often intractable problems are better and more workable than those of the persons who are actually charged with and trained in the running of the particular institution under examination. But under the Constitution, the first question to be answered is not whose plan is best, but in what branch of the Government is lodged the authority to initially devise the plan. This does not mean that constitutional rights are not to be scrupulously observed. It does mean, however, that the inquiry of federal courts into prison management must be limited to the issue of whether a particular system violates any prohibition of the Constitution or, in the case of a federal prison, a statute. The wide range of “judgment calls” that meet constitutional and statutory requirements are confided to officials outside of the Judicial Branch of Government.
The judgment of the Court of Appeals is, accordingly, reversed, and the case is remanded for proceedings consistent with this opinion.
It is so ordered.
See, e. g., Hutto v. Finney, 437 U. S. 678 (1978); Jones v. North Carolina Prisoners’ Labor Union, 433 U. S. 119 (1977); Bounds v. Smith, 430 U. S. 817 (1977); Meachum v. Fano, 427 U. S. 215 (1976); Wolff v. McDonnell, 418 U. S. 539 (1974); Pell v. Procunier, 417 U. S. 817 (1974); Procunier v. Martinez, 416 U. S. 396 (1974).
See, e. g., Norris v. Frame, 585 F. 2d 1183 (CA3 1978); Campbell v. McGruder, 188 U. S. App. D. C. 258, 580 F. 2d 521 (1978); Wolfish v. Levi, 573 F. 2d 118 (CA2 1978) (case below); Feeley v. Sampson, 570 F. 2d 364 (CA1 1978); Main Road v. Aytch, 565 F. 2d 54 (CA3 1977); Patterson v. Morrisette, 564 F. 2d 1109 (CA4 1977); Miller v. Carson, 563 F. 2d 741 (CA5 1977); Duran v. Elrod, 542 F. 2d 998 (CA7 1976).
This group of nondetainees may comprise, on a daily basis, between 40% and 60% of the MCC population. United States ex rel. Wolfish v. United States, 428 F. Supp. 333, 335 (SDNY 1977). Prior to the District Court’s order, 50% of all MCC inmates spent less than 30 days at the facility and 73% less than 60 days. United States ex rel. Wolfish v. Levi, 439 F. Supp. 114, 127 (SDNY 1977). However, of the unsentenoed detainees, over half spent less than 10 days at the MCC, three-quarters were released within a month and more than 85% were released within 60 days, Wolfish v. Levi, supra, at 129 n. 25.
Of the 389 residential rooms at the MCC, 121 had been “designated” for “double-bunking” at the time of the District Court’s order. 428 F. Supp., at 336. The number of rooms actually housing two inmates, however, never exceeded 73 and, of these, only 35 were rooms in units that housed pretrial detainees. Brief for Petitioners 7 n. 6; Brief for Respondents 11-12; App. 33-35 (affidavit of Larry Taylor, MCC Warden, dated Dec. 29, 1976).
It appears that the named respondents may now have been transferred or released from the MCC. See United States ex rel. Wolfish v. Levi, supra, at 119. “This case belongs, however, to that narrow class of cases in which the termination of a class representative’s claim does not moot the claims of the unnamed members of the class.” Gerstein v. Pugh, 420 U. S. 103, 110 n. 11 (1975); see Sosna v. Iowa, 419 U. S. 393 (1975). The named respondents had a case or controversy at the time the complaint was filed and at the time the class action was certified by the District Court pursuant to Fed. Rule Civ. Proc. 23, and there remains a live controversy between petitioners and the members of the class represented by the named respondents. See Sosna v. Iowa, supra, at 402. Finally, because of the temporary nature of confinement at the MCC, the issues presented are, as in Sosna and Gerstein, “capable of repetition, yet evading review.” 419 U. S., at 400-401; 420 U. S., at 110 n. 11; see Kremens v. Bartley, 431 U. S. 119, 133 (1977). Accordingly, the requirements of Art. Ill are met and the case is not moot.
Petitioners apparently never contested the propriety of respondents’ use of a writ of habeas corpus to challenge the conditions of their confinement, and petitioners do not raise that question in this Court. However, respondents did plead an alternative basis for jurisdiction in their “Amended Petition” in the District Court — namely, 28 U. S. C. § 1361— that arguably provides jurisdiction. And, at the time of the relevant orders of the District Court in this case, jurisdiction would have been provided by 28 U. S. C. § 1331 (a). Thus, we leave to another day the question of the propriety of using a writ of habeas corpus to obtain review of the conditions of confinement, as distinct from the fact or length of the confinement itself. See Preiser v. Rodriguez, 411 U. S. 475, 499-500 (1973). See generally Lake Country Estates, Inc. v. Tahoe Regional Planning Agency, 440 U. S. 391 (1979).
Similarly, petitioners do not contest the District Court’s certification of this case as a class action. For much the same reasons as identified above, there is no need in this case to reach the question whether Fed. Rule Civ. Proe. 23, providing for class actions, is applicable to petitions for habeas corpus relief. Accordingly, we express no opinion as to the correctness of the District Court’s action in this regard. See Middendorf v. Henry, 425 U. S. 25, 30 (1976).
The Court of Appeals described the breadth of this action as follows:
“As an indication of the scope of this action, the amended petition also decried the inadequate phone service; 'strip’ searches; room searches outside the inmate’s presence; a prohibition against the receipt of packages or the use of personal typewriters; interference with, and monitoring of, personal mail; inadequate and arbitrary disciplinary and grievance procedures; inadequate classification of prisoners; improper treatment of non-English speaking inmates; unsanitary conditions; poor ventilation; inadequate and unsanitary food; the denial of furloughs, unannounced transfers; improper restrictions on religious freedom; and an insufficient and inadequately trained staff.” 573 F. 2d, at 123 n. 7.
While most of the District Court’s rulings were based on constitutional grounds, the court also held that some of the actions of the Bureau of Prisons were subject to review under the Administrative Procedure Act (APA) and were “arbitrary and capricious” within the meaning of the APA. 439 F. Supp., at 122-123, 141; see n. 11, infra.
The District Court also enjoined confiscation of inmate property by prison officials without supplying a receipt and, except under specified circumstances, the reading and inspection of inmates’ outgoing and incoming mail. 428 F. Supp., at 341-344. Petitioners do not challenge these rulings.
The District Court also granted respondents relief on the following issues: classification of inmates and movement between units; length of confinement; law library facilities; the commissary; use of personal typewriters; social and attorney visits; telephone service; inspection of inmates’ mail; inmate uniforms; availability of exercise for inmates in administrative detention; food service; access to the bathroom in the visiting area; special diets for Muslim inmates; and women’s “lock-in.” 439 F. Supp., at 125-165. None of these rulings are before this Court.
The Court of Appeals held that “[a]n institution’s obligation under the eighth amendment is at an end if it furnishes sentenced prisoners with adequate food, clothing, shelter, sanitation, medical care, and personal safety.” 573 F. 2d, at 125.
The Court of Appeals also held that the District Court’s reliance on the APA was erroneous. See n. 8, supra. The Court of Appeals concluded that because the Bureau of Prisons’ enabling legislation vests broad discretionary powers in the Attorney General, the administration of federal prisons constitutes “ 'agency action . . . committed to agency discretion by law’ ” that is exempt from judicial review under the APA, at least in the absence of a breach of a specific statutory mandate. 573 F. 2d, at 125; see 5 U. S. C. §701 (a)(2). Because of its holding that the APA was inapplicable to this case, the Court of Appeals reversed the District Court's rulings that the bathroom in the visiting area must be kept unlocked, that prison officials must make a certain level of local and long-distance telephone service available to MCC inmates, that the MCC must maintain unchanged its present schedule for social visits, and that the MCC must take commissary requests every other day. 573 F. 2d, at 125-126, and n. 16. Respondents have not cross petitioned from the Court of Appeals’ disposition of the District Court’s Eighth Amendment and APA rulings.
Although the Court of Appeals held that doubling the capacity of the dormitories was unlawful, it remanded for the District Court to determine “whether any number of inmates in excess of rated capacity could be suitably quartered within the dormitories.” Id., at 128. In view of the changed conditions resulting from this litigation, the court also remanded to the District Court for reconsideration of its order limiting incarceration of detainees at the MCC to a period less than 60 days. Id., at 129. The court reversed the District Court’s rulings that inmates be permitted to possess typewriters for their personal use in their rooms and that inmates not be required to wear uniforms. Id., at 132-133. None of these rulings are before the Court.
The NAACP Legal Defense and Educational Fund, Inc., as amicus curiae, argues that federal courts have inherent authority to correct conditions of pretrial confinement and that the practices at issue in this case violate the Attorney General’s alleged duty to provide inmates with “suitable quarters” under 18 U. S. C. § 4042 (2). Brief for the NAACP Legal Defense and Educational Fund, Inc., as Amicus Curiae 22-46. Neither argument was presented to or passed on by the lower courts; nor have they been urged by either party in this Court. Accordingly, we have no occasion to reach them in this case. Knetsch v. United States, 364 U. S. 361, 370 (1960).
As authority for its compelling-necessity test, the court cited three of its prior decisions, Rhem v. Malcolm, 507 F. 2d 333 (CA2 1974) (Rhem I); Detainees of Brooklyn House of Detention v. Malcolm, 520 F. 2d 392 (CA2 1975); and Rhem v. Malcolm, 527 F. 2d 1041 (CA2 1975) (Rhem II). Rhem I’s support for the compelling-necessity test came from Brenneman v. Madigan, 343 F. Supp. 128, 142 (ND Cal. 1972), which in turn cited no cases in support of its statement of the relevant test. Detainees found support for the compelling-necessity standard in Shapiro v. Thompson, 394 U. S. 618 (1969); Tate v. Short, 401 U. S. 395 (1971); Williams v. Illinois, 399 U. S. 235 (1970); and Shelton v. Tucker, 364 U. S. 479 (1960). But Tate and Williams dealt with equal protection challenges to imprisonment based on inability to pay fines or costs. Similarly, Shapiro concerned equal protection challenges to state welfare eligibility requirements found to violate the constitutional right to travel. In Shelton, the Court held that a school board policy requiring disclosure of personal associations violated the First and Fourteenth Amendment rights of a teacher. None of these cases support the court’s compelling-necessity test. Finally, Rhem II merely relied on Rhem I and Detainees.
In order to imprison a person prior to trial, the Government must comply with constitutional requirements, Gerstein v. Pugh, 420 U. S., at 114; Stack v. Boyle, 342 U. S., at 5, and any applicable statutory provisions, e. g., 18 U. S. C. §§ 3146, 3148. Respondents do not allege that the Government failed to comply with the constitutional or statutory requisites to pretrial detention.
The only justification for pretrial detention asserted by the Government is to ensure the detainees’ presence at trial. Brief for Petitioners 43. Respondents do not question the legitimacy of this goal. Brief for Respondents 33; Tr. of Oral Arg. 27. We, therefore, have no occasion to consider whether any other governmental objectives may constitutionally justify pretrial detention.
The Court of Appeals properly relied on the Due Process Clause rather than the Eighth Amendment in considering the claims of pretrial detainees. Due process requires that a pretrial detainee not be punished. A sentenced inmate, on the other hand, may be punished, although that punishment may not be “cruel and unusual” under the Eighth Amendment. The Court recognized this distinction in Ingraham v. Wright, 430 U. S. 651, 671-672, n. 40 (1977):
“Eighth Amendment scrutiny is appropriate only after the State has complied with the constitutional guarantees traditionally associated with criminal prosecutions. See United States v. Lovett, 328 U. S. 303, 317-318 (1946). . . . [T]he State does not acquire the power to punish with which the Eighth Amendment is concerned until after it has secured a formal adjudication of guilt in accordance with due process of law. Where the State seeks to impose punishment without such an adjudication, the pertinent constitutional guarantee is the Due Process Clause of the Fourteenth Amendment.”
MR. Justice SteveNs in dissent claims that this holding constitutes a departure from our prior due process cases, specifically Leis v. Flynt, 439 U. S. 438 (1979), and Paul v. Davis, 424 U. S. 693 (1976). Post, at 580-581, and n. 6. But as the citations following our textual statement indicate, we leave prior decisional law as we find it and simply apply it to the case at bar. For example, in Wong Wing v. United States, 163 U. S. 228, 237 (1896), the Court held that the subjection of persons to punishment at hard labor must be preceded by a judicial trial to establish guilt. And in Ingraham v. Wright, supra, at 674, we stated that “at least where school authorities, acting under color of state law, deliberately decide to punish a child for misconduct by restraining the child and inflicting appreciable physical pain, we hold that Fourteenth Amendment liberty interests are implicated.” (Emphasis supplied.) Thus, there is neither novelty nor inconsistency in our holding that the Fifth Amendment includes freedom from punishment within the liberty of which no person may be deprived without due process of law.
We, of course, do not mean by the textual discussion of the rights of pretrial detainees to cast doubt on any historical exceptions to the general principle that punishment can only follow a determination of guilt after trial or plea — exceptions such as the power summarily to punish for contempt of court. See, e. g., United States v. Wilson, 421 U. S. 309 (1975); Bloom v. Illinois, 391 U. S. 194 (1968); United States v. Barnett, 376 U. S. 681 (1964); Cooke v. United States, 267 U. S. 517 (1925); Ex parte Terry, 128 U. S. 289 (1888); Fed. Rule Crim. Proc. 42.
The Bail Reform Act of 1966 establishes a liberal policy in favor of pretrial release. 18 U. S. C. §§ 3146, 3148. Section 3146 provides in pertinent part:
“Any person charged with an offense, other than an offense punishable by death, shall, at his appearance before a judicial officer, be ordered released pending trial on his personal recognizance or upon the execution of an unsecured appearance bond in an amount specified by the judicial officer, unless the officer determines, in the exercise of his discretion, that such a release will not reasonably assure the appearance of the person as required.”
As Mr. Justice Frankfurter stated in United States v. Lovett, 328 U. S. 303, 324 (1946) (concurring opinion): “The fact that harm is inflicted by governmental authority does not make it punishment. Figuratively speaking all discomforting action may be deemed punishment because it deprives of what otherwise would be enjoyed. But there may be reasons other than punitive for such deprivation.”
This is not to say that the officials of a detention facility can justify punishment. They cannot. It is simply to say that in the absence of a showing of intent to punish, a court must look to see if a particular restriction or condition, which may on its face appear to be punishment, is instead but an incident of a legitimate nonpunitive governmental objective. See Kennedy v. Mendoza-Martinez, 372 U. S., at 168; Flemming v. Nestor, 363 U. S., at 617. Retribution and deterrence are not legitimate nonpuni-tive governmental objectives. Kennedy v. Mendoza-Martinez, supra, at 168. Conversely, loading a detainee with chains and shackles and throwing him in a dungeon may ensure his presence at trial and preserve the security of the institution. But it would be difficult to conceive of a situation where conditions so harsh, employed to achieve objectives that could be accomplished in so many alternative and less harsh methods, would not support a conclusion that the purpose for which they were imposed was to punish.
“There is, of course, a de minimis level of imposition with which the Constitution is not concerned.” Ingraham v. Wright, 430 U. S., at 674.
In fact, security measures may directly serve the Government’s interest in ensuring the detainee’s presence at trial. See Feeley v. Sampson, 570 F. 2d, at 369.
In determining whether restrictions or conditions are reasonably related to the Government’s interest in maintaining security and order and operating the institution in a manageable fashion, courts must heed our warning that “[s]uch considerations are peculiarly within the province and professional expertise of corrections officials, and, in the absence of substantial evidence in the record to indicate that the officials have exaggerated their response to these considerations, courts should ordinarily defer to their expert judgment in such matters.” Pell v. Procunier, 417 U. S., at 827; see Jones v. North Carolina Prisoners’ Labor Union, 433 U. S. 119 (1977); Meachum v. Fano, 427 U. S. 215 (1976); Procunier v. Martinez, 416 U. S. 396 (1974).
The District Court found that there were no disputed issues of material fact with respect to respondents’ challenge to “double-bunking.” 428 F. Supp., at 335. We agree with the District Court in this determination.
Respondents seem to argue that “double-bunking” was unreasonable because petitioners were able to comply with the District Court’s order forbidding “double-bunking” and still accommodate the increased numbers of detainees simply by transferring all but a handful of sentenced inmates who had been assigned to the MCC for the purpose of performing certain services and by committing those tasks to detainees. Brief for Respondents 50. That petitioners were able to comply with the District Court’s order in this fashion does not mean that petitioners’ chosen method of coping with the increased inmate population — “double-bunking” — was unreasonable. Governmental action does not have to be the only alternative or even the best alternative for it to be reasonable, to say nothing of constitutional. See Vance v. Bradley, 440 U. S. 93 (1979); Dandridge v. Williams, 397 U. S. 471, 485 (1970).
That petitioners were able to comply with the District Court order also does not make this case moot, because petitioners still dispute the legality of the court’s order and they have informed the Court that there is a reasonable expectation that they may be required to “double-bunk” again. Reply Brief for Petitioners 6; Tr. of Oral Arg. 33-35, 56-57; see United States v. W. T. Grant Co., 345 U. S. 629, 632-633 (1953).
We thus fail to understand the emphasis of the Court of Appeals and the District Court on the amount of walking space in the “double-bunked” rooms. See 573 F. 2d, at 127; 428 F. Supp., at 337.
Respondents’ reliance on other lower court decisions concerning minimum space requirements for different institutions and on correctional standards issued by various groups is misplaced. Brief for Respondents 41, and nn. 40 and 41; see, e. g., Campbell v. McGruder, 188 U. S. App. D. C. 258, 580 F. 2d 521 (1978); Battle v. Anderson, 564 F. 2d 388 (CA10 1977); Chapman v. Rhodes, 434 F. Supp. 1007 (SD Ohio 1977); Inmates of Suffolk County Jail v. Eisenstadt, 360 F. Supp. 676 (Mass. 1973); American Public Health Assn., Standards for Health Services in Correctional Institutions 62 (1976); American Correctional Assn., Manual of Standards for Adult Correctional Institutions, Standard No. 4142, p. 27 (1977); National Sheriffs’ Assn., A Handbook on Jail Architecture 63 (1975). The cases cited by respondents concerned facilities markedly different from the MCC. They involved traditional jails and cells in which inmates were locked during most of the day. Given this factual disparity, they have little or no application to the case at hand. Thus, we need not and do not decide whether we agree with the reasoning and conclusions of these eases. And while the recommendations of these various groups may be instructive in certain cases, they simply do not establish the constitutional minima; rather, they establish goals recommended by the organization in question. For this same reason, the draft recommendations of the Federal Corrections Policy Task Force of the Department of Justice regarding conditions of confinement for pretrial detainees are not determinative of the requirements of the Constitution. See Dept, of Justice, Federal Corrections Policy Task Force, Federal Standards for Corrections (Draft, June 1978).
Neither the Court of Appeals nor the District Court distinguished between pretrial detainees and convicted inmates in reviewing the challenged security practices, and we see no reason to do so. There is no basis for concluding that pretrial detainees pose any lesser security risk than convicted inmates. Indeed, it may be that in certain circumstances they present a greater risk to jail security and order. See, e. g., Main Road v. Aytch, 565 F. 2d, at 57. In the federal system, a detainee is committed to the detention facility only because no other less drastic means can reasonably assure his presence at trial. See 18 U. S. C. § 3146. As a result, those who are detained prior to trial may in many cases be individuals who are charged with serious crimes or who have prior records. They also may pose a greater risk of escape than convicted inmates. See Joint App. in Nos. 77-2035, 77-2135 (CA2), pp. 1393-1398, 1531-1532. This may be particularly true at facilities like the MCC, where the resident convicted inmates have been sentenced to only short terms of incarceration and many of the detainees face the possibility of lengthy imprisonment if convicted.
Respondents argue that this Court’s cases holding that substantial deference should be accorded prison officials are not applicable to this case because those decisions concerned convicted inmates, not pretrial detainees. Brief for Respondents 52. We disagree. Those decisions held that courts should defer to the informed discretion of prison administrators because the realities of running a corrections institution are complex and difficult, courts are ill equipped to deal with these problems, and the management of these facilities is confided to the Executive and Legislative Branches, not to the Judicial Branch. See Jones v. North Carolina Prisoners’ Labor Union, 433 U. S., at 126; Pell v. Procunier, 417 U. S., at 827; Procunier v. Martinez, 416 U. S., at 404-405. While those cases each concerned restrictions governing convicted inmates, the principle of deference enunciated in them is not dependent on that happenstance.
What the Court said in Procunier v. Martinez bears repeating here: “Prison administrators are responsible for maintaining internal order and discipline, for securing their institutions against unauthorized access or escape, and for rehabilitating, to the extent that human nature and inadequate resources allow, the inmates placed in their custody. The Herculean obstacles to effective discharge of these duties are too apparent to warrant explication. Suffice it to say that the problems of prisons in America are complex and intractable, and, more to the point, they are not readily susceptible of resolution by decree. Most require expertise, comprehensive planning, and the commitment of resources, all of which are peculiarly within the province of the legislative and executive branches of government. For all of those reasons, courts are ill equipped to deal with the increasingly urgent problems of prison administration and reform. Judicial recognition of that fact reflects no more than a healthy sense of realism.” Ibid.
Because of the changes in the “publisher-only” rule, some of which apparently occurred after we granted certiorari, respondents, citing Sanks v. Georgia, 401 U. S. 144 (1971), urge the Court to dismiss the writ of certiorari as improvidently granted with respect to the validity of the rule, as modified. Brief for Respondents 68. Sanks, however, is quite different from the instant case. In Sanks the events that transpired after probable jurisdiction was noted “had so drastically undermined the premises on which we originally set [the] case for plenary consideration as to lead us to conclude that, with due regard for the proper functioning of this Court, we should not . . . adjudicate it.” 401 U. S., at 145. The focus of that case had been “completely blurred, if not altogether obliterated,” and a judgment on the issues involved had become “potentially immaterial.” Id., at 152. This is not true here. Unlike the situation in Sanks, the Government has not substituted an entirely different regulatory scheme and wholly abandoned the restrictions that were invalidated below. There is still a dispute, which is not “blurred” or “obliterated,” on which a judgment will not be “immaterial.” Petitioners merely have chosen to limit their disagreement with the lower courts’ rulings. Also, the question that is now posed is fairly comprised within the questions presented in the petition for certiorari. See Pet. for Cert. 2 (“[w]hether the governmental interest in maintaining jail security and order justifies rules that . . . (b) prohibit receipt at the jail of books and magazines that are not mailed directly from publishers”). See this Court’s Rule 23(1)(c). We, of course, express no view as to the validity of those portions of the lower courts’ rulings that concern magazines or soft-cover books.
The District Court stated: “With no record of untoward experience at places like the MCC, and with no history of resort to less restrictive measures, [petitioners’] invocation of security cannot avail with respect to the high constitutional interests here at stake.” 428 F. Supp., at 340. We rejected this line of reasoning in Jones v. North Carolina Prisoners’ Labor Union, 433 U. S., at 132-133, where we stated: “Responsible prison officials must be permitted to take reasonable steps to forestall'. . . threat[s to security], and they must be permitted to act before the time when they can compile a dossier on the eve of a riot.” We reject it again, now. In Jones, we also emphasized that the “informed discretion of prison officials that there is 'potential danger may be sufficient for limiting rights even though this showing might be ‘unimpressive if . . . submitted as justification for governmental restriction of personal communication among members of the general public.’” (Emphasis added.) Id., at 133 n. 9, quoting Pell v. Procunier, 417 U. S., at 825; see Procunier v. Martinez, 416 U. S., at 414.
The general library consists of more than 3,000 hardback books, which include general reference texts and fiction and nonfiction works, and more than 5,000 assorted paperbacks, including fiction and nonfiction. The MCC offers for sale to inmates four daily newspapers and certain magazines. Joint App. in Nos. 77-2035, 77-2135 (CA2), pp. 102-103 (affidavit of Robert Harris, MCC Education Specialist, dated Oct. 19, 1976). Other paperback books and magazines are donated periodically and distributed among the units for inmate use. United States ex rel. Wolfish v. Levi, 439 F. Supp., at 131.
Inmates are permitted to spend a total of $15 per week or up to $50 per month at the commissary. Id., at 132.
With regard to pretrial detainees, we again note that this restriction affects them for generally a maximum of 60 days. See n. 3, supra.
One of the correctional experts testified as follows:
“[T]he requirement that prisoners not be in the immediate area obviously has its basis again in the requirements of security.
“It is quite obvious that if a group of officers start a searching process of a housing area at the MCC, if it be a corridor or an area of rooms or in a typical jail if it were a cell block, unless all prisoners are removed from that immediate area, there are a wide variety of opportunities for the confiscation of contraband by prisoners who may have such in their possession and cells.
“It can go down the toilet or out the window, swallowed, a wide variety of methods of confiscation of contraband.” App. 78.
The District Court did not extend its ruling to convicted inmates because, for them, “the asserted necessities need not be ‘compelling/ ” and since the warden’s explanation of the problems posed was “certainly not weightless,” the practice passed the constitutional test for sentenced inmates. 439 F. Supp., at 150.
It may be that some guards have abused the trust reposed in them by failing to treat the personal possessions of inmates with appropriate respect. But, even assuming that in some instances these abuses of trust reached the level of constitutional violations, this is not an action to recover damages for damage to or destruction of particular items of property. This is a challenge to the room-search rule in its entirety, and the lower courts have enjoined enforcement of the practice itself. When analyzed in this context, proper deference to the informed discretion of prison authorities demands that they, and not the courts, make the difficult judgments which reconcile conflicting claims affecting the security of the institution, the welfare of the prison staff, and the property rights of the detainees. Jones v. North Carolina Prisoners’ Labor Union, 433 U. S., at 128.
If the inmate is a male, he must lift his genitals and bend over to spread his buttocks for visual inspection. The vaginal and anal cavities of female inmates also are visually inspected. The inmate is not touched by security personnel at any time during the visual search procedure. 573 F. 2d, at 131; Brief for Petitioners 70, 74 n. 56.
The District Court indicated that in its view the use of metal detection equipment represented a less intrusive and equally effective alternative to cavity inspections. We noted in United States v. Martinez-Fuerte, 428 U. S. 543, 556-557, n. 12 (1976), that “[t]he logic of such elaborate less-restrictive-alternative arguments could raise insuperable barriers to the exercise of virtually all search-and-seizure powers.” However, assuming that the existence of less intrusive alternatives is relevant to the determination of the reasonableness of the particular search method at issue, the alternative suggested by the District Court simply would not be as effective as the visual inspection procedure. Money, drugs, and other nonmetallic contraband still could easily be smuggled into the institution. Another possible alternative, not mentioned by the lower courts, would be to closely observe inmate visits. See Dept, of Justice, Federal Corrections Policy Task Force, Federal Standards for Corrections (Draft, June 1978). But MCC officials have adopted the visual inspection procedure as an alternative to close and constant monitoring of contact visits to avoid the obvious disruption of the confidentiality and intimacy that these visits are intended to afford. That choice has not been shown to be irrational or unreasonable. Another alternative that might obviate the need for body-cavity inspections would be to abolish contact visits altogether. But the Court of Appeals, in a ruling that is not challenged in this Court and on which we, accordingly, express no opinion, held that pretrial detainees have a constitutional right to contact visits. 573 F. 2d, at 126 n. 16; see Marcera v. Chinlund, 595 F. 2d 1231 (CA2 1979). See also Miller v. Carson, 563 F. 2d, at 748-749.
We note that several lower courts have upheld such visual body-cavity inspections against constitutional challenge. See, e. g., Daughtery v. Harris, 476 F. 2d 292 (CA10), cert. denied, 414 U. S. 872 (1973); Hodges v. Klein, 412 F. Supp. 896 (NJ 1976); Bijeol v. Benson, 404 F. Supp. 595 (SD Ind. 1975); Penn El v. Riddle, 399 F. Supp. 1059 (ED Va. 1975).
In determining whether the “publisher-only” rule constitutes punishment, we consider the rule in its present form and in light of the concessions made by petitioners. See supra, at 548-550.
The District Court noted that in their post-trial memorandum petitioners stated that “[w]ith respect to sentenced inmates, . . . the restrictions on the possession of personal property also serve the legitimate purpose of punishment.” 439 F. Supp., at 153; see Post-trial Memo-random for Respondents in No. 75 Civ. 6000 (SDNY) 212 n. However, below and in this Court, petitioners have relied only on the three reasons discussed supra, at 553, to justify this restriction. In our view, this passing reference in a brief to sentenced inmates, which was not supported by citation to the record, hardly amounts to the “substantial confession of error” with respect to pretrial detainees referred to by the District Court. 439 F. Supp., at 153.