#### Amadou Lamine DIOUF, Petitioner-Appellant, v. Janet NAPOLITANO, Secretary, Department of Homeland Security;* Julie L. Myers, Assistant Secretary, United States Immigration and Customs Enforcement; Norma Bonales-Garibay, Field Office Director U.S. Immigration and Customs Enforcement; George Molinar, Chief of Detention and Removal Operations, San Pedro Detention Facility; Stuart Cortez, Officer-in-Charge, San Pedro Detention Facility; Eric H. Holder Jr., Attorney General,** Respondents-Appellees.

No. 09-56774.

United States Court of Appeals, Ninth Circuit.

Argued and Submitted Oct. 4, 2010.

Filed March 7, 2011.

*1082Judy Rabinovitz (argued), Farrin R. Anello and Tanaz Moghadam, ACLU Foundation Immigrants’ Rights Project, New York, NY; Peter J. Eliasberg, Ahílan T. Arulanantham and Jennifer Stark, ACLU Foundation of Southern California, Los Angeles, CA; Cecillia D. Wang, ACLU Foundation Immigrants’ Rights Project, San Francisco, CA; and Jayashri Srikantiah, Stanford Law School Immigrants’ Rights Clinic, Stanford, CA, for the petitioner-appellant.

Theodore W. Atkinson (argued), Office of Immigration Litigation, Washington, D.C., Tony West, Assistant Attorney General, Civil Division, David J. Kline, Director, District Court Section, Office of Immigration Litigation, Victor M. Lawrence, Principal Assistant Director, and Gjon Juncaj, Senior Litigation Counsel, Office of Immigration Litigation, Washington, D.C., for the respondents-appellees.

Charles Roth, National Immigrant Justice Center, Chicago, IL, for amicus curiae National Immigrant Justice Center.

Before: CYNTHIA HOLCOMB HALL, RAYMOND C. FISHER and JAY S. BYBEE, Circuit Judges.***

*

 Janet Napolitano is substituted for her predecessor, Michael Chertoff, as Secretary of Homeland Security, pursuant to Fed. R.App. P. 43(c)(2).

**

 Eric H. Holder Jr. is substituted for his predecessor, Michael B. Mukasey, as Attorney General of the United States, pursuant to Fed. R.App. P. 43(c)(2).

***

 Before her untimely death, Judge Hall fully participated in the argument and the post-argument conference of the panel and concurred fully in this opinion.

OPINION

FISHER, Circuit Judge:

We hold that an individual facing prolonged immigration detention under 8 U.S.C. § 1231(a)(6) is entitled to release on bond unless the government establishes that he is a flight risk or a danger to the community. We accordingly reverse the district court’s denial of petitioner’s motion for a preliminary injunction.

Background1

Amadou Lamine Diouf, a citizen of Senegal, was admitted to the United States on a student visa in 1996. The visa expired in June 2002. In December 2002, Diouf was found in possession of less than 30 grams of marijuana and charged with a misdemeanor. He pled guilty the following month.

The government initiated removal proceedings against Diouf in January 2003, alleging that he was removable because he had remained in the United States after the expiration of his student visa, failed to maintain nonimmigrant status and committed a eontrolled-substance offense. The *1083immigration judge (IJ) determined that Diouf was subject to removal. At Dioufs request, the judge ordered in lieu of removal that he voluntarily depart from the United States by June 24, 2003. The judge also issued an alternate order of removal and ordered that Diouf would be removed to Senegal if he did not depart voluntarily by the specified date. Diouf waived appeal and posted bond on March 3, 2003. Diouf did not petition for review of the voluntary departure order or the alternate removal order.

Following his release, Diouf retained counsel, hoping to reopen the removal proceedings and adjust his status from nonimmigrant alien to lawful permanent resident based on his planned marriage to a United States citizen. He married on June 17, 2003. Although counsel prepared both a motion to reopen the removal proceedings and a request for an extension of the voluntary departure period, he did not file those documents at that time. Meanwhile, the deadline for Dioufs voluntary departure passed.

Upon learning that Diouf remained in the country beyond the June 24, 2003 departure deadline, Immigration and Customs Enforcement (ICE) sent him a notice requiring him to present himself for removal on September 4, 2003. Diouf failed to report as instructed, so ICE cancelled his bond, apprehended him at his home on March 29, 2005 and detained him pending execution of the removal order. ICE made arrangements for Diouf to depart on May 26, 2005 for Senegal. When Diouf refused to leave on that date, ICE continued to detain him.

In late 2005, after obtaining new counsel, Diouf filed a motion to reopen his removal proceedings, arguing that his first attorney had provided ineffective assistance of counsel by failing to file a timely motion to reopen after his marriage, to seek an extension of the voluntary departure date and to appeal the voluntary departure order. The IJ denied the motion to reopen and the Board of Immigration Appeals (BIA) affirmed. Diouf filed a pro se petition for review of that decision in this court and requested a stay of removal. We granted a stay and appointed pro bono counsel to represent him. His petition for review, docketed as No. 06-71922, remains pending before another panel of this court.

Dioufs detention, which began in March 2005, continued throughout this period. To determine whether Dioufs ongoing detention remained justified, ICE conducted post-order custody reviews pursuant to 8 C.F.R. § 241.4 on July 21, 2005 and July 25, 2006. In both instances, ICE determined that Diouf should remain in custody pending removal because his “criminal history and lack of family support” suggested he might flee if released.

In November 2006, Diouf filed a 28 U.S.C. § 2241 petition for writ of habeas corpus in district court. He requested the court to enter a preliminary injunction for immediate release on the grounds that his lengthy detention violated 8 U.S.C. § 1226(a) and the Due Process Clause of the Fifth Amendment.2 As an alternative to immediate release, Diouf requested a preliminary injunction ordering an immigration judge to hold a hearing at which the government would have the burden of justifying his detention. On January 4, 2007, the district court granted a preliminary injunction requiring a bond hearing before an immigration judge. Pursuant to the injunction, the IJ conducted a hearing *1084on February 9, 2007 to determine whether Dioufs prolonged detention remained justified. After receiving evidence from both sides, the immigration judge ruled that Diouf did not present a sufficient danger to the community or risk of flight to justify the detention, which by then had extended over 22 months. Accordingly, the IJ released Diouf on bond the same day.

In September 2008, this court vacated the preliminary, injunction and remanded to the district court. First, we held that at the time Diouf filed his habeas petition, he was detained under 8 U.S.C. § 1231(a)(6), not § 1226(a), as Diouf and the district court had erroneously assumed. *See Diouf I,*542 F.3d at 1228-32. Second, we held that Dioufs detention was authorized by statute because, although it was prolonged, it was not indefinite. *See id.*at 1232-33. Third, we held that the injunction constituted an abuse of discretion insofar as it relied on the erroneous premise that Diouf was being detained under § 1226(a). *See id.*at 1233-35. Finally, we remanded to the district court to determine in the first instance “whether aliens such as Diouf, who are detained under § 1231(a)(6), are entitled to receive bond hearings and to obtain release on bond unless the Government proves that they are a danger or a flight risk.” *Id.*at 1234; *cf. Casas-Castrillon v. Dep’t of Homeland Sec.,*535 F.3d 942, 951 (9th Cir.2008) (holding that these procedural safeguards apply to aliens detained under § 1226(a)).

On remand, the district court concluded that individuals facing prolonged detention under § 1231(a)(6) are not entitled to a bond hearing and accordingly denied Dioufs motion for a preliminary injunction. Diouf timely appealed. We have jurisdiction under 28 U.S.C. § 1292(a)(1), and we reverse.3

Standard of Review

We review denial of a preliminary injunction for an abuse of discretion. *See Harris v. Bd. of Supervisors,*366 F.3d 754, 760 (9th Cir.2004). The district court abuses its discretion when it bases its decision on an erroneous legal standard or on clearly erroneous findings of fact. *See id.*Accordingly, whether § 1231(a)(6) requires a bond hearing is a question of law reviewed de novo.

Discussion

We hold that individuals detained under § 1231(a)(6) are entitled to the same procedural safeguards against prolonged detention as individuals detained under § 1226(a).

I.

When the United States commences removal proceedings against an alien, the *1085Attorney General has discretion to detain the alien “pending a decision on whether the alien is to be removed from the United States.” 8 U.S.C. § 1226(a).4,5 If the proceedings result in an order of removal, the Attorney General is required to remove the alien from the United States within a period of 90 days, known as the “removal period.” *See id.*§ 1231(a)(1)(A).6 Detention during the relatively brief removal period is mandatory. *See id.*§ 1231(a)(2). The removal period begins on the latest of the date the order of removal becomes administratively final or, if the alien files a petition for review in the court of appeals and the court of appeals orders a stay of removal, the date of the court of appeals’ final order upholding the order of removal. *See id.*§ 1231(a)(1)(B). At all times before the removal period begins and mandatory detention is authorized by § 1231(a)(2), the alien is subject to discretionary detention under § 1226(a).

If the alien is not removed during the removal period, continued detention is authorized, in the discretion of the Attorney General, by § 1231(a)(6), the statutory provision at issue here. Section 1231(a)(6) authorizes continued detention “beyond the removal period” of an 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.” *Id.*§ 1231(a)(6). Section 1231(a)(6) encompasses aliens such as Diouf, whose collateral challenge to his removal order (a motion to reopen) is pending in the court of appeals, as well as to aliens who have exhausted all direct and collateral review of their removal orders but who, for one reason or another, have not yet been removed from the United States.

II.

In *Casas-Castrillon v. Department of Homeland Security,*535 F.3d 942 (9th Cir.2008), we addressed the prolonged detention of aliens under § 1226(a) while seeking *direct*judicial review of their administratively final orders of removal. The petitioner in that case, a legal permanent resident, had been detained in 2001, when the government commenced removal proceedings against him based on his having been convicted of two crimes involving moral turpitude. *See id.*at 944-45. The petitioner remained in detention for the next seven years. Over that time span, an immigration judge issued an order of removal, the BIA affirmed the order, the petitioner filed a petition for review of the removal order in this court and we granted the petition and remanded the matter to the BIA. *See id.*at 945. The petitioner ultimately filed a habeas petition, arguing that “his prolonged detention without a meaningful opportunity to contest the necessity of continued detention violated his right to procedural due process.” *Id.*We determined that his habeas petition had merit. First, we concluded that in the context of civil immigration proceedings, “prolonged detention without adequate *1086procedural protections would raise serious constitutional concerns.” *Id.*at 950. Second, applying the canon of constitutional avoidance to address those concerns, we held as a matter of statutory interpretation that § 1226(a) requires the Attorney General to provide aliens with a bond hearing before an immigration judge to determine the necessity of their ongoing detention. *See id.*at 950-52.7 We concluded that “an alien is entitled to release on bond unless the ‘government establishes that he is a flight risk or will be a danger to the community.’ ” *Id.*at 951 (quoting *Tijani v. Willis,*430 F.3d 1241, 1242 (9th Cir.2005)).

III.

We now extend *Casas-Castrillon*to aliens detained under § 1231(a)(6). We find no basis for withholding from aliens detained under § 1231(a)(6) the same procedural safeguards accorded to aliens detained under § 1226(a). As was the case in *Casas-Castrillon,*prolonged detention under § 1231(a)(6), without adequate procedural protections, would raise “serious constitutional concerns.” *Casas-Castrillon,*535 F.3d at 950. To address those concerns, we apply the canon of constitutional avoidance and construe § 1231(a)(6) as requiring an individualized bond hearing, before an immigration judge, for aliens facing prolonged detention under that provision. *See id.*at 951. Such aliens are entitled to release on bond unless the government establishes that the alien is a flight risk or will be a danger to the community. *See id.*

IV.

The government’s brief offers several arguments for treating aliens facing prolonged detention under § 1231(a)(6) differently from those detained under § 1226(a). We address these arguments in turn, but find none persuasive.

A. *Direct Versus Collateral Review*

The government’s primary argument for treating § 1226(a) detainees differently from § 1231(a)(6) detainees is that the former are detained while seeking *direct*judicial review of administratively final orders of removal whereas the latter are detained while seeking *collateral*review of final orders of removal (through motions to reopen). According to the government, this distinction matters in two ways: *first,*an alien who is subject to a final order of removal and who is merely attacking removal collaterally has a weaker liberty interest in being free from governmental detention than one who is challenging a removal order on direct review; and, *second,*the government has a stronger interest in detaining an alien who is collaterally attacking a removal order because the alien is closer to the point of actual, physical removal from the United States. As we shall explain, these distinctions may have some marginal validity, but they do not justify disparate treatment of § 1231(a)(6) detainees.

1. *Detainees*’ *Liberty Interest*

The government may be correct that at the margin, § 1231(a)(6) detainees have a lesser liberty interest in freedom *1087from detention.8 Unlike a § 1226(a) detainee, a § 1231(a)(6) detainee is subject to a final order of removal and is thus, at least as a theoretical matter, closer to actual removal from the United States. This difference in status may matter. *See Zadvydas v. Davis,*533 U.S. 678, 694, 121 S.Ct. 2491, 150 L.Ed.2d 653 (2001) (stating that the nature of the due process protection an alien is due “may vary depending upon status and circumstance”); *cf. Demore v. Kim,*538 U.S. 510, 552, 123 S.Ct. 1708, 155 L.Ed.2d 724 (2003) (Souter, J., concurring in part and dissenting in part) (arguing that aliens detained under § 1226(c) should be afforded greater procedural protections than those detained under § 1231(a)(6) because the latter have “already been ordered removed and therefore enjoy[] no lawful immigration status”); *id.*at 560-61, 123 S.Ct. 1708 (suggesting that persons detained “pending removal proceedings” have a “stronger claim” than those detained “after entry of a removal order”). But the government makes too much of this distinction. Regardless of the stage of the proceedings, the same important interest is at stake— freedom from prolonged detention. The liberty interests of persons detained under § 1231(a)(6) are comparable to those of persons detained under § 1226(a).

Minimizing § 1231(a)(6) detainees’ liberty interests also understates the importance of motions to reopen in safeguarding immigrants’ rights. As the Supreme Court has explained, “[t]he purpose of a motion to reopen is to ensure a proper and lawful disposition” of an alien’s claims: it is an *“important safeguard*” of the alien’s rights. *Dada v. Mukasey,*554 U.S. 1, 18, 128 S.Ct. 2307, 171 L.Ed.2d 178 (2008) (emphasis added). Motions to reopen afford aliens a means to challenge in absentia removal orders, to set aside removal orders when an underlying conviction upon which the removal was based has been vacated, to raise (as in Dioufs case) a claim that the removal order resulted from ineffective assistance of counsel and to raise an argument that new developments would show that removal to a particular country would result in torture or persecution. *See*Amicus Br. of Nat’l Immigrant Justice Ctr. at 4-23.

2. *The Government’s Interest*

The government also may be correct that it has a marginally greater interest in detaining § 1231(a)(6) detainees than § 1226(a) detainees. The primary purpose of § 1231(a)(6) is “assuring the alien’s presence at the moment of removal.” *Zadvydas,*533 U.S. at 699, 121 S.Ct. 2491. This interest strengthens as actual removal from the United States becomes closer in time and more certain to occur. In part, this is because an alien’s incentive to flee may increase as the removal date approaches.

The distinctions between § 1226(a) and § 1231(a)(6), however, are not substantial enough to justify denying a bond hearing to all aliens subject to extended detention under § 1231(a)(6). First, the government *1088has an interest in ensuring that aliens are available for removal if their legal challenges do not succeed whether they are detained under § 1226(a) or § 1231(a)(6). Second, in either circumstance, the government’s interest in the prompt removal of aliens who have exhausted their legal challenges is served by the bond hearing process itself. If the alien poses a flight risk, detention is permitted.

Third, the same concerns about prolonged detention arise irrespective of whether an alien has petitioned for review of an order of removal (direct review) or an order denying a motion to reopen (collateral review). In both situations, it may take years for the petitions for review to be resolved. Dioufs petition for review from the BIA’s decision denying his motion to reopen, for example, was filed in 2006 and remains pending today — more than four years later. Thus, although aliens detained pending collateral review may on average be somewhat closer to removal than those detained pending direct review, detention under both circumstances raises substantially the same due process concerns. Fourth, although aliens detained under § 1231(a)(6) may on average be less likely to succeed in setting aside their orders of removal, their motions to reopen certainly *may*succeed, and in many cases do. It is thus far from certain that § 1231(a)(6) detainees such as Diouf will be removed.

Of course, an alien’s status, as well as the stage of the proceedings, may be relevant to an immigration judge’s assessment of whether detention is necessary to ensure an alien’s availability for removal. As an alien’s hopes of setting aside a removal order fade, the risk of flight may increase. In the same vein, changed circumstances may justify the revocation of release that at one time was properly granted. Nonetheless, although these factors are important enough for an immigration judge to consider at bond hearings, they do not warrant categorically denying to § 1231(a)(6) detainees the right to a bond hearing that § 1226(a) detainees already enjoy.

In sum, although there are shades of difference, § 1231(a)(6) detainees and § 1226(a) detainees are similarly situated. Both may be detained for prolonged periods; both may succeed in setting aside their orders of removal; and both may be detained without bond when necessary to ensure their availability for removal.

B. *Legal Permanent Resident Status*

The government also posits that *Casas-Castrillon*is distinguishable because Diouf was an admitted alien before he was ordered removed, whereas the alien in *Casas-Castrillon*was a legal permanent resident. The government may be correct that legal permanent residents, or LPRs, are entitled to greater due process protections than other aliens. *See Demore,*538 U.S. at 547, 123 S.Ct. 1708 (Souter, J., concurring in part and dissenting in part) (“[W]e have accorded LPRs greater protections than other aliens under the Due Process Clause.”); *Zadvydas,*533 U.S. at 694, 121 S.Ct. 2491 (opining that the nature of due process protection may vary depending upon an alien’s status). Because we are construing a statute under the canon of constitutional avoidance, however, whether Diouf was a legal permanent resident is irrelevant. What matters is that § 1231(a)(6), like § 1226(a), applies to *some*legal permanent residents. *See Clark v. Martinez,*543 U.S. 371, 380-81, 125 S.Ct. 716, 160 L.Ed.2d 734 (2005) (“[W]hen deciding which of two plausible statutory constructions to adopt, a court must consider the necessary consequences of its choice. If one of them would raise a multitude of constitutional problems, the *1089other should *prevail*— whether *or not those constitutional problems pertain to the particular litigant before the Court.”*(emphasis added)). We therefore cannot distinguish *Casas-Castrillon*on the basis that Diouf himself was not a legal permanent resident.9

C. *Express Statutory Authority for Release on Bond*

We also reject the government’s contention that *Casas-Castrillon*is distinguishable on the theory that the statutory framework there “already authorized” release on bond, whereas § 1231(a)(6) does not. We recognize that § 1226(a) *expressly*authorizes release on bond, *see*8 U.S.C. § 1226(a)(2), whereas § 1231(a)(6) does not. But we have no doubt that bond is also authorized under § 1231(a)(6), as we have held and as Department of Homeland Security (DHS) regulations acknowledge. *See Diouf I,*542 F.3d at 1234 (“We have specifically construed § 1231(a)(6) to permit release on bond.”); 8 C.F.R. § 241.5(b). We thus see no meaningful distinction between applying the doctrine of constitutional avoidance here and applying it in *Casas-Castrillon.*

D. *Deference to DHS Regulations*

We also disagree with the government’s contention that DHS regulations provide sufficient safeguards to protect the liberty interests of § 1231(a)(6) detainees, obviating the need for hearings before an immigration judge in all cases. The government argues that we should accord *Chevron*deference to these regulations, which address the issue of prolonged detention under § 1231(a)(6) by providing for one or more “post-order custody reviews” by DHS employees, but not for an independent determination of the need for continued detention by a neutral decisionmaker such as an immigration judge. *See*8 C.F.R. §§ 241.4, 241.13, 241.14.10

Under the DHS regulations, the custody reviews are supposed to take place within 90 days, 180 days and 18 months of confinement. During the 90-day removal period, DHS is required to detain the alien. *See*8 U.S.C. § 1231(a)(2). Upon conclusion of the 90-day removal period the statute authorizes continued detention in the discretion of the Attorney General. *See id.*§ 1231(a)(6). Under the regulations, DHS is required to conduct an initial custody review before the 90-day removal period expires if the alien’s removal cannot be accomplished during the removal period (“the 90-day review”). *See*8 C.F.R. § 241.4(k)(l)(i). The alien is afforded certain rights with respect to this review, including the rights to receive written notice of the review, to submit information in writing to support release and to be assisted by any individual of his or her choosing in preparing or submitting information in response to the notice. *See id.*§ 241.4(h)(l)-(2). At the conclusion of the review, DHS may either release the alien on supervised release, *see 8*U.S.C. § 1231(a)(3), or continue the alien’s detention beyond the removal period under § 1231(a)(6), pending removal or further review of his or her custody status. *See*8 C.F.R. § 241.4(k)(l)(i). If the alien is not *1090released or removed at the time of the 90-day review, he or she will receive a second review three months later, or after 180 days have passed from the date the removal period began (“the 180-day review”). *See id.*§ 241.4(k) (2) (ii). If the alien is not released following the 180-day review, a subsequent review will be commenced within approximately one year after the 180-day review — i.e., 18 months after the beginning of the removal period. *See id.*§ 241.4(k) (2) (iii).

The government contends that these regulations provide adequate procedures to protect aliens’ liberty interests and that we should defer to them under *Chevron, U.S.A., Inc. v. Natural Resources Defense Council, Inc.,*467 U.S. 887, 104 S.Ct. 2778, 81 L.Ed.2d 694 (1984). Under *Chevron’s*two-step framework, the court first must determine “whether Congress has directly spoken to the precise question at issue. If the intent of Congress is clear,” then the court “must give effect to the unambiguously expressed intent of Congress.” *Id.*at 842-43, 104 S.Ct. 2778. Under the second step, “if the statute is silent or ambiguous with respect to the specific issue, the question for the court is whether the agency’s answer is based on a permissible construction of the statute.” *Id.*at 843, 104 S.Ct. 2778.

We may not defer to DHS regulations interpreting § 1231(a)(6), however, if they raise grave constitutional doubts. *See, e.g., Kim Ho Ma v. Ashcroft,*257 F.3d 1095, 1105 n. 15 (9th Cir.2001) (“Although we recognize that, in general, the Attorney General’s interpretation of the immigration laws is entitled to substantial deference, ... *Chevron*principles are not applicable where a substantial constitutional question is raised by an agency’s interpretation of a statute it is authorized to construe.”) (citations omitted); *Williams v. Babbitt,*115 F.3d 657, 662-63 (9th Cir.1997) (holding that courts should not apply *Chevron*deference to an agency’s interpretation that “raises *serious*constitutional concerns”); *see also Hernandez-Carrera v. Carlson,*547 F.3d 1237, 1249 (10th Cir.2008) (“It is well established that the canon of constitutional avoidance does constrain an agency’s discretion to interpret statutory ambiguities, even when *Chevron*deference would otherwise be due.”); *Nat’l Mining Ass’n v. Kempthome,*512 F.3d 702, 711 (D.C.Cir. 2008) (“This canon of constitutional avoidance trumps *Chevron*deference, and we will not submit to an agency’s interpretation of a statute if it ‘presents serious constitutional difficulties.’ ” (quoting *Chamber of Commerce v. FEC,*69 F.3d 600, 605 (D.C.Cir.1995)) (citation omitted)).11

In *Mathews v. Eldridge,*424 U.S. 319, 96 S.Ct. 893, 47 L.Ed.2d 18 (1976), the Supreme Court articulated a balancing test for deciding what procedures are required when there has been a deprivation of liberty and due process is required. This test

> generally requires consideration of three distinct factors: First, the private interest that will be affected by the official action; second, the risk of an erroneous deprivation of such interest through the procedures used, and the probable value, if any, of additional or substitute procedural safeguards; and finally, the Government’s interest, including the function involved and the fiscal and administrative burdens that the additional *1091or substitute procedural requirement would entail.

*Id.*at 335, 96 S.Ct. 893.

Here, the DHS regulations providing for the initial, 90-day review do not raise serious constitutional concerns. Our focus here, as in *Casas-Castrillon,*is on *prolonged*detention. The 90-day review authorizes detention for only an additional 90 days, bringing the alien’s period of detention (including the removal period) to 180 days. Detention during this period certainly affects aliens’ interests in freedom from confinement, and requires that adequate procedural safeguards be in place to protect against the erroneous deprivation of liberty. But given the relatively limited period of detention involved, and in view of the *Mathews*factors as a whole, the process afforded by the DHS regulations is adequate.

The DHS regulations governing the 180-day review, however, *do*raise serious constitutional concerns. When the 180-day review takes place, the alien has been detained for approximately six months and the review, if unfavorable to the alien, authorizes detention for an additional year. At this point, the alien’s continuing detention becomes prolonged. *See Casas-Castrillon,*535 F.3d at 950 (distinguishing the prolonged detention at issue in that case (seven years) from *Demore,*in which the Supreme Court upheld a six-month detention under § 1226(c) “with the specific understanding that § 1226(c) authorized mandatory detention only for the ‘limited period of [the alien’s] removal proceedings,’ which the Court estimated ‘lasts roughly a month and a half in the vast majority of cases in which it is invoked, and about five months in the minority of cases in which the alien chooses to appeal’ his removal order to the BIA”) (quoting *Demore,*538 U.S. at 530, 123 S.Ct. 1708); *see also Zadvydas,*533 U.S. at 701, 121 S.Ct. 2491 (treating six months as a “presumptively reasonable period of detention” in a related context). When the period of detention becomes prolonged, “the private interest that will be affected by the official action,” *Mathews,*424 U.S. at 335, 96 S.Ct. 893, is more substantial; greater procedural safeguards are therefore required. *See Zadvydas,*533 U.S. at 701, 121 S.Ct. 2491 (explaining that the due process analysis changes as “the period of ... confinement grows”).

Thus, at the 180-day juncture, the DHS regulations are appropriate but not alone sufficient to address the serious constitutional concerns raised by continued detention. The regulations do not afford adequate procedural safeguards because they do not provide for an in-person hearing, they place the burden on the alien rather than the government and they do not provide for a decision by a neutral arbiter such as an immigration judge.12*See Casas-Castrillon,*535 F.3d at 951-52 (holding that the post-order custody review “falls far short of the procedural protections afforded in ordinary bond hearings, where aliens may contest the necessity of their detention before an immigration judge and have an opportunity to appeal that determination to the BIA”); *see also Zadvydas,*533 U.S. at 692, 121 S.Ct. 2491 (holding that indefinite detention under § 1231(a)(6) raised serious constitutional concerns, in part because “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”). When detention crosses the six-month threshold and release or *1092removal is not imminent, the private interests at stake are profound.13 Furthermore, the risk of an erroneous deprivation of liberty in the absence of a hearing before a neutral decisionmaker is substantial. The burden imposed on the government by requiring hearings before an immigration judge at this stage of the proceedings is therefore a reasonable one.

Diouf s own ease illustrates why a hearing before an immigration judge is a basic safeguard for aliens facing prolonged detention under § 1231(a)(6). The government detained Diouf in March 2005. DHS conducted custody reviews under § 241.4 in July 2005 and July 2006. In both instances, DHS determined that Diouf should remain in custody pending removal because his “criminal history and lack of family support” suggested he might flee if released. In February 2007, however, an immigration judge determined that Diouf was *not*a flight risk and released him on bond. If the district court had not ordered the bond hearing on due process grounds, Diouf might have remained in detention until this day. To address these concerns, aliens who are denied release in their 180-day reviews must be afforded the opportunity to challenge their continued detention in a hearing before an immigration judge.

Conclusion

We hold that an alien facing prolonged detention under § 1231(a)(6) is entitled to a bond hearing before an immigration judge and is entitled to be released from detention unless the government establishes that the alien poses a risk of flight or a danger to the community. We accordingly reverse the order of the district court denying Diouf s motion for a preliminary injunction.

REVERSED and REMANDED.

1

. We provided a more detailed summary of the factual and procedural background in a previously published opinion, *Diouf v. Mukasey,*542 F.3d 1222 (9th Cir.2008) *(“Diouf I*”).

2

. As we explained in *Diouf I,*542 F.3d at 1229, at that time Diouf actually was detained under § 1231(a)(6), not § 1226(a).

3

. Before oral argument, we asked the parties to brief whether Dioufs claims have become moot given that he has been free on bond since February 2007 and the government has not to date elected to redetain him (despite our decision vacating the preliminary injunction that had led to the immigration court hearing that had ordered him released on bond). Consistent with the position taken by both sides in their supplemental briefing, we are satisfied that his claims have not become moot. The voluntary cessation exception to mootness applies because — absent action by this court — the government could redetain Diouf, and deny him a bond hearing, at any time. *See Friends of the Earth, Inc. v. Laidlaw Envtl. Servs., Inc.,*528 U.S. 167, 190, 120 S.Ct. 693, 145 L.Ed.2d 610 (2000) (“[A] defendant claiming that its voluntary compliance moots a case bears the formidable burden of showing that it is absolutely clear the allegedly wrongful behavior could not reasonably be expected to recur.”). The government has offered no assurance that Diouf will not be redetained; *Picrin-Peron v. Rison,*930 F.2d 773, 775-76 (9th Cir.1991), is therefore distinguishable.

4

. For aliens who have been convicted of certain crimes, including aggravated felonies, detention during this period is mandatory. *See*8 U.S.C. § 1226(c).

5

. On March 1, 2003, various immigration enforcement responsibilities of the Attorney General were transferred to the Secretary of the newly created Department of Homeland Security. *See*Homeland Security Act of 2002, Pub.L. No. 107-296, 116 Stat. 2135. For sake of convenience, in this opinion we refer to the Attorney General rather than the Secretary of Homeland Security to maintain conformity with the language of the statutes themselves.

6

. The removal period may be extended beyond 90 days if the alien fails to cooperate in his departure or removal from the United States. See 8 U.S.C. § 1231(a)(1)(C).

7

. The canon of constitutional avoidance is a "cardinal principle” of statutory interpretation. *Zadvydas v. Davis,*533 U.S. 678, 689, 121 S.Ct. 2491, 150 L.Ed.2d 653 (2001). "[Wjhen- 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.” *Id.*(quoting *Crowell v. Benson,*285 U.S. 22, 62, 52 S.Ct. 285, 76 L.Ed. 598 (1932)) (internal quotation marks omitted).

8

. To the extent the government contends that aliens detained under § 1231(a)(6) possess *no*liberty interest in freedom from detention, we cannot agree. In *Zadvydas,*the Supreme Court rejected the argument that § 1231(a)(6) detainees possess no liberty interest in freedom from civil detention merely because they lack a “legal right” to live at large in the United States. *See Zadvydas,*533 U.S. at 696, 121 S.Ct. 2491. In *Casas-Castrillon,*moreover, we made clear that this liberty interest applies not only to indefinite detention, but also to prolonged detention. *See Casas-Castrillon,*535 F.3d at 950 ("We conclude that prolonged detention without adequate procedural protections would raise serious constitutional concerns.”). Any suggestion that persons in Dioufs position lack a liberty interest against prolonged detention is thus untenable.

9

. In *Diouf I,*we noted that Diouf was not a legal permanent resident in order to give the parties the opportunity to address on remand whether this distinction matters to the analysis. *See Diouf I,*542 F.3d at 1234-35. For the reasons given in *Clark,*we have found no basis for distinguishing *Casas-Castrillon*on this basis.

10

. The government modified these regulations in response to the Supreme Court's *Zadvydas*decision. *See*Continued Detention of Aliens Subject to Final Orders of Removal, 66 Fed.Reg. 56967, 56969 (Nov. 14, 2001).

11

. We have held that the constitutional avoidance canon plays no role during step two in the *Chevron*framework. *See Morales-Izquierdo v. Gonzales,*486 F.3d 484, 493 (9th Cir. 2007) (en banc). But the canon applies at *Chevron*step one, because it is "a means of giving effect to congressional intent.” *Clark,*543 U.S. at 382, 125 S.Ct. 716.

12

. Under the regulations, an in-person hearing is permitted, but not required. *See*8 C.F.R. § 241.4(h)(1).

13

. If the 180-day threshold has been crossed, but the alien’s release or removal is imminent, DHS is not required to conduct a 180-day review, *see*8 C.F.R. § 241.4(k)(3), and neither should the government be required to afford the alien a hearing before an immigration judge. As a general matter, detention is prolonged when it has lasted six months and is expected to continue more than minimally beyond six months. By the same token, DHS should be encouraged to afford an alien a hearing before an immigration judge *before*the 180-day threshold has been reached if it is practical to do so and it has already become clear that the alien is facing prolonged detention. When, for example, this court grants a stay of removal in connection with an alien's petition for review from a denial of a motion to reopen, the alien's prolonged detention becomes a near certainty.