204 F.3d 861 (9th Cir. 2000)
ANSELMO BERNAL HERNANDEZ, Plaintiff-Appellant,v.JOHN R. CAMPBELL, OPINION Defendant-Appellee.
No. 98-56884
UNITED STATES COURT OF APPEALS FOR THE NINTH CIRCUIT
Submitted November 5, 1999*Filed February 8, 2000

[Copyrighted Material Omitted]
COUNSEL: Anselmo Bernal Hernandez, Taft, California, plaintiff-appellant pro se.
Edward B. Moreton, Jr., Assistant United States Attorney, Los Angeles, California, for defendant-appellee.
Appeal from the United States District Court for the Central District of California; J. Spencer Letts, District Judge, Presiding. D.C. No. CV 98-03688 JSL
Before: James R. Browning and A. Wallace Tashima, Circuit Judges, and Robert E. Jones, District Judge.**
PER CURIAM:


1
Federal prisoner Anselmo Bernal Hernandez appeals the order of the District Court for the Central District of California ("Central District" or "sentencing court") denying his habeas corpus petition. Because the Central District failed to determine whether it had jurisdiction, we vacate its order dismissing the petition. We also remand with instructions for the Central District to determine whether the petition is styled properly as one brought under 28 U.S.C. S 2241, and, if so, to transfer the action back to the District Court for the Eastern District of California ("Eastern District" or "custodial court"). See Washington Local Lodge No. 104 v. International Bhd. of Boilermakers, 621 F.2d 1032, 1033-34 (9th Cir. 1980) (remanding to the district court with instructions to determine whether federal jurisdiction existed, and, if not, to remand to the state court).

I.

2
In March 1993, a jury in the Central District convicted Hernandez and two co-defendants, Santos Alvarez Felix and Adolpho Leon Gomez, of conspiracy to possess with intent to distribute cocaine and possession with intent to distribute cocaine, in violation of 21 U.S.C. SS 846 & 841. The sentencing court sentenced Hernandez to 135 months in prison after determining that he was responsible for conspiracy to possess five kilograms of cocaine. The quantity of cocaine actually delivered was approximately 4.6 kilograms. See United States v. Felix, 87 F.3d 1057, 1059 (9th Cir. 1996). Hernandez is presently incarcerated at the Taft Correctional Institution, which is located in the Eastern District.


3
After an unsuccessful direct appeal, Hernandez filed a motion to vacate, set aside, and/or correct his sentence pursuant to 28 U.S.C. S 2255. The only ground for relief alleged in that motion, filed June 7, 1995, was that Hernandez's conviction and sentence were barred by the Double Jeopardy Clause of the Fifth Amendment. The Central District denied the motion, and this court affirmed. See United States v. Hernandez, No. 95-56704,1997 WL 542069, 122 F.3d 1075 (9th Cir. Aug. 28, 1997) (Memo.).


4
While Hernandez's S 2255 motion was pending, three events occurred that form the basis of this appeal. First, Application Note 12 of United States Sentencing Guidelines S 2D1.1 was amended to clarify the quantity of drugs that district courts should consider when sentencing for a completed transaction. See Felix, 87 F.3d at 1059; see also U.S.S.G. S 2D1.1, Application Note 12 (1995). The amendmentauthorizes the sentencing court to sentence a defendant based on the actual amount of drugs delivered, rather than the amount negotiated, if that amount more accurately represents the scale of the offense. See id.


5
Second, this court reversed Hernandez's co-defendants' sentences and remanded for the district court to resentence Felix and Gomez based on the amount of cocaine actually delivered, in accord with the new amendment. See Felix, 87 F.3d at 1061. With this ruling, we held that the amendment applied retroactively to Felix and Gomez, as it was a clarification of the law, rather than a substantive change. See id. at 1060.


6
Third, Congress passed the Anti-Terrorism and Effective Death Penalty Act of 1996 ("AEDPA"), which precludes a prisoner from filing a second or successive S 2255 motion, except in very narrow circumstances and only after receiving authorization to file from the court of appeals. See 28 U.S.C. S 2244(b).1 In December, 1997, Hernandez filed a request with this court for leave to file a second or successive S 2255 petition. He argued that he was entitled to resentencing based on the decision in Felix; however, because he did not meet S 2244(b)'s stringent requirements for filing a successive S 2255 motion, his request was denied.


7
On April 6, 1998, Hernandez filed the petition presently at issue, pursuant to 28 U.S.C. S 2241, in the Eastern District, the court with jurisdiction over the prison in which he is incarcerated.2 In his petition, Hernandez argued that to avoid a miscarriage of justice he should be resentenced in light of the Felix decision. The Eastern District transferred the action to the Central District, pursuant to 28 U.S.C. S 1406(a). The Central District then dismissed the petition on its merits.3

II.
A.

8
Generally, motions to contest the legality of a sentence must be filed under S 2255 in the sentencing court, while petitions that challenge the manner, location, or conditions of a sentence's execution must be brought pursuant toS 2241 in the custodial court. See Doganiere v. United States, 914 F.2d 165, 169-70 (9th Cir. 1990); Brown v. United States, 610 F.2d 672, 677 (9th Cir. 1980).4


9
Under the savings clause of S 2255, however, a federal prisoner may file a habeas corpus petition pursuant to S 2241to contest the legality of a sentence where his remedy under S 2255 is "inadequate or ineffective to test the legality of his detention." 28 U.S.C. S 2255; see Moore v. Reno, 185 F.3d 1054, 1055 (9th Cir. 1999). Hernandez argues that he is entitled to file a S 2241 petition pursuant to the savings clause given both his inability to file a successive S 2255 petition under the limitations of S 2244(b) and the subsequent change in the guidelines and Ninth Circuit law.


10
An inquiry into whether a S 2241 petition is proper under these circumstances is critical to the determination of district court jurisdiction, because the proper district for filing a habeas petition depends upon whether the petition is filed pursuant to S 2241 or S 2255. In particular, a habeas petition filed pursuant to S 2241 must be heard in the custodial court


11
Thus, in order to determine whether jurisdiction is proper, a court must first determine whether a habeas petition is filed pursuant to S 2241 or S 2255 before proceeding to any other issue. If Hernandez's petition falls under the savings clause so as to be a petition pursuant to S 2241, then only the Eastern District has jurisdiction. If the savings clause does not come into play, however, then Hernandez's petition must be construed as a petition under S 2255, such that jurisdiction lies only in the Central District.

B.

12
Neither the Central District nor the Eastern District considered whether Hernandez properly invoked the savings clause, thereby ignoring the decisive jurisdictional question. Federal courts are always "under an independent obligation to examine their own jurisdiction," FW/PBS, Inc. v. City of Dallas, 493 U.S. 215, 231 (1990), and a federal court may not entertain an action over which it has no jurisdiction. See Insurance Corp. of Ireland, Ltd. v. Compagnie des Bauxites de Guinee, 456 U.S. 694, 701 (1982); see also Magana v. Commonwealth of the N. Mariana Islands, 107 F.3d 1436, 1443 (9th Cir. 1997).


13
In its transfer order, the Eastern District expressly declined to construe Hernandez's motion as a S 2241 or S 2255 petition.5 In particular, the Eastern District did not address Hernandez's claim that he was entitled to bring a S 2241 petition in the custodial court (i.e., the Eastern District) pursuant to the savings clause. Thus, the Eastern District erred by transferring the action without first determining whether it, as the custodial court, had the exclusive jurisdiction to hear the claim. See Clark v. Busey, 959 F.2d 808, 812 (9th Cir. 1992) (holding that a court may not transfer a claim "where the transferee court lacks jurisdiction and thus could not have originally heard the suit").6


14
Moreover, by refusing to construe Hernandez's petition as either a S 2255 or S 2241 claim, the Eastern District also deprived Hernandez of a ruling on the merits of his claim that S 2255 was an "inadequate or ineffective " remedy. 28 U.S.C. S 2255. Although we have not defined precisely what renders the S 2255 remedy inadequate or ineffective, see United States v. Pirro, 104 F.3d 297, 299 (9th Cir. 1997), the statute specifically contemplates that such instances may arise. Where a petitioner claims that S 2255 provides an ineffective remedy, the district court in which the petition is brought is required initially to rule whether a S 2241 remedy is available under the savings clause. The Eastern District failed to engage in any analysis on this point before transferring the action.

C.

15
As the sentencing court, the Central District also erred by treating the petition as one under S 2241 and dismissing it on the merits. By simply ruling that a S 2241 petition is improper to challenge the legality of a sentence,7 the Central District failed to address the initial jurisdictional question. Because Congress made a deliberate choice to give jurisdiction over S 2241 petitions and S 2255 motions to different courts, a district court is obligated to determine whether a petition falls under S 2241, pursuant to the savings clause, or under S 2255.


16
As the government acknowledges, the Central District did not have jurisdiction to entertain the pleading as a S 2241 petition. The government apparently requests that we construe the pleading as a S 2255 motion and affirm the Central District's dismissal of the action. We decline to do so.


17
Under the strict provisions of the recently-enacted AEDPA, prisoners may only file second or successive petitions in extremely narrow circumstances. It is therefore likely that federal courts will see more attempts to bringS 2241 petitions pursuant to the savings clause, because, in many instances, federal prisoners will have no other avenue through which collaterally to attack their sentences. Thus, in such circumstances, it is imperative, as a matter of the initial determination of jurisdiction, that district courts first determine whether the savings clause permits the filing of aS 2241 habeas corpus petition.

III.

18
We therefore vacate the dismissal and remand so that the Central District can determine whether it has jurisdiction over the petition. See Washington Local Lodge , 621 F.2d at 1033-34. If the Central District determines that the petition falls under the savings clause and thus is properly brought under S 2241, it must transfer the action back to the Eastern District, the court with jurisdiction over a S 2241 claim. If it concludes that the motion is one pursuant to S 2255, it should dismiss the motion as a second or successive petition the filing of which has not been authorized by the court of appeals. See 28 U.S.C. S 2244(b)(3).


19
The Central District's order of dismissal is REVERSED, and the case is REMANDED for further proceedings.



Notes:


*
 The panel unanimously finds this case suitable for decision without oral argument. See Fed. R. App. P. 34(a)(2).


**
 The Honorable Robert E. Jones, United States District Judge for the District of Oregon, sitting by designation.


1
 Section 2244(b)(2) requires dismissal of a successive petition unless: (1) the claim relies on a new rule of constitutional law that is made retroactive to cases on collateral review by the Supreme Court; or (2) the factual predicate for the claim could not have been discovered previously through the exercise of due diligence and the facts would be sufficient to establish that no reasonable factfinder would have found the applicant guilty of the underlying offense. See Greenawalt v. Stewart, 105 F.3d 1287, 1287 (9th Cir. 1997); 28 U.S.C. S 2244(b)(1) & (2).


2
 A federal prisoner may file a habeas corpus petition pursuant to S 2241 where his remedy under S 2255 is "inadequate or ineffective to test the legality of his detention." 28 U.S.C. S 2255. We refer to this provision of S 2255 as the "savings clause."


3
 After the dismissal of his petition, Hernandez filed a second request for leave to file a second or successive S 2255 motion, which we also denied. Hernandez v. United States, No. 98-71164 (9th Cir. Feb. 11, 1999) (Order).


4
 Congress enacted S 2255 primarily to ease the administrative burden imposed by the jurisdictional requirement that all habeas corpus petitions be heard in the district of incarceration. See United States v. Hayman, 342 U.S. 205, 219 (1952). In enacting S 2255, however, Congress did not intend for the remedy provided to differ in scope from the traditional habeas remedy under S 2241. See United States v. Fonseca-Martinez, 36 F.3d 62, 64 (9th Cir. 1994). Rather the statute was meant to "afford[ ] the same rights in another and more convenient forum. " Hayman, 342 U.S. at 219, quoted in Wofford v. Scott, 177 F.3d 1236, 1239 (11th Cir. 1999).  (here, the Eastern District), even if the S 2241 petition contests the legality of a sentence by falling under the savings clause. See Brittingham v. United States, 982 F.2d 378, 379 (9th Cir. 1992); cf. Tripati v. Henman, 843 F.2d 1160, 1163 (9th Cir. 1988); In re Dorsainvil, 119 F.3d 245, 252 (3d Cir. 1997) (denial of motion for certification to file a successive S 2255 petition is "without prejudice to[petitioner's] right to file a petition . . . pursuant to 28 U.S.C. S 2241 in a district court in the district of his confinement."). On the other hand, S 2255 motions must be heard in the sentencing court (here, the Central District). See Brittingham, 982 F.2d at 379; United States v. Giddings, 740 F.2d 770, 772 (9th Cir. 1984).


5
 The Eastern District specifically stated that, "[t]his Court has not ruled on whether the petition should be construed as a 28 U.S.C. S 2255 or 28 U.S.C. S 2241 petition for writ of habeas corpus . . . ."


6
 The Eastern District also erred by transferring the action pursuant to 28 U.S.C. S 1406(a), rather than 28 U.S.C. S 1631. Section 1406(a) only allows transfer where the first court has subject matter jurisdiction over the action. See Grand Blanc Bd. of Educ. Ass'n v. Grand Blanc Bd. of Educ., 624 F.2d 47, 49 n.4 (6th Cir. 1980) (holding that under S 1406, courts do not have power to transfer a case unless they have jurisdiction in the first instance). Since transfer to the Central District would have been proper only if the pleading was a S 2255 petition, the Eastern District could not have both had jurisdiction and been able to properly transfer the action pursuant to S 1406(a). Thus, the proper transfer statute would be S 1631, which allows transfer to cure want of jurisdiction.


7
 The Central District was also incorrect in stating that S 2241 petitions may not address the legality of sentences; indeed, the whole point of the savings clause is to allow petitions to be filed under S 2241 when S 2255 is otherwise "inadequate or ineffective." 28 U.S.C. S 2255. We express no opinion, however, on the extent to which the savings clause allows petitioners to contest the legality of sentences underS 2241.


