The question we must answer is whether the United States can remove aliens to Somalia, a country that does not have a functioning government to accept them. In a well-reasoned opinion, the district court found that it cannot. See Ali v. Ashcroft, 213 F.R.D. 390 (W.D.Wash.2003). We agree with the district court and therefore affirm. We have jurisdiction pursuant to 28 U.S.C. §§ 1291 and 2253.
Tom Ridge, Secretary of the Department of Homeland Security, the Bureau of Immigration and Customs Enforcement, and officials of the former Immigration and Naturalization Service (“INS”)1 (collectively, the “government”) appeal the district court’s order granting a petition for a writ of habeas corpus. Petitioners-Appellees, natives and citizens of Somalia, sought an order enjoining the INS from removing them to Somalia because there is no government in Somalia to accept them. Petitioners also sought certification of a nationwide habeas and declaratory class composed of all persons in the United States who are subject to orders of removal to Somalia. The district court granted a permanent injunction and the motion for class certification. The court ordered the INS not to remove any person in the nationwide class to Somalia and ordered the release of three of the named petitioners.
*877BACKGROUND
There are four named petitioners on appeal: Yusuf Ali Ali, Mohamed Aweys, Mohamed Hussein Hundiye, and Gama Kalif Mohamud. All four were ordered removed from the United States on various dates in 2000 and 2001, but each had been released from INS custody because removal to Somalia “was not likely to occur in the reasonably foreseeable future.” Ali, 213 F.R.D. at 397. Mohamud was taken back into custody in June 2000 for alleged violations of the conditions of his release. The other three petitioners were re-detained in November 2002 because “the local District Director’s office was informed that plans were underway for [their] imminent removal to Somalia.” Id.
In response to their renewed detention, Petitioners filed a petition for writ of habe-as corpus under 28 U.S.C. § 2241, seeking to enjoin the INS from removing them to Somalia because Somalia does not have a government recognized by the United States and thus could not accept them. Petitioners contended that removing them to Somalia “without acceptance by a stable government” would subject them to “great risk of robbery, enslavement, injury or death.” The district court granted a temporary restraining order enjoining the INS from removing Petitioners to Somalia or any other non-designated country.
Petitioners then filed an amended habe-as petition, raising the issue on behalf of themselves and a nationwide class. In December 2002, the district court granted Petitioners’ motion for a temporary restraining order on behalf of the nationwide class. After hearing oral argument, the court orally granted a preliminary injunction and certified a nationwide class. Following further briefing, the court declared the injunction permanent. The government filed a timely notice of appeal.
STANDARD OF REVIEW
The district court’s decision to grant a petition for writ of habeas corpus filed pursuant to 28 U.S.C. § 2241 is subject to de novo review. Angulo-Dominguez v. Ashcroft, 290 F.3d 1147, 1149 (9th Cir.2002). Whether the district court had jurisdiction over a habeas petition is also reviewed de novo. Barapind v. Reno, 225 F.3d 1100, 1109 (9th Cir.2000). The district court’s decision to grant a permanent injunction is reviewed for an abuse of discretion, but the rulings of law underlying the grant of injunctive relief are reviewed de novo. Biodiversity Legal Found, v. Badgley, 309 F.3d 1166, 1176 (9th Cir.2002); Walters v. Reno, 145 F.3d 1032, 1047 (9th Cir.1998). The district court’s factual findings are entitled to deference unless clearly erroneous. Walters, 145 F.3d at 1047.
DISCUSSION
We first address the government’s challenges to the district court’s jurisdiction. Second, we turn to the government’s argument that the district court erroneously concluded that 8 U.S.C. § 1231 does not allow the INS to remove an alien unless the country of removal accepts the alien. Third, we consider the propriety of the district court’s certification of the nationwide habeas class. Finally, we address the district court order that three of the four named Petitioners be released from custody.
I. District Court Jurisdiction over Ha-beas Petition
A. Administrative Exhaustion
The government argues that Petitioners failed to exhaust their administrative remedies as required by 8 U.S.C. § 1252(d)(1), precluding judicial review. Section 1252(d)(1) provides that “[a] court *878may review a final order of removal only if ... the alien has exhausted all administrative remedies available to the alien as of right.” We have previously drawn a distinction, however, “between jurisdiction to rule on the merits of an individual deportation order and jurisdiction to rule on an alleged pattern and practice of constitutional or statutory violations.” El Rescate Legal Servs., Inc. v. Executive Office of Immigration Review, 959 F.2d 742, 746 (9th Cir.1992), as amended.
Contrary to the government’s contention, Petitioners do not simply challenge the validity of their orders of removal. Instead, they question whether the statute grants the INS authority to remove them to a country that cannot accept them. Thus, this case is similar to El Rescate, in which we held that administrative exhaustion was not required where, rather than challenging “the validity of any deportation or exclusion order or of any ruling in an immigration proceeding,” the appellees were challenging the INS’ failure to require translation of all deportation proceedings. Id. at 747. We therefore agree with the district court that § 1252(d)(1) does not apply here.
A prudential exhaustion requirement may also be applied where agency expertise requires the agency to develop a proper record, relaxation of the exhaustion requirement would encourage deliberate bypass of the administrative scheme, and administrative review would allow the agency to correct its own mistakes. El Rescate, 959 F.2d at 747. Each of the factors involved in prudential exhaustion weighs against applying a prudential exhaustion requirement here. Further development of the record is unnecessary because Petitioners have raised a purely legal question. Moreover, the INS’ position — that it is statutorily authorized to remove Petitioners to a country that cannot accept them — is set, making it likely that recourse to administrative remedies would be futile. See id. at 747-48 (stating that it was unrealistic to require the plaintiffs to exhaust their administrative remedies where the Board of Immigration Appeals had already announced and reaffirmed its policy); see also Castillo-Villagra v. INS, 972 F.2d 1017, 1024 (9th Cir.1992) (concluding that prudential exhaustion did not apply where the INS had already taken the challenged position in a number of similar cases). Failure to exhaust administrative remedies does not bar judicial review here.
B. 8 U.S.C. § 1252(g)
Under 8 U.S.C. § 1252(g), “no court shall have jurisdiction to hear any cause or claim by or on behalf of any alien arising from the decision or action by the Attorney General to commence proceedings, adjudicate cases, or execute removal orders against any alien.” The district court concluded that Petitioners raised a purely legal question, rather than a challenge to the Attorney General’s discretionary decision to execute their removal. Ali, 213 F.R.D. at 399. The government asserts, however, that Petitioners’ claims fall within the purview of § 1252(g)’s restriction on jurisdiction; consequently, that the district court erred in concluding that it had jurisdiction. We disagree.
The government takes issue with the district court’s finding that Petitioners raise a purely legal question and thus do not challenge the Attorney General’s discretionary decision to execute their removal. See Ali, 213 F.R.D. at 398. We reject this argument. The issue Petitioners raise is the legal question of whether § 1231 authorizes the Attorney General to remove them to a country that does not have a government that can accept them. Cf. *879Walters, 145 F.3d at 1052 (stating that the government did not and could not assert that § 1252(g) prevented the district court from exercising jurisdiction over the plaintiffs’ due process claims because the claims “do not arise from a ‘decision or action by the Attorney General to commence proceedings, adjudicate cases, or execute removal orders against any alien,’ [8 U.S.C. § 1252(g),] but instead constitute ‘general collateral challenges to unconstitutional practices and policies used by the agency’ ”) (quoting McNary v. Haitian Refugee Ctr., Inc., 498 U.S. 479, 492, 111 S.Ct. 888, 112 L.Ed.2d 1005 (1991)).
The government argues that § 1252(g) bars habeas jurisdiction because the statute authorizes only “one avenue for consideration” of a claim arising from the Attorney General’s decision to commence proceedings, adjudicate cases, or execute removal orders. Section 1252(g) does not, however, mention habeas jurisdiction. The government asserts that § 1252(g)’s “displacement of habeas jurisdiction” is manifested by its failure to authorize ha-beas jurisdiction. This argument is foreclosed by our decision in Magana-Pizano v. INS, 200 F.3d 603 (9th Cir.1999), and by recent Supreme Court precedent.
In Magana-Pizano, we held that § 1252(g) did not eliminate all habeas corpus relief. Id. at 609. Relying on the Supreme Court’s narrow construction of § 1252(g) in Reno v. American-Arab Anti-Discrimination Committee, 525 U.S. 471, 119 S.Ct. 936, 142 L.Ed.2d 940 (1999), we reasoned that § 1252(g) does not explicitly refer to habeas jurisdiction under § 2241 and held that § 2241 remained an available remedy. Magana-Pizano, 200 F.3d at 609; see also Kim Ho Ma v. Ashcroft, 257 F.3d 1095, 1101 n. 4 (9th Cir.2001) (relying on Magana-Pizano to hold that § 1252 did not bar consideration of the petitioner’s non-constitutional arguments on habeas corpus).
The Supreme Court’s reasoning in several cases decided after Magana-Pizano supports this interpretation. First, there is no clear statement in § 1252(g) of congressional intent to repeal habeas jurisdiction. See Demore v. Kim, — U.S.-, 123 S.Ct. 1708, 1714, 155 L.Ed.2d 724 (2003) (holding that habeas review was not barred by 8 U.S.C. § 1226(e) because “where a provision precluding review is claimed to bar habeas review, the Court has required a particularly clear statement that such is Congress’ intent,” and § 1226(e) contained no such explicit provision); INS v. St. Cyr, 533 U.S. 289, 298, 121 S.Ct. 2271, 150 L.Ed.2d 347 (2001) (emphasizing “the strong presumption in favor of judicial review of administrative action and the longstanding rule requiring a clear statement of congressional intent to repeal habeas jurisdiction”).
Second, in Zadvydas v. Davis, 533 U.S. 678, 121 S.Ct. 2491, 150 L.Ed.2d 653 (2001), where the petitioner did not seek review of the Attorney General’s exercise of discretion, but instead challenged the Attorney General’s authority under 8 U.S.C. § 1231(a)(6) to detain him beyond the statutory removal period, the Court concluded that “ § 2241 habeas corpus proceedings remain available as a forum for statutory and constitutional challenges to post-removal-period detention.” Id. at 688, 121 S.Ct. 2491. Similarly here, Petitioners question whether the Attorney General has authority under the statute to take the challenged action; Petitioners do not seek review of the Attorney General’s exercise of discretion. Jurisdiction over the habeas petition was not barred by § 1252(g). Accord Jama v. INS, 329 F.3d 630, 632 (8th Cir.2003) (holding that the petitioner’s challenge to the Attorney General’s authority under § 1231(b)(2) to re*880move him to Somalia without establishing that Somalia would accept him was “outside the scope of the jurisdiction-stripping provision of § 1252(g)”); Riley v. INS, 310 F.3d 1253, 1256 (10th Cir.2002) (holding that “[t]he INS [sic] did not strip § 2241 federal habeas jurisdiction in either 8 U.S.C. § 1252(g) ... or 8 U.S.C. § 1105(a) because neither contains a clear statement referencing § 2241 as is required when attempting to remove federal habeas jurisdiction”); Liu v. INS, 293 F.3d 36, 36-41 (2d Cir.2002) (relying on St. Cyr to hold that § 2241 review remained available for non-criminal aliens, “even though, unlike criminal aliens, they continue to enjoy the right to appeal directly from a final order of removal”).
Having concluded that the district court properly exercised jurisdiction over Petitioners’ habeas petition, we now turn to the central issue — the Attorney General’s statutory authority to remove Petitioners to Somalia.
II. Removal under 8 U.S.C. § 1231(b)(2)
Section 1231(b)(2) delineates the process by which the Attorney General determines the country to which an alien can be removed. The first choice, in subparagraph (A)(i), is for the Attorney General to remove the alien to the country that the alien designates. Subparagraph (C) provides, however, that
[t]he Attorney General may disregard a designation under subparagraph (A)(i) if—
(i) the alien fails to designate a country promptly;
(ii) the government of the country does not inform the Attorney General finally, within 30 days after the date the Attorney General first inquires, whether the government will accept the alien into the country;
(iii) the government of the country is not willing to accept the alien into the country; or
(iv) the Attorney General decides that removing the alien to the country is prejudicial to the United States.
§ 1231(b)(2)(C). The statute explicitly provides, therefore, that the government of the country designated by the alien must be willing to accept the alien. Failing that, the Attorney General may move to step two, found in subparagraph (D):
If an alien is not removed to a country designated under subparagraph (A)(i), the Attorney General shall remove the alien to a country of which the alien is a subject, national, or citizen unless the government of the country—
(i) does not inform the Attorney General or the alien finally, within 30 days after the date the Attorney General first inquires or within another period of time the Attorney General decides is reasonable, whether the government will accept the alien into the country; or
(ii) is not willing to accept the alien into the country.
§ 1231(b)(2)(D). Step two, therefore, again provides that the country to which the Attorney General attempts to remove the alien — this time to a country of which the alien is a subject, national, or citizen— must be willing to accept the person. Failing that, subparagraph (E) provides for “additional removal countries”:
If an alien is not removed to a country under the previous subparagraphs of this paragraph, the Attorney General shall remove the alien to any of the following countries:
(i) The country from which the alien was admitted to the United States.
(ii) The country in which is located the foreign port from which the alien left for *881the United States or for a foreign territory contiguous to the United States.
(iii) A country in which the alien resided before the alien entered the country from which the alien entered the United States.
(iv) The country in which the alien was born.
(v) The country that had sovereignty over the alien’s birthplace when the alien was born.
(vi) The country in which the alien’s birthplace is located when the alien is ordered removed.
(vii) If impracticable, inadvisable, or impossible to remove the alien to each country described in a previous clause of this subparagraph, another country whose government will accept the alien into that country.
§ 1231(b)(2)(E).
A. Statutory Construction
The government argues that the plain language of § 1281 authorizes the Attorney General to remove Petitioners to Somalia, their country of birth, without acceptance by the country. It is true that acceptance is explicitly required only in steps one and two, § 1231(b)(2)(C) & (D), and clause (vii) of step three, § 1231(b)(2)(E)(vii). We agree, however, with the careful reasoning of the district court deeming acceptance implicitly required for all removals, and adopt it here.
First, to read § 1231(b)(2)(E)(i)-(vi) as not requiring acceptance by the foreign government would render § 1231(b)(2)(C) and (D) superfluous in the majority of instances because
in a situation where a government has actually denied acceptance of a removable person, a person could be airdropped surreptitiously into that same country if it met the requirements of one of the sub-parts.... The only logical interpretation of the plain meaning that gives effect to all sections of the statute is one that requires government acceptance from “additional” countries listed in § 1231(b)(2)(E)(i-vi).
Ali, 213 F.R.D. at 402-03.
Furthermore, “the plain language of the statute indicates that the option to remove a person to the country in which he or she was born only exists where that country is different from the countries in steps 1 and 2.” Id. at 403. If this were not so, and, for example, the country designated by the alien was the same as his birth country, the anomalous situation could occur where the country designated by the alien in step one refuses to accept the alien yet the INS could still remove the alien to that very same country under step three. “The INS should not be allowed to thwart [the acceptance requirement of step one and step two] by skipping to step 3.” Id.
We recognize that this problem does not arise and the government’s position does not render subsections (C) and (D) superfluous if the country designated by the alien, the country of which the alien is a subject, national, or citizen, and one of the six “additional removal countries” are all different countries. Cf. Jama, 329 F.3d at 634 (concluding that the government’s position does not eviscerate the acceptance requirement of subsection (D) because “[a]n alien is not always a subject, national or citizen of the country in which he was born”). In the most common scenario, however, and in that present in the instant case, the country designated by the alien and the country of which the alien is a subject, national, or citizen is one and the same as the country in which the alien was born. Under step one and step two, the governments of those countries must accept the alien prior to removal. We agree with the district court that “[t]he INS *882should not be allowed to thwart” the acceptance requirement of step one and step two by relying on step three. Ali, 213 F.R.D. at 403.
B. Case Law
Requiring acceptance before removal is consistent with all of the case law that has touched on the question. The one exception is the Eighth Circuit’s decision in Jama, which held that § 1281 (b) (2) (E) (iv) authorized the INS to remove the petitioner to Somalia without establishing that Somalia would accept his return. Jama, 329 F.3d at 633-35. We thus disagree not only with the conclusion of the majority opinion in Jama but also with its statement that there is “no settled judicial construction of the provision in question.” Id. at 634-35. In fact, in his dissenting opinion in Jama, Judge Bye stated that “[f]or nearly a half century, the courts have held the United States cannot deport an alien unless the receiving country advises us it is willing to accept the alien,” and pointed out that the INS’ “long-standing policy and, until recently, practice” had been consistent with this interpretation of the statute. Id. at 635 (Bye, J., dissenting).2
The Second Circuit addressed the predecessor to § 1231, 8 U.S.C. § 1253(a), in United States ex rel. Tom Man v. Murff, 264 F.2d 926 (2d Cir.1959). Former § 1253(a) is essentially identical to § 1231, providing the same three-step process, explicitly requiring acceptance in the first two steps and then, in the third step, listing the six additional countries and stating in the seventh clause that the Attorney General may deport the alien to “any country which is willing to accept such alien into its territory.”3 8 U.S.C. *883§ 1253, historical and statutory notes. The court concluded that deportation under any of the clauses in step three, now found at § 1231(b)(2)(E), was subject to the condition expressed in the seventh clause, that the country be willing to accept the alien.4 Tom Man, 264 F.2d at 928; see also, e.g., Chi Sheng Liu v. Holton, 297 F.2d 740, 743 (9th Cir.1961) (stating that former § 1253(a) “provides that an alien cannot be deported to any country unless its government is ‘willing to accept him into its territory’ ”); Rogers v. Lu, 262 F.2d 471, 471 (D.C.Cir.1958) (affirming, without explanation, the judgment that the Attorney General may not deport the plaintiff to China “until and unless” the government indicates its 'willingness to accept the plaintiff); cf. Pelich v. INS, 329 F.3d 1057, 1061 (9th Cir.2003) (stating that an alien “can be deported to the country of his birth or to a country where he resided prior to entering the United States (assuming these countries would take him)” (citing § 1231(b)(2)(E))); Amanullah v. Cobb, 862 F.2d 362, 368 (1st Cir.1988) (Coffin, J., concurring) (“agreeing] that it is sheer folly to send an alien to another country without any indication that the country will receive the alien”); Lee Wei Fang v. Kennedy, 317 F.2d 180, 185 (D.C.Cir.1963) (“ ‘It must be remembered ... that the deportation of an alien is not a mere matter of taking him beyond the seas and setting him down on foreign soil. It must be carried out through arrangements made with the foreign government.’ ” (quoting Delany v. Moraitis, 136 F.2d 129, 131 (4th Cir.1943))).
The one case cited by the majority opinion in Jama as holding that prior acceptance is not required is In re Niesel, 10 I. & N. Dec. 57, 1962 WL 12904 (BIA 1962). In Niesel, the Board of Immigration Appeals (“BIA”) rejected the alien’s argument that, before deportation to a country can be ordered, the INS must show that the country has agreed to accept the alien. Id. at 59. The BIA distinguished step three from step two of the process, stating that the preliminary inquiry as to whether the country will accept the alien is not required in step three. Id.
Niesel, however, “addressed only the issue of an initial inquiry, not final acceptance of the country to which a person would be returned.” Ali, 213 F.R.D. at 403. Furthermore, not requiring acceptance from the country to which an alien is to be removed is inconsistent with the BIA’s subsequent decision in Matter of *884Linnas, 19 I. & N. Dec. 302, 1985 WL 56051 (BIA 1985).
In Linnas, the alien, a native of Soviet-occupied Estonia, designated Estonia as the country of deportation. Because Estonia was occupied by the U.S.S.R. and the United States did not recognize the legitimacy of this annexation, the alien contended that he should be sent to offices maintained by Estonia in New York City. The BIA rejected this claim, in part because the offices did not satisfy two prerequisites for a “country” as the term was used in former § 1253(a): first, “a foreign place with ‘territory’ in a geographical sense,” and, second, “a ‘government’ in the sense of a political organization that exercises power on behalf of the people subjected to its jurisdiction.” Id. at 307. The Board reasoned that the language of the statute “expressly requires, or has been construed to require, that the ‘government’ of a country selected under any of the three steps must indicate it is willing to accept a deported alien into its ‘territory.’ ” Id.; see also Matter of Anunciacion, 12 I. & N. Dec. 815, 818 (BIA 1968) (relying on former § 1253 and stating that, “obviously, the United States cannot deport an alien to a country which will not accept her”).
Other than the recent Eighth Circuit decision in Jama, the law of the courts of appeals and the BIA supports Petitioners’ position.5 Moreover, an INS policy of requiring acceptance prior to removal is seen in its own regulations, as discussed below.
C. INS Policy and Regulations
In reviewing an agency’s construction of the statute it administers, the first question for the court is “whether Congress has directly spoken to the precise question at issue.” Chevron U.S.A., Inc. v. Natural Res. Def. Council, Inc., 467 U.S. 837, 842, 104 S.Ct. 2778, 81 L.Ed.2d 694 (1984). If so, the court “must give effect to the unambiguously expressed intent of Congress.” Id. at 843, 104 S.Ct. 2778. If, however, the statute is silent or ambiguous regarding the specific issue, the question is “whether the agency’s answer is based on a permissible construction of the statute.” Id.
The government argues that the district court failed to pay deference to INS regulations. The INS’ proposed construction of the statute, however, is not consistent with its own operating instructions and regulations. For example, INS Operating Instruction 243.1(c)(1) states that “deportation cannot be effected until travel documentation has been obtained” from the country to which the alien is to be deported. INS Operations Instructions 243.1, available at http://www.immigration.gov. If the country designated by the alien is unlikely to receive him, a simultaneous request for a travel document is to be made “to the authorities of the country to which he is likely to be deported.” Id. 8 C.F.R. § 241.4(k)(1) provides for a “custody review ... where the alien’s removal, while proper, cannot be accomplished during the[removal] period because no country currently will accept the alien.” Other regulations cited by Petitioners support the conclusion that INS policy has been to remove an alien only to a country that is willing to accept him. See 8 C.F.R. § 241.5(c)(1) (authorizing issuance of employment authorization to an alien released from custody if “[t]he alien cannot be removed because no country will accept the alien”); 8 C.F.R. § 241.13(f) (in considering whether to release an alien from custody, the INS is to consider factors including *885“the views of the Department of State regarding the prospects for removal of aliens to the country or countries in question, and the receiving country’s willingness to accept the alien into its territory”).
In fact, 8 U.S.C. § 1281(a)(7) provides: No alien ordered removed shall be eligible to receive authorization to be employed in the United States unless the Attorney General makes a specific finding that ... the alien cannot be removed due to the refusal of all countries designated by the alien or under this section to receive the alien.
8 U.S.C. § 1231(a)(7). Thus, all indications are that INS policy has been to require a country of removal to accept an alien.
The government’s citation of 8 C.F.R. § 240.10(g) does not support its position. Section 240.10(g) merely states that the INS “may remove the alien to any other country as permitted by” § 1231(b). 8 C.F.R. § 240.10(g). This does not address whether § 1231(b) permits removal to a country that does not have a government to accept the alien. The government’s position is inconsistent with existing INS policy and regulations. The government’s proposed construction of the statute therefore is not entitled to deference. Cf. Defenders of Wildlife v. Norton, 258 F.3d 1136, 1145 n. 11 (9th Cir.2001) (according no deference to a litigating position of the Secretary of the Interior that was inconsistent with prior agency actions).
D. International Law
The district court concluded that Petitioners’ construction of the statute was preferable to the government’s because it was consistent with international law. Ali, 213 F.R.D. at 405 (citing Murray v. The Schooner Charming Betsy, 6 U.S. (2 Cranch) 64, 118, 2 L.Ed. 208 (1804) (stating that “an act of congress ought never to be construed to violate the law of nations, if any other possible construction remains”)); see also Kim Ho Ma, 257 F.3d at 1114 (discussing “the well-established Charming Betsy rule of statutory construction which requires that we generally construe [congressional legislation to avoid violating international law” out of respect for other nations); Restatement (Third) of Foreign Relations Law (1987) (“Where fairly possible, a United States statute is to be construed as not to conflict with international law or with an international agreement with the U.S.”). The district court reasoned that the government did not dispute Petitioners’ contentions that removing them to Somalia would subject them to human rights abuses in violation of “customary international law and provisions of three multilateral treaties to which the United States is a signatory.” Ali, 213 F.R.D. at 405. Because it was undisputed that Petitioners would be at risk of suffering human rights abuses if removed to Somalia, the preferred course was to adopt the construction of the statute that is consistent with international law. Id.
On appeal, the government still does not challenge the assertion that Petitioners would be subject to human rights abuses if removed to Somalia. Rather, it argues that international law has been “trumped by the specific statutory authority promulgated by Congress,” and that the district court erred by using international law to “override” congressional intent expressed in the statute.
The district court did not use international law to override the statute. Rather, the court relied on the principle of construing the statute in a manner that avoids violating international law merely as further support for the construction it adopted. Moreover, the district court’s conclusion that an interpretation of the *886statute should be adopted that would not result in “persecution or deprivation of life in violation of international law,” id., is supported by the United States Policy with Respect to the Involuntary Return of Persons in Danger of Subjection to Torture, which states:
It shall be the policy of the United States not to expel, extradite, or otherwise effect the involuntary return of any person to a country in which there are substantial grounds for believing the person would be in danger of being subjected to torture, regardless of whether the person is physically present in the United States.
United States Policy with Respect to the Involuntary Return of Persons in Danger of Subjection to Torture, Pub.L. No. 105-277, § 2242(a), 112 Stat. 2681, 2681-822 (1998), reprinted in 8 U.S.C. § 1231, historical and statutory notes. “Although Congress may override international law in enacting a statute, we do not presume that Congress had such an intent when the statute can reasonably be reconciled with the law of nations.” Kim Ho Ma, 257 F.3d at 1114 n. 30. The district court did not err in relying on international law to support the construction of the statute that it adopted.
For the foregoing reasons, we hold that § 1231(b)(2) does not authorize the Attorney General to remove Petitioners to Somalia because it lacks a functioning government that can accept them. Next, we consider the government’s arguments regarding the district court’s certification of a nationwide class.
III. Class Certification
A. Jurisdiction
The government asserts that the district court did not have subject matter jurisdiction over the motion for class certification because 8 U.S.C. § 1252(f)(1) restricts the authority to enjoin the operation of § 1231 on a class-wide basis to the Supreme Court. Section 1252(f)(1) provides:
Regardless of the nature of the action or claim or the identity of the ... parties bringing the action, no court (other than the Supreme Court) shall have jurisdiction or authority to enjoin or restrain the operation of the provisions of part IV of this sub-chapter [8 U.S.C. §§ 1221-1231], ... other than with respect to the application of such provisions to an individual alien against whom proceedings under such part have been initiated.
8 U.S.C. § 1252(f)(1).
We agree with the district court that § 1252(f)(1) is inapplicable because Petitioners seek not to enjoin the operation of § 1231(b) but violations of the statute and “to ensure that the provision is properly implemented.” Ali, 213 F.R.D. at 406. This reason is analogous to the reason that we conclude that § 1252(g) does not bar jurisdiction. That is, § 1252(f)(1) limits the district court’s authority to enjoin the INS from carrying out legitimate removal orders. Where, however, a petitioner seeks to enjoin conduct that allegedly is not even authorized by the statute, the court is not enjoining the operation of part IV of subchapter II, and § 1252(f)(1) therefore is not implicated.
We also find persuasive the cases relied on by the district court. In Tefel v. Reno, the district court found that § 1252(f)(1) did not bar injunctive relief for a class because the class members sought not to enjoin the statute but “constitutional violations” and INS “policies and practices.” 972 F.Supp. 608 (S.D.Fla.1997), vacated on other grounds, 180 F.3d 1286 (11th Cir.1999). Thus, they merely sought to implement the statute “under the appropriate *887standard.” Id. at 618; see also Grimaldo v. Reno, 187 F.R.D. 643, 647-48 (D.Colo. 1999) (finding § 1252(f)(1) inapplicable where the plaintiff sought to convert his complaint to a class action “to enjoin alleged constitutional violations by the INS in its administration” of § 1226, not the operation of the statute).
We further note that none of the cases cited by the government addresses the question of whether § 1252(f)(1)’s limit on injunctive relief is inapplicable where an alien seeks to enjoin INS policy or interpretation of a statute, rather than the operation of the statute. In fact, § 1252(f)(1) is not the statute at issue in two of the cases relied on by the government; they only cite § 1252(f)(1) as support for a limitation on judicial review in other contexts.6 See Am. Immigration Lawyers Ass’n v. Reno, 199 F.8d 1352, 1358-60, 1364 (D.C.Cir.2000) (analyzing § 1252(e)(3)(A) for standing purposes, but examining other provisions on judicial review that “strengthen[ ] the judicial presumption against suits seeking relief for a large and diffuse group of individuals, none of whom are parties to the lawsuit”); Van Dinh v. Reno, 197 F.3d 427, 432 (10th Cir.1999) (addressing § 1252(a)(2)(B)(ii), but citing § 1252(f)(1) as one example of a jurisdictional issue in § 1252). We therefore conclude that Petitioners’ contention that the Attorney General’s actions violate § 1231 falls outside the jurisdictional restriction found in § 1252(f)(1).
B. Proper Custodians
The government argues that the Attorney General and the Commissioner of the INS are not the proper respondents in this case because they do not have “day-to-day control” over Petitioners.7 The government cites Brittingham v. United States, 982 F.2d 378 (9th Cir.1992), in which we stated that “[t]he proper respondent in a federal habeas corpus petition is the petitioner’s ‘immediate custodian,’ ” and that the custodian is the person with “ ‘day-today control over the prisoner.’ ” Id. at 379 (quoting Demjanjuk v. Meese, 784 F.2d 1114, 1115 (D.C.Cir.1986) (Bork, J., in camera), and Guerra v. Meese, 786 F.2d 414, 416 (D.C.Cir.1986)). The government therefore contends that the former INS District Director is the proper respondent and challenges the district court’s conclusion that the law regarding immigration habeas petitions is unsettled.
Contrary to the government’s contention, although the principle that the immediate custodian is the proper respondent to a habeas petition is clear, the application of this principle in immigration habeas petitions does not lead to a simple *888resolution of how to identify the proper respondent. See, e.g., Armentero v. INS, 340 F.3d 1058, 1067 (9th Cir.2003) (stating that “neither Supreme Court case law nor our own precedent states a clear path toward identifying the proper respondent or respondents in an immigration detainee’s habeas petition”); Vasquez v. Reno, 233 F.3d 688, 691-92 (1st Cir.2000) (stating that the case law regarding the proper respondent to habeas petitions filed by detained aliens is sparse, incoherent, and in disarray), cert. denied, 534 U.S. 816, 122 S.Ct. 43, 151 L.Ed.2d 15 (2001). Nonetheless, in Armentero, we held that the Attorney General was the proper respondent to an immigration habeas petition, citing the necessity to base the concept of “custodian” “more on the legal reality of control than the technicalities of who administers on a day-to-day basis the facility in which an individual is detained.” Armentero, 340 F.3d at 1070; see also Henderson v. INS, 157 F.3d 106, 125-26 (2d Cir.1998) (emphasizing the Attorney General's “unique role” as the “ultimate decision-maker” in immigration habeas actions, but ultimately declining to decide the issue). Because immigration detainees are often transferred between different institutions around the country, the local INS District Director is a “local figurehead” who is not an appropriate respondent. Armentero, 340 F.3d at 1071-72.
Petitioners are not merely in the custody of the INS District Director but are subject to a removal order that is based on the Attorney General’s interpretation of the statute. Thus, the Attorney General, whose unique role as the ultimate decision-maker is particularly evident here, is the proper respondent. Armentero, 340 F.3d at 1071-72.
C. Nationwide Class
Respondents contend that the district court’s habeas jurisdiction is limited to its territorial jurisdiction and that the court’s certification of a nationwide class accordingly exceeded its jurisdiction. The government cites language in 28 U.S.C. § 2241(a), providing that the district courts may grant writs of habeas corpus “within their respective jurisdictions,” and 28 U.S.C. § 128(b), which specifies the counties comprising the Western District of Washington, where this case was filed.
The district court reasoned that a nationwide class was appropriate because “the INS is uniformly applying the statutory interpretation at issue to all class members,” making it “judicially economical” to hear the case in one court. Ali, 213 F.R.D. at 408. The court further reasoned that a nationwide class would “address[ ] the problem of interstate transportation of individuals subject to final order of removal and the corresponding difficulty in obtaining counsel.” Id. Finally, the court noted that by defining the class to exclude pending cases, it had obviated concerns about impinging on other courts. Id. We agree with the district court.
The government points to the Supreme Court’s admonition that “a federal court when asked to certify a nationwide class should take care to ensure that nationwide relief is indeed appropriate in the case before it, and that certification of such a class would not improperly interfere with the litigation of similar issues in other judicial districts.” Califano v. Yamasaki, 442 U.S. 682, 702, 99 S.Ct. 2545, 61 L.Ed.2d 176 (1979). The Court in Califa-no went on, however, to reject “the extreme position that such a class may never be certified,” and reaffirmed the rule that the certification of a nationwide class is “committed in the first instance to the discretion of the district court.” Id. at 702-03, 99 S.Ct. 2545. More importantly, the Court rejected the argument that the *889district court in that case erred in certifying a nationwide class, stating that
[n]othing in Rule 23 ... limits the geographical scope of a class action that is brought in conformity with that Rule.... Nor is a nationwide class inconsistent with principles of equity jurisprudence, since the scope of injunctive relief is dictated by the extent of the violation established, not by the geographical extent of the plaintiff class. If a class action is otherwise proper, and if jurisdiction lies over the claims of the members of the class, the fact that the class is nationwide in scope does not necessarily mean that the relief afforded the plaintiffs will be more burdensome than necessary to redress the complaining parties.
Id. at 702, 99 S.Ct. 2545 (citation omitted).
In Braden v. 30th Judicial Circuit Court, 410 U.S. 484, 93 S.Ct. 1123, 35 L.Ed.2d 443 (1973), the Supreme Court stated that “the language of § 2241(a) requires nothing more than that the court issuing the writ have jurisdiction over the custodian” and traced developments in ha-beas law indicating the relaxation of habe-as jurisdiction, rejecting “an inflexible jurisdictional rule.” Id. at 495-500, 93 S.Ct. 1123. The Court thus concluded that the Sixth Circuit erred in ordering the dismissal on jurisdictional grounds of a habe-as petition filed by an Alabama state prisoner in federal district court in Kentucky. Id. at 500, 93 S.Ct. 1123.
Califano and Braden together support the conclusion that in a habeas proceeding the district court may certify a nationwide habeas class, provided that the court has personal jurisdiction over the custodian. See id. at 494-95, 93 S.Ct. 1123 (stating that the writ of habeas corpus acts not upon “the prisoner who seeks relief, but upon the person who holds him in what is alleged to be unlawful custody”); Roman, 162 F.Supp.2d at 761 (reasoning that “[o]nce a court takes the step of approving the Attorney General as a proper respondent [to a habeas petition], there would appear to be no jurisdictional reason why the petition could not be heard in any district in which the Attorney General was subject to service of process”). The Attorney General is subject to service of process in Washington, where the long-arm statute “extends jurisdiction to the limit of federal due process.” Chan v. Soc’y Expeditions, Inc., 39 F.3d 1398, 1405 (9th Cir.1994). We therefore affirm the district court’s certification of a nationwide class.
D. Standing
The government points to 28 U.S.C. § 2242, which requires a habeas petition to be signed by the petitioner or by someone acting in his behalf, and contends that the signatures of the four named Petitioners cannot sustain a nationwide habeas class, citing Coalition of Clergy, Lawyers, & Professors v. Bush, 310 F.3d 1153 (9th Cir.2002), cert. denied, — U.S. -, 123 S.Ct. 2073, 155 L.Ed.2d 1060 (2003).
Next friend standing refers to the procedure by which a third party appears in court on behalf of detained prisoners who are themselves unable to seek relief. See id. at 1157-58 (discussing Whitmore v. Ark, 495 U.S. 149, 110 S.Ct. 1717, 109 L.Ed.2d 135 (1990)). “A ‘next friend’ does not himself become a party to the habeas corpus action in which he participates, but simply pursues the cause on behalf of the detained person, who remains the real party in interest.” Whitmore, 495 U.S. at 163, 110 S.Ct. 1717. Unlike Coalition, in which none of the parties who filed the petition was a detainee, here, Petitioners are the detainees. Next friend standing is not at issue. See Ali, 213 F.R.D. at 406 (reasoning that “there is no question that *890Petitioners meet standing requirements because they are parties to the suit”).8
The government further argues that Petitioners’ standing is insufficient to confer next friend standing for class members who have not signed the habeas petition, emphasizing that habeas is an “individual” remedy. In Mead v. Parker, 464 F.2d 1108 (9th Cir.1972), twenty-seven inmates filed a habeas petition that purported to be a class action on behalf of numerous other inmates. We held that the district court erred in holding that “habeas corpus is not an appropriate vehicle for a class action” because, although habeas relates to “the individual petitioner and to his unique problem[,] ... there can be cases ... where the relief sought can be of immediate benefit to a large and amorphous group. In such cases, it has been held that a class action may be appropriate.” Id. at 1112-13; cf. Cox v. McCarthy, 829 F.2d 800, 804 (9th Cir.1987) (stating that, although “[s]uch actions are ordinarily disfavored,” “[t]his court has held that a class action may lie in habeas corpus,” and citing Mead); United States ex rel. Sero v. Preiser, 506 F.2d 1115, 1126-27 (2d Cir.1974) (finding a habeas class action appropriate); Williams v. Richardson, 481 F.2d 358, 361 (8th Cir.1973) (adopting language in Mead and concluding that a class action may be appropriate in a habeas proceeding). Petitioners have clearly established the requisite standing.
E. Federal Rule of Civil Procedure 23
The government contends that the district court erred in looking to Rule 23 for guidance regarding the propriety of certifying a class in this case.9 Federal Rule of Civil Procedure 81 provides that the Federal Rules of Civil Procedure are displaced when the habeas statute provides the rules of practice and procedure, stating that the rules “are applicable to proceedings for ... habeas corpus ... to the extent that the practice in such proceedings is not set forth in statutes of the United States, the Rules Governing Section 2254 Cases, or the Rules Governing Section 2255 Proceedings.” Fed.R.Civ.P. 81(a)(2).
The only provision cited by the government as “displacing” Rule 23 is § 2242’s requirement that a habeas petition be signed by the petitioner or someone acting on his behalf. This provision in no way displaces Rule 23’s provisions regarding class actions. Nor does the government cite any case law to support its argument. The Second Circuit has held that “the precise provisions of Rule 23 do not apply to habeas corpus proceedings.” Sero, 506 F.2d at 1125; see also Bijeol v. Benson, 513 F.2d 965, 968 (7th Cir.1975) (stating that Rule 23 “does not apply to habeas corpus proceedings for the reasons stated in [Sero]”). Nonetheless, Sero found “a compelling justification for allowing a multi-party proceeding similar to the class action authorized by the Rules of Civil Procedure” and concluded that “the class action device was appropriately used” in the habeas case. Sero, 506 F.2d at 1125-26; see also Bijeol, 513 F.2d at 968 (finding “a representative procedure analogous to the class action provided for *891in Rule 23” appropriate in a habeas corpus action).
Thus, although Rule 23 might be “technically inapplicable to habeas corpus proceedings,” the courts have “applied] an analogous procedure by reference to Rule 23.” Napier v. Gertrude, 542 F.2d 825, 827 (10th Cir.1976); see also United States ex rel. Morgan v. Sielaff, 546 F.2d 218, 221 (7th Cir.1976) (describing Sero and Bijeol as looking to Rule 23 “for guidance in determining whether a representative action was appropriate,” and noting that the list of factors relied upon “substantially tracks the prerequisites to a class action listed in Rule 23(a)”). There is no support for the government’s argument that “Rule 23’s requirements should not be imported as a procedural analogue.”
IV. Release of Petitioners
8 U.S.C. § 1231(a)(1)(A) provides that the Attorney General must remove an alien who has been ordered removed within a 90-day removal period. Section 1231(a)(6) authorizes further detention of certain aliens who are inadmissible or who are removable for security reasons or criminal violations. In Zadvydas, the Supreme Court held that § 1231(a)(6) “contain[s] an implicit ‘reasonable time’ limitation” and therefore does not allow indefinite detention. 533 U.S. at 682, 121 S.Ct. 2491. An alien’s post-removal-period detention is limited “to a period reasonably necessary to bring about that alien’s removal from the United States.” Id. at 689, 121 S.Ct. 2491. For uniformity’s sake, the Court deemed six months as a reasonable detention period. Id. at 701, 121 S.Ct. 2491.
Here, the district court ordered the immediate release of Petitioners Ali, Aweys, and Hundiye pursuant to Zadvydas.10 Ali, 213 F.R.D. at 411. The court reasoned that there was no significant likelihood of Petitioners’ removal in the reasonably foreseeable future because of the court’s holding that their removal to Somalia would violate § 1231(b) in conjunction with the lack of evidence that conditions in Somalia are likely to change in the near future. Id.
The government briefly argues that the district court erred in ordering Petitioners’ release, contending for the first time on appeal that Petitioners were being held pursuant to 8 U.S.C. § 1231(a)(1)(C), which provides for extension of the 90-day removal period “if the alien fails or refuses to make timely application in good faith for travel or other documents necessary to the alien’s departure or conspires or acts to prevent the alien’s removal subject to an order of removal.” Petitioners dispute this assertion, pointing out that the government acknowledged to the district court that Petitioners’ detention was based solely on their imminent removal to Somalia. The record supports Petitioners’ assertion that their detention was based on their imminent removal to Somalia.
Even if we were to accept this newly-asserted basis for detention, however, we would still affirm the district court. We recently held that Zadvydas did not apply where the petitioner was being detained pursuant to § 1231(a)(1)(C), rather than § 1231(a)(6). Pelich, 329 F.3d at 1059-61. In Pelich, the petitioner had made numerous conflicting representations to the INS regarding his name, nationality, place of birth, and his parents’ names and nationalities. After the INS issued a removal *892order, the INS attempted to obtain travel documents. However, the petitioner remained in INS custody because he “consistently refused” to complete the passport application. Id. at 1058. We accordingly held that Zadvydas did not apply because the petitioner’s “indefinite detention[was] due to his failure to cooperate with the INS’s efforts to remove him.” Id. at 1061.
Unlike Pelich, Petitioners are not subject to indefinite detention due to a truculent refusal to comply with a minor administrative request. Rather, Petitioners are mounting a legal challenge to the INS’ statutory authority to remove them. This case is thus distinguishable from Pelich and from the cases relied on by Pelich, in which the petitioners simply refused to cooperate with the INS’ attempts to remove them. See Powell v. Ashcroft, 194 F.Supp.2d 209, 210 (E.D.N.Y.2002) (stating that the petitioner “has repeatedly provided the INS with inconsistent information regarding his identity, and these inconsistencies have demonstrably hampered the INS in carrying out his removal”); Sango-Dema v. Dist. Dir., INS, 122 F.Supp.2d 213, (D.Mass.2000) (describing the petitioner’s refusal to provide the INS with a passport and birth certificate, to communicate with officials at the embassy of the country of removal, and to “complete any of the applications necessary to facilitate his return to his country of origin”).
Under Zadvydas, “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.” 533 U.S. at 701, 121 S.Ct. 2491. Because we hold that the INS may not remove Petitioners to Somalia, there is no significant likelihood of removal in the reasonably foreseeable future; consequently, the district court properly released Petitioners pursuant to Zadvydas.
AFFIRMED.
. After the district court filed its order in this case, the INS was abolished and its functions transferred to the newly-created Department of Homeland Security. See Homeland Security Act of 2002 §§ 2, 101, 441, 442, 6 U.S.C. §§ 101, 111, 251, 252. For convenience, we refer to the government agency as the INS.
. Judge Bye further reasoned that "a functioning central government [is] an 'essential aspect’ of a 'country' to which an alien can be deported,” and that "the majority’s construction of the statute will only be implicated when there is no functioning government to refuse the alien's acceptance, currently the case in Somalia.” Jama, 329 F.3d at 637 (Bye, J., dissenting) (quoting Matter of Linnas, 19 I. & N. Dec. 302, 307, 1985 WL 56051 (BIA 1985)).
. Former § 1253(a) stated:
The deportation of an alien in the United States provided for in this chapter, or any other Act or treaty, shall be directed by the Attorney General to a country promptly designated by the alien if that country is willing to accept him into its territory, unless the Attorney General, in his discretion, concludes that deportation to such country would be prejudicial to the interests of the United States.... If the government of the country designated by the alien fails finally to advise the Attorney General within three months following original inquiry whether that government will or will not accept such alien into its territory, such designation may thereafter be disregarded. Thereupon deportation of such alien shall be directed to any country of which such alien is a subject, national, or citizen if such country is willing to accept him into its territory. If the government of such country fails finally to advise the Attorney General or the alien within three months following the date of original inquiry, or within such other period as the Attorney General shall deem reasonable under the circumstances in a particular case, whether that government will or will not accept such alien into its territory, then such deportation shall be directed by the Attorney General within his discretion and without necessarily giving any priority or preference because of their order as herein set forth either—
(1) to the country from which such alien last entered the United States;
(2) to the country in which is located the foreign port at which such alien embarked for the United States or for foreign contiguous territory;
(3) to the country in which he was born;
(4) to the country in which the place of his birth is situated at the time he is ordered deported;
(5) to any country in which he resided pri- or to entering the country from which he entered the United States;
(6) to the country which had sovereignty over the birthplace of the alien at the time of his birth; or
*883(7) if deportation to any of the foregoing places or countries is impracticable, inadvisable, or impossible, then to any country which is willing to accept such alien into its territory.
8 U.S.C. § 1253 (1990). Except for minor editorial revisions, the 1990 version is essentially unchanged from the original 1952 version. See 8 U.S.C. § 1253, historical and statutory notes.
Respondents assert that § 1231 differs from § 1253 because § 1253 did not contain a provision similar to § 1231(h), which provides that ‘‘[n]othing in this section shall be construed to create any substantive or procedural right or benefit that is legally enforceable by any party against the United States.” This provision is irrelevant to the issue at stake here and does not change the fact that § 1231(b)(2) is virtually identical to its predecessor. Moreover, the position that the Attorney General may not remove an alien to a country lacking a functioning government to accept him does not violate § 1231(h).
. The court further reasoned that the preliminary inquiry of steps one and two, requiring the Attorney General to first inquire whether the country will accept the alien, applied to step three as well, stating that "[w]e cannot see any reason to suppose that the necessary consent in such situations should not follow the pattern laid down earlier in the section. ... In each case there must be a mutual agreement between that ‘country’ and ourselves. ...” Tom Man, 264 F.2d at 928.
. The government argues only that Niesel and Linnas are inapposite because they deal with former § 1253(a) rather than the current statute, § 1231(b)(2). As noted above, however, the current version is virtually identical to the predecessor statute.
. The other two cases cited by the government are equally unhelpful. In Catholic Social Servs., Inc. v. INS, 232 F.3d 1139 (9th Cir.2000) (en banc), we held that § 1252(f)(1) did not bar injunctive relief because the injunction was issued under 8 U.S.C. § 1255a, which is in part V, not part IV, of the sub-chapter. Id. at 1149-50. Finally, in American-Arab, the Supreme Court was analyzing § 1252(g) and cited § 1252(f)(1) only to reject our "reading of § 1252(f) as a jurisdictional grant.” 525 U.S. at 481, 119 S.Ct. 936.
. 8 U.S.C. § 1103(a)(1) has been revised such that the Secretary of Homeland Security, rather than the Attorney General, is now charged with the administration and enforcement of all laws relating to the immigration and naturalization of aliens. See 8 U.S.C. § 1103(a)(1) (2003); Consolidated Appropriations Resolution, 2003, Pub.L. No. 108-7, sec. 105(a), 117 Stat. 11 (2003) (amending the Homeland Security Act of 2002, Pub.L. No. 107-296, § 1102, 116 Stat. 2135, 2273-74 (2002)). 8 U.S.C. § 1226, however, still provides that it is the Attorney General who detains and has custody of aliens. The functions of the Commissioner of Immigration and Naturalization have been transferred to the Under Secretary for Border and Transportation Security. 6 U.S.C. § 251.
. The district court further reasoned that Petitioners had made a strong showing of next friend standing because "the putative class members may not have access to the court due to frequent transfer and lack of access to counsel,” and Petitioners "have some significant relationship with, and are truly dedicated to, the best interests of the putative class members.” Ali, 213 F.R.D. at 406-07.
. The government does not challenge the district court’s findings regarding the prerequisites of Rule 23, but only its application of the rule to certify the class.
. The court refrained from ruling on the claims of the fourth named petitioner, Moha-mud, because he had an earlier-filed petition pending before a different judge in the same district.