Justice Breyer
delivered the opinion of the Court.
When an alien has been found to be unlawfully present in the United States and a final order of removal has been entered, the Government ordinarily secures the alien’s removal during a subsequent 90-day statutory “removal period,” during which time the alien normally is held in custody.
A special statute authorizes further detention if the Government fails to remove the alien during those 90 days. It says:
“An alien ordered removed [1] who is inadmissible .'.. [2] [or] removable [as a result of violations of status requirements or entry conditions, violations of criminal law, or reasons of security or foreign policy] or [3] who has been determined by the Attorney General to be a risk to the community or unlikely to comply with the order of removal, may be detained beyond the removal period and, if released, shall be subject to [certain] terms of supervision . . . .” 8 U. S. C. § 1231(a)(6) (1994 ed., Supp. V).
In these cases, we must decide whether this post-removal-period statute authorizes the Attorney General to detain a removable alien indefinitely beyond the removal period or only for a period reasonably necessary to secure the alien’s removal. We deal here with aliens who were admitted to the United States but subsequently ordered removed. Aliens who have not yet gained initial admission to this country would present a very different question. See infra, at 693-694. Based on our conclusion that indefinite detention of aliens in the former category would raise serious constitutional concerns, we construe the statute to contain an implicit “reasonable time” limitation, the application of which is subject to federal-court review.
H-l
A
The post-removal-period detention statute is one of a related set of statutes and regulations that govern detention during and after removal proceedings. While removal proceedings are in progress, most aliens may be released on bond or paroled. 66 Stat. 204, as added and amended, 110 Stat. 3009-585, 8 U. S. C. §§ 1226(a)(2), (c) (1994 ed., Supp. V). After entry of a final removal order and during the 90-day removal period, however, aliens must be held in custody. § 1231(a)(2). Subsequently, as the post-removal-period statute provides, the Government “may” continue to detain an alien who still remains here or release that alien under supervision. § 1231(a)(6).
Related Immigration and Naturalization Service (INS) regulations add that the INS District Director will initially review the alien’s records to decide whether further detention or release under supervision is warranted after the 90-day removal period expires. 8 CFR §§ 241.4(c)(1), (h), (k)(l)(i) (2001). If the decision is to detain, then an INS panel will review the matter further, at the expiration of a 3-month period or soon thereafter. § 241.4(k)(2)(ii). And the panel will decide, on the basis of records and a possible personal interview, between still further detention or release under supervision. §241.4(i). In making this decision, the panel will consider, for example, the alien’s disciplinary record, criminal record, mental health reports, evidence of rehabilitation, history of flight, prior immigration history, and favorable factors such as family ties. § 241.4(f). To authorize release, the panel must find that the alien is not likely to be violent, to pose a threat to the community, to flee if released, or to violate the conditions of release. § 241.4(e). And the alien must demonstrate “to the satisfaction of the Attorney General” that he will pose no danger or risk of flight. § 241.4(d)(1). If the panel decides against release, it must review the matter again within a year, and can review it earlier if conditions change. §§241.4(k)(2)(iii), (v).
B
1
We consider two separate instances of detention. The first concerns Kestutis Zadvydas, a resident alien who was born, apparently of Lithuanian parents, in a displaced persons camp in Germany in 1948. When he was eight years old, Zadvydas immigrated to the United States with his parents and other family members, and he has lived here ever since.
Zadvydas has a long criminal record, involving drug crimes, attempted robbery, attempted burglary, and theft. He has a history of flight, from both criminal and deportation proceedings. Most recently, he was convicted of possessing, with intent to distribute, cocaine; sentenced to 16 years’ imprisonment; released on parole after two years; taken into INS custody; and, in 1994, ordered deported to Germany. See 8 U. S. C. § 1261(a)(2) (1988 ed., Supp. V) (delineating crimes that make alien deportable).
In 1994, Germany told the INS that it would not accept Zadvydas because he was not a German citizen. Shortly thereafter, Lithuania refused to accept Zadvydas because he was neither a Lithuanian citizen nor a permanent resident. In 1996, the INS asked the .Dominican Republic (Zadvydas’ wife’s country) to accept him, but this effort proved unsuccessful. In 1998, Lithuania rejected, as inadequately documented, Zadvydas’ effort to obtain Lithuanian citizenship based on his parents’ citizenship; Zadvydas’ reapplication is apparently still pending.
The INS kept Zadvydas in custody after expiration of the removal period. In September 1995, Zadvydas filed a petition for a writ of habeas eorpus under 28 U. S. C. § 2241 chai-lenging his continued detention. In October 1997, a Federal District Court granted that writ and ordered him released under supervision. Zadvydas v. Caplinger, 986 F. Supp. 1011, 1027-1028 (ED La.). In its view, the Government would never succeed in its efforts to remove Zadvydas from the United States, leading to his permanent confinement, contrary to the Constitution. Id., at 1027.
The Fifth Circuit reversed this decision. Zadvydas v. Underdown, 185 F. 3d 279 (1999). It concluded that Zadvydas’ detention did not violate the Constitution because eventual deportation was not “impossible,” good-faith efforts to remove him from the United States continued, and his detention was subject to periodic administrative review. Id., at 294,297. The Fifth Circuit stayed its mandate pending potential review in this Court.
2
The second case is that of Kim Ho Ma. Ma was born in Cambodia in 1977. When he was two, his family fled, taking him to refugee camps in Thailand and the Philippines and eventually to the United States, where he has lived as a resident alien since the age of seven. In 1995, at age 17, Ma was involved in a gang-related shooting, convicted of manslaughter, and sentenced to 38 months’ imprisonment. He served two years, after which he was released into INS custody.
In light of his conviction of an “aggravated felony,” Ma was ordered removed. See 8 U. S. C. §§ 1101(a)(43)(F) (defining certain violent crimes as aggravated felonies), 1227(a)(2)(A)(iii) (1994 ed., Supp. IV) (aliens convicted of aggravated felonies are deportable). The 90-day removal period expired in early 1999, but the INS continued to keep Ma in custody, because, in light of his former gang membership, the nature of his crime, and his planned participation in a prison hunger strike, it was “unable to conclude that Mr. Ma would remain nonviolent and not violate the conditions of release.” App. to Pet. for Cert, in No. 00-38, p. 87a.
In 1999, Ma filed a petition for a writ of habeas corpus under 28 U. S. C. §2241. A panel of five judges in the Federal District Court for the Western District of Washington, considering Ma’s and about 100 similar cases together, issued a joint order holding that, the Constitution forbids post-removal-period detention unless there is “a realistic chance that [the] alien will be deported” (thereby permitting classification of the detention as “in aid of deportation”). Binh Phan v. Reno, 56 F. Supp. 2d 1149, 1156 (1999). The District Court then held an evidentiary hearing, decided that there was no “realistic chance” that Cambodia (which has no repatriation treaty with the United States) would accept Ma, and ordered Ma released. App. to Pet. for Cert, in No. 00-38, at 60a-61a.
The Ninth Circuit affirmed Ma’s release. Kim Ho Ma v. Reno, 208 F. 3d 815 (2000). It concluded, based in part on constitutional concerns, that the statute did not authorize detention for more than a “reasonable time” beyond the 90-day period authorized for removal. Id., at 818. And, given the lack of a repatriation agreement with Cambodia, that time had expired upon passage of the 90 days. Id., at 830-831.
3
Zadvydas asked us to review the decision of the Fifth Circuit authorizing his continued detention. The Government asked us to review the decision of the Ninth Circuit forbidding Ma’s continued detention. We granted writs in both cases, agreeing to consider both statutory and related constitutional questions. See also Duy Dac Ho v. Greene, 204 F. 3d 1045, 1060 (CA10 2000) (upholding Attorney General’s statutory and constitutional authority to detain alien indefinitely). We consolidated the two cases for argument; and we now decide them together.
i — t
We note at the outset that the primary federal habeas corpus statute, 28 U. S. C. §2241, confers jurisdiction upon the federal courts to hear these cases. See § 2241(c)(3) (authorizing any person to claim in federal court that he or she is being held “in custody in violation of the Constitution or laws i . . of the United States”). Before 1952, the federal courts considered challenges to the lawfulness of immigration-related detention, including challenges to the validity of a deportation order, in habeas proceedings. See Heikkila v. Barber, 345 U. S. 229, 230, 235-236 (1953). Beginning in 1952, an alternative method for review of deportation orders, namely, actions brought in federal district court under the. Administrative Procedure Act (APA), became available. See Shaughnessy v. Pedreiro, 349 U. S. 48, 51-52 (1955). And in 1961 Congress replaced district court APA review with initial deportation order review in courts of appeals. See Act of Sept. 26, 1961, § 5, 75 Stat. 651 (formerly codified at 8 U. S. C. § 1105a(a)) (repealed 1996). The 1961 Act specified that federal habeas courts were also available to hear statutory and constitutional challenges to deportation (and exclusion) orders. See 8 U. S. C. §§ 1105a(a)(10), (b) (repealed 1996). These statutory changes left habeas untouched as the basic method for obtaining review of continued custody after a deportation order had become final. See Cheng Fan Kwok v. INS, 392 U. S. 206, 212, 215-216 (1968) (holding that § 1105a(a) applied only to challenges to determinations made during deportation proceedings and motions to reopen those proceedings).
More recently, Congress has enacted several statutory provisions that limit the circumstances in which judicial review of deportation decisions is available. But none applies here. One provision, 8 U. S. C. § 1231(h) (1994 ed., Supp. V), simply forbids courts to construe that section “to create any . . . procedural right or benefit that is legally enforceable”; it does not deprive an alien of the right to rely on 28 U. S. C. § 2241 to challenge detention that is without statutory authority.
Another provision, 8 U. S. C. § 1252(a)(2)(B)(ii) (1994 ed., Supp. V), says that “no court shall.' have jurisdiction to review” decisions “specified ... to be in the discretion of the Attorney General.” The aliens here, however, do not seek review of the Attorney General’s exercise of discretion; rather, they challenge the extent of the Attorney General’s authority under the post-removal-period detention statute. And the extent of that authority is not a matter of discretion. See also, e.g., § 1226(e) (applicable to certain detention-related decisions in period preceding entry of final removal order); § 1231(a)(4)(D) (applicable to assertion of causes or claims under §1231(a)(4), which is not at issue here); §§ 1252(a)(1), (a)(2)(C) (applicable to judicial review of “final order[s] of removal”); § 1252(g) (applicable to decisions “to commence proceedings, adjudicate cases, or execute removal orders”).
We conclude that § 2241 habeas corpus proceedings remain available as a forum for statutory and constitutional challenges. to post-removal-period detention. And we turn to the merits of the aliens’ claims.
H-1 H-l
The post-removal-period detention statute applies to certain categories of aliens who have been ordered removed, namely, inadmissible aliens, criminal aliens, aliens who have violated their nonimmigrant status conditions, and aliens removable for certain national security or foreign relations reasons, as well as any alien “who has been determined by the Attorney General to be a risk to the community or unlikely to comply with the order of removal.” 8 U. S. C. § 1231(a)(6) (1994 ed., Supp. V); see also 8 CFR § 241.4(a) (2001). It says that an alien who falls into one of these categories “may be detained beyond the removal period and, if released, shall be subject to [certain] terms of supervision.” 8 U. S. C. § 1231(a)(6) (1994 ed., Supp. V).
The Government argues that the statute means what it literally says. It sets no “limit on the length of time beyond the removal period that an alien who falls within one of the Section 1231(a)(6) categories may be detained.” Brief for Petitioners in No. 00-38, p. 22. Hence, “whether to continue to detain such an alien and, if so, in what circumstances and for how long” is up to the Attorney General, not up tó the courts. Ibid.
“[I]t is a cardinal principle” of statutory interpretation, however, that when an Act of Congress raises “a serious doubt” as to its constitutionality, “this Court will first ascertain whether a construction of the statute is fairly possible by which the question may be avoided.” Crowell v. Benson, 285 U. S. 22, 62 (1932); see also United States v. X-Citement Video, Inc., 513 U. S. 64, 78 (1994); United States v. Jin Fuey Moy, 241 U. S. 394, 401 (1916); cf. Almendarez-Torres v. United States, 523 U. S. 224, 238 (1998) (construction of statute that avoids invalidation best reflects congressional will). We have read significant limitations into other immigration statutes in order to avoid their constitutional invalidation. See United States v. Witkovich, 353 U. S. 194, 195, 202 (1957) (construing a grant of authority to the Attorney General to ask aliens whatever questions he “deem[s] fit and proper” as limited to questions “reasonably calculated to keep the Attorney General advised regarding the continued availability for departure of aliens whose deportation is overdue”). For similar reasons, we read an implicit limitation into the statute before us. In our view, the statute, read in light of the Constitution’s demands, limits an alien’s post-removal-period detention to a period reasonably necessary to bring about that alien’s removal from the United States. It does not permit indefinite detention.
A
A statute permitting indefinite detention of an alien would raise a serious constitutional problem. The Fifth Amendment’s Due Process Clause forbids the Government to “de-priv[e]” any "person ... of... liberty ... without due process of law.” Freedom from imprisonment — from government custody, detention, or other forms of physical restraint — lies at the heart of the liberty that Clause protects. See Foucha v. Louisiana, 504 U. S. 71, 80 (1992). And this Court has said that government detention violates that Clause unless the detention is ordered in a criminal proceeding with adequate procedural protections, see United States v. Salerno, 481 U. S. 739, 746 (1987), or, in certain special and “narrow” nonpunitive “circumstances,” Foucha, supra, at 80, where a special justification, such as harm-threatening mental illness, outweighs the “individual’s constitutionally protected interest in avoiding physical restraint.” Kansas v. Hendricks, 521 U. S. 346, 356 (1997).
The proceedings at issue here are civil, not criminal, and we assume that they are nonpunitive in purpose and effect. There is no sufficiently strong special justification here for indefinite civil detention — at least as administered under this statute. The statute, says the Government, has two regulatory goals: “ensuring the appearance of aliens at future immigration proceedings” and “[preventing danger to the community.” Brief for Respondents in No. 99-7791, p. 24. But by definition the first justification — preventing flight — is weak or nonexistent where removal seems a remote possibility at best. As this Court said in Jackson v. Indiana, 406 U. S. 715 (1972), where detention’s goal is no longer practically attainable, detention no longer “bear[s] [a] reasonable relation to the purpose for which the individual [was] committed.” Id., at 738.
The second justification — protecting the community — does not necessarily diminish in force over time. But we have upheld preventive detention based on dangerousness only when limited to specially dangerous individuals and subject to strong procedural protections. Compare Hendricks, swpm, at 368 (upholding scheme that imposes detention upon “a small segment of particularly dangerous individuals” and provides “strict procedural safeguards”), and Salerno, supra, at 747, 750-752 (in upholding pretrial detention, stressing “stringent time limitations,” the fact that detention is reserved for the “most serious of crimes,” the requirement of proof of dangerousness by clear and convincing evidence, and the presence of judicial safeguards), with Foucha, supra, at 81-83 (striking down insanity-related detention system that placed burden on detainee to prove nondangerousness). In cases in which preventive detention is of potentially indefinite duration, we have also demanded that the dangerousness rationale be accompanied by some other special circumstance, such as mental illness, that helps to create the danger. See Hendricks, supra, at 358, 368.
The civil confinement here at issue is not limited, but potentially permanent. Cf. Salerno, supra, at 747 (noting that “maximum length of pretrial detention is limited” by “stringent” requirements); Carlson v. Landon, 342 U. S. 524, 545-546 (1952) (upholding temporary detention of alien during deportation proceeding while noting that “problem of . . . unusual delay” was not present). The provision authorizing detention does not apply narrowly to “a small segment of particularly dangerous individuals,” Hendricks, supra, at 368, say, suspected terrorists, but broadly to aliens ordered removed for many and various reasons, including tourist visa violations. See 8 U. S. C. § 1231(a)(6) (1994 ed., Supp. V) (referencing § 1227(a)(1)(C)); cf. Hendricks, 521 U. S., at 357-358 (only individuals with “past sexually violent behavior and a present mental condition that creates a likelihood of such conduct in the future” may be detained). And, once the flight risk justification evaporates, the only special circumstance present is the alien’s removable status itself, which bears no relation to a detainee’s dangerousness. Cf. id., at 358; Foucha, supra, at 82.
Moreover, the sole procedural protections available to the alien are found in administrative proceedings, where the alien bears the burden of proving he is not dangerous, without (in the Government’s view) significant later judicial review. Compare 8 CFR § 241.4(d)(1) (2001) (imposing burden of proving nondangerousness upon alien) with Foucha, supra, at 82 (striking down insanity-related detention for that very reason). This Court has suggested, however, that the Constitution may well preclude granting “an administrative body the unreviewable authority to make determinations implicating fundamental rights.” Superintendent, Mass. Correctional Institution at Walpole v. Hill, 472 U. S. 445, 450 (1985) (O’Connor, J.); see also Crowell, 285 U. S., at 87 (Brandeis, J., dissenting) (“[U]nder certain circumstances, the constitutional requirement of due process is a requirement of judicial process”). The Constitution demands greater procedural protection even for property. See South Carolina v. Regan, 465 U. S. 367, 393 (1984) (O’CONNOR, J., concurring in judgment); Phillips v. Commissioner, 283 U. S. 589, 595-597 (1931) (Brandeis, J.). The serious constitutional problem arising out of a statute that, in these circum: stances, permits an indefinite, perhaps permanent, deprivation of human liberty without any such protection is obvious.
The Government argues that, from a constitutional perspective, alien status itself can justify indefinite detention, and points to Shaughnessy v. United States ex rel. Mezei, 345 U. S. 206 (1953), as support. That case involved a once lawfully admitted alien who left the United States, returned after a trip abroad, was refused admission, and was left on Ellis Island, indefinitely detained there because the Government could not find another country to accept him. The Court held that Mezei’s detention did not violate the Constitution. Id., at 215-216.
Although Mezei, like the present cases, involves indefinite detention, it differs from the present cases in a critical respect. As the Court emphasized, the alien’s extended departure from the United States required him to seek entry into this country once again. His presence on Ellis Island did not count as entry into the United States. Hence, he was “treated,” for constitutional purposes, “as if stopped at the border.” Id., at 213, 215. And that made all the difference.
The distinction between an alien who has effected an entry into the United States and one who has never entered runs throughout immigration law. See Kaplan v. Tod, 267 U. S. 228, 230 (1925) (despite nine years’ presence in the United States, an “excluded” alien “was still in theory of law at the boundary line and had gained no foothold in the United States”); Leng May Ma v. Barber, 357 U. S. 185, 188-190 (1958) (alien “paroled” into the United States pending admissibility had not effected an “entry”). It is well established that certain constitutional protections available to persons inside the United States are unavailable to aliens outside of our geographic borders. See United States v. Verdugo-Urquidez, 494 U. S. 259, 269 (1990) (Fifth Amendment’s protections do not extend to aliens outside the territorial boundaries); Johnson v. Eisentrager, 339 U. S. 763, 784 (1950) (same). But once an alien enters the country, the legal circumstance changes, for the Due Process Clause applies to all “persons” within the United States, including aliens, whether their presence here is lawful, unlawful, temporary, or permanent. See Plyler v. Doe, 457 U. S. 202, 210 (1982); Mathews v. Diaz, 426 U. S. 67, 77 (1976); Kwong Hai Chew v. Colding, 344 U. S. 590, 596-598, and n. 5 (1953); Yick Wo v. Hopkins, 118 U. S. 356, 369 (1886); cf. Mezei, supra, at 212 (“[A]liens who have once passed through our gates, even illegally, may be expelled only after proceedings conforming to traditional standards of fairness encompassed in due process of law”). Indeed, this Court has held that the Due Process Clause protects an alien subject to a final order of deportation, see Wong Wing v. United States, 163 U. S. 228, 238 (1896), though the nature of that protection may vary depending upon status and circumstance, see Landon v. Plasencia, 459 U. S. 21, 32-34 (1982); Johnson, supra, at 770.
In Wong Wing, supra, the Court held unconstitutional a statute that imposed a year of hard labor upon aliens subject to a final deportation order. That case concerned substantive protections for aliens who had been ordered removed, not procedural protections for aliens whose removability was being determined. Cf. post, at 704 (Scalia, J., dissenting). The Court held that punitive measures could not be imposed upon aliens ordered removed because “all persons within the territory of the United States are entitled to the protection” of the Constitution. 163 U. S., at 238 (citing Yick Wo, supra, at 369 (holding that equal protection guarantee applies to Chinese aliens)); see also Witkovich, 353 U. S., at 199, 201 (construing statute which applied to aliens ordered deported in order to avoid substantive constitutional problems). And contrary to Justice Scalia’s characterization, see post, at 703-705, in Mezei itself, both this Court’s rejection of Mezei’s challenge to the procedures by which he was deemed excludable and its rejection of his challenge to continued detention rested upon a basic territorial distinction. See Mezei, supra, at 215 (holding that Mezei’s presence bn Ellis Island was not “considered a landing” and did “not affecft]” his legal or constitutional status (internal quotation marks omitted)).
In light of this critical distinction between Mezei and the present cases, Mezei does not offer the Government significant support, and we need not consider the aliens’ claim that subsequent developments have undermined Mezei’s, legal authority. See Brief for Petitioner in No. 99-7791, p. 23; Brief for Respondent in No. 00-38, pp. 16-17; Brief for Lawyers’ Committee for Human Rights as Amicus Curiae in No. 00-38, pp. 15-20. Nor are we aware of any other authority that would support Justice Kennedy’s limitation of due process protection for removable aliens to freedom from detention that is arbitrary or capricious. See post, at 717-722 (dissenting opinion).
The Government also looks for support to cases holding that Congress has “plenary power” to create immigration law, and that the Judicial Branch must defer to Executive and Legislative Branch decisionmaking in that area. Brief for Respondents in No. 99-7791, at 17, 20 (citing Harisiades v. Shaughnessy, 342 U. S. 580, 588-589 (1952)). But that power is subject to important constitutional limitations. See INS v. Chadha, 462 U. S. 919, 941-942 (1983) (Congress must choose “a epnstitutionally permissible means of implementing” that power); The Chinese Exclusion Case, 130 U. S. 581, 604 (1889) (congressional authority limited “by the Constitution itself and considerations of public policy and justice which control, more or less, the conduct of all civilized nations”). In these cases, we focus upon those limitations. In doing so, we nowhere deny the right of Congress to remove aliens, to subject them to supervision with conditions when released from detention, or to incarcerate them where appropriate for violations of those conditions. See 8 U. S. C. § 1231(a)(3) (1994 ed., Supp. V) (granting authority to Attorney General to prescribe regulations governing supervision of aliens not removed within 90 days); § 1253 (imposing penalties for failure to comply with release conditions). The question before us is not one of “ ‘conferring] on those admitted the right to remain against the national will’” or ‘“sufferance of aliens’” who should be removed. Post, at 703 (Scalia, J., dissenting) (emphasis deleted) (quoting Mezei, 345 U. S., at 222-223 (Jackson, J., dissenting)). Rather, the issue we address is whether aliens that the Government finds itself unable to remove are to be condemned to an indefinite term of imprisonment within the United States.
Nor do the cases before us require us to consider the political branches’ authority to control entry into the United States. Hence we leave no “unprotected spot in the Nation’s armor.” Kwong Hai Chew, 344 U. S., at 602. Neither do we consider terrorism or other special circumstances where special arguments might be made for forms of preventive detention and for heightened deference to the judgments of the political branches with respect to matters of national security. The sole foreign policy consideration the Government mentions here is the concern lest courts interfere with “sensitive” repatriation negotiations. Brief for Respondents in No. 99-7791, at 21. But neither the Government nor the dissents explain how a habeas court’s efforts to determine the likelihood of repatriation, if handled with appropriate sensitivity, could make a significant difference in this respect. See infra, at 699-700.
Finally, the Government argues that, whatever liberty interest the aliens possess, it is “greatly diminished” by their lack of a legal right to “liv[e] at large in this country.” Brief for Respondents in No. 99-7791, at 47; see also post, at 703 (Scalia, J., dissenting) (characterizing right at issue as “right to release into this country”). The choice, however, is not between imprisonment and the alien “living at large.” Brief for Respondents in No. 99-7791, at 47. It is between imprisonment and supervision under release conditions that may not be violated. See supra, at 695 (citing 8 U. S. C. §§ 1231(a)(3), 1253 (1994 ed., Supp. V)); 8 CFR §241.5 (2001) (establishing conditions of release after removal period). And, for the reasons we have set forth, we believe that an alien’s liberty interest is, at the least, strong enough to raise a serious question as to whether, irrespective of the procedures used, cf. post, at 722-724 (Kennedy, J., dissenting), the Constitution permits detention that is indefinite and potentially permanent.
B
Despite this constitutional problem, if “Congress has made its intent” in the statute “clear, 'we must give effect to that intent.’ ” Miller v. French, 530 U. S. 327, 336 (2000) (quoting Sinclair Refining Co. v. Atkinson, 370 U. S. 195, 215 (1962)). We cannot find here, however, any clear indication of congressional intent to grant the Attorney General the power to hold indefinitely in confinement an alien ordered removed. And that is so whether protecting the community from dangerous aliens is a primary or (as we believe) secondary statutory purpose. Cf. post, at 706, 708-709 (Kennedy, J., dissenting). After all, the provision is part of . a statute that has as its basic purpose effectuating an alien’s removal. Why should we assume that Congress saw the alien’s dangerousness as unrelated to this purpose?
The Government points to the statute’s word “may.” But while “may” suggests discretion, it does not necessarily suggest unlimited discretion. In that respect the word “may” is ambiguous. Indeed, if Congress had meant to authorize long-term detention of unremovable aliens, it certainly could have spoken in clearer terms. Cf. 8 U. S. C. § 1537(b)(2)(C) (1994 ed., Supp. V) (“If no country is willing to receive” a terrorist alien ordered removed, “the Attorney General may, notwithstanding any other provision of law, retain the alien in custody” and must review the detention determination every six months).
The Government points to similar related statutes that require detention of criminal aliens during removal proceedings and the removal period, and argues that these show that mandatory detention is the rule while discretionary release is the narrow exception. See Brief for Petitioners in No. 00-38, at 26-28 (citing 8 U. S. C. §§ 1226(c), 1231(a)(2)). But the statute before us applies not only to terrorists and criminals, but also to ordinary visa violators, see supra, at 691; and, more importantly, post-removal-period detention, unlike detention pending a determination of removability or during the subsequent 90-day removal period, has no obvious termination point.
The Government also points to the statute’s history. That history catalogs a series of changes, from an initial period (before 1952) when lower courts had interpreted statutory silence, Immigration Act of 1917, ch. 29, §§ 19, 20, 39 Stat. 889, 890, to mean that deportation-related detention must end within a reasonable time, Spector v. Landon, 209 F. 2d 481, 482 (CA9 1954) (collecting cases); United States ex rel. Doukas v. Wiley, 160 F. 2d 92, 95 (CA7 1947); United States ex rel. Ross v. Wallis, 279 F. 401, 403-404 (CA2 1922), to a period (from the early 1950’s through the late 1980’s) when the statutes permitted, but did not require, post-deportation-order detention for up to six months, Immigration and Nationality Act of 1952, § 242(c), 66 Stat. 210, 8 U. S. C. §§ 1252(c), (d) (1982 ed.); Witkovich, 353 U. S., at 198, to more recent statutes that have at times mandated and at other times permitted the post-deportation-order detention of aliens falling into certain categories such as aggravated felons, Anti-Drug Abuse Act of 1988, § 7343(a), 102 Stat. 4470, 8 U. S. C. § 1252(a)(2) (mandating detention); Immigration Act of 1990, § 504(a), 104 Stat. 5049-5050, 8 U.S.C. §§ 1252(a)(2)(A), (B) (permitting release under certain circumstances); Miscellaneous and Technical Immigration and Naturalization Amendments of 1991, § 306(a)(4), 105 Stat. 1751, 8 U. S. C. § 1252(a)(2)(B) (same).
In early 1996, Congress explicitly expanded the group of aliens subject to mandatory detention, eliminating provisions that permitted release of criminal aliens who had at one time been lawfully admitted to the United States. Antiterrorism and Effective Death Penalty Act of 1996, § 439(c), 110 Stat. 1277. And later that year Congress enacted the present law, which liberalizes pre-existing law by shortening the removal period from six months to 90 days, mandates detention of certain criminal aliens during the removal proceedings and for the subsequent 90-day removal period, and adds the post-removal-period provision here at issue. Illegal Immigration Reform and Immigrant Responsibility Act of 1996, Div. C, §§303, 305,110 Stat. 3009-585, 3009-598 to 3009-599; 8 U. S. C. §§ 1226(c), 1231(a) (1994 ed., Supp. V).
We have found nothing in the history of these statutes that clearly demonstrates a congressional intent to authorize indefinite, perhaps permanent, detention. Consequently, interpreting the statute to avoid a serious constitutional threat, we conclude that, once removal is no longer reasonably foreseeable, continued detention is no longer authorized by statute. See 1 E. Coke, Institutes *70b (“Cessante ra-tione legis cessat ipse lex”) (the rationale of a legal rule no longer being applicable, that rule itself no longer applies).
> — *
The Government seems to argue that, even under our interpretation of the statute, a federal habeas court would have to accept the Government’s view about whether the implicit statutory limitation is satisfied in a particular case, conducting little or no independent review of the matter. In our view, that is not so. Whether a set of particular circumstances amounts to detention within, or beyond, a period reasonably necessary to secure removal is determinative of whether the detention is, or is not, pursuant to statutory authority. The basic federal habeas corpus statute grants the federal courts authority to answer that question. See 28 U. S. C. § 2241(c)(3) (granting courts authority to determine whether detention is “in violation of the .. . laws ... of the United States”). In doing so the courts carry out what this Court has described as the “historic purpose of the writ,” namely, “to relieve detention by executive authorities without judicial trial,” Brown v. Allen, 344 U. S. 443, 533 (1953) (Jackson, J., concurring in result).
In answering that basic question, the habeas court must ask whether the detention in question exceeds a period reasonably necessary to secure removal. It should measure reasonableness primarily in terms of the statute’s basic purpose, namely, assuring the alien’s presence at the moment of removal. Thus, if removal is not reasonably foreseeable, the court should hold continued detention unreasonable and no longer authorized by statute. In that case, of course, the alien’s release may and should be conditioned on any of the various forms of supervised release that are appropriate in the circumstances, and the alien may no doubt be returned to custody upon a violation of those, conditions. See supra, at 695 (citing 8 U. S. C. §§ 1231(a)(3), 1253 (1994 ed., Supp. V); 8 CFR § 241.5 (2001)). And if removal is reasonably foreseeable, the habeas court should consider the risk of the alien’s committing further crimes as a factor potentially justifying confinement within that reasonable removal period. See supra, at 690-692.
We recognize, as the Government points out, that review must take appropriate account of the greater immigration-related expertise of the Executive Branch, of the serious administrative needs and concerns inherent in the necessarily extensive INS efforts to enforce this complex statute, and the Nation’s need to “speak with one voice” in immigration matters. Brief for Respondents in No. 99-7791, at 19. But we believe that courts can take appropriate account of such matters without abdicating their legal responsibility to review the lawfulness of an alien’s continued detention.
Ordinary principles of judicial review in this area recognize primary Executive Branch responsibility. They counsel judges to give expert agencies decisionmaking leeway in matters that invoke their expertise. See Pension Benefit Guaranty Corporation v. LTV Corp., 496 U. S. 633, 651-652 (1990). They recognize Executive Branch primacy in foreign policy matters. See Container Corp. of America v. Franchise Tax Bd., 463 U. S. 159,196 (1983). And they consequently require courts to listen with care when the Government’s foreign policy judgments, including, for example, the status of repatriation negotiations, are at issue, and to grant the Government appropriate leeway when its judgments rest upon foreign policy expertise.
We realize that recognizing this necessary Executive leeway will often call for difficult judgments. In order to limit the occasions when courts will need to make them, we think it practically necessary to recognize some presumptively reasonable period of detention. We have adopted similar presumptions in other contexts to guide lower court determinations. See Cheff v. Schnackenberg, 384 U. S. 373, 379-380 (1966) (plurality opinion) (adopting rule, based on definition of “petty offense” in United States Code, that right to jury trial extends to all cases in which sentence of six months or greater is imposed); County of Riverside v. McLaughlin, 500 U. S. 44, 56-58 (1991) (O’Connor, J.) (adopting presumption, based on lower court estimate of time needed to process ar-restee, that 48-hour delay in probable-cause hearing after arrest is reasonable, hence constitutionally permissible).
While an argument can be made for confining any presumption to 90 days, we doubt that when Congress shortened the removal period to 90 days in 1996 it believed that all reasonably foreseeable removals could be accomplished in that time. We do have reason to believe, however, that Congress previously doubted the constitutionality of detention for more than six months. See Juris. Statement in United States v. Wiikovich, O. T. 1956, No. 295, pp. 8-9. Consequently, for the sake of uniform administration in the federal courts, we recognize that period. After this 6-month period, once the alien provides good reason to believe that there is no significant likelihood of removal in the reasonably foreseeable future, the Government must respond with evidence sufficient to rebut that showing. And for detention to remain reasonable, as the period of prior post-removal confinement grows, what counts as the “reasonably foreseeable future” conversely would have to shrink. This 6-month presumption, of course, does not mean that every alien not removed must be released after six months. To the contrary, an alien may be held in confinement until it has been determined that there is no significant likelihood of removal in the reasonably foreseeable future.
V
The Fifth Circuit held Zadvydas’ continued detention lawful as long as “good faith efforts to effectuate... deportation continue” and Zadvydas failed to show that deportation will prove “impossible.” 185 F. 3d, at 294, 297. But this standard would seem to require an alien seeking release to show the absence of any prospect of removal — no matter how unlikely or unforeseeable — which demands more than our reading of the statute can bear. The Ninth Circuit held that the Government was required to release Ma from detention because there was no reasonable likelihood of his removal in the foreseeable future. 208 F. 3d, at 831. But its conclusion may have rested solely upon the “absence” of an “extant or pending” repatriation agreement without giving due weight to the likelihood of successful future negotiations. See id., at 831, and n. 30. Consequently, we vacate the judgments below and remand both cases for further proceedings consistent with this opinion.
It is so ordered.