In 2005 United States Immigration and Customs Enforcement (ICE) determined that Sadou Bah was a removable alien and detained him for over a year while it sought the travel documents necessary to remove him. Bah successfully petitioned under 28 U.S.C. § 2241 for release from his detention. The district court 1 denied his subsequent request for attorney fees under the Equal Access to Justice Act, concluding that the government’s position in the litigation had been substantially justified. Bah appeals, and we affirm.
Sadou Bah is a Liberian national who entered the United States in 1991 as a nonimmigrant visitor. He overstayed his visa and twice married and divorced United States citizens. On July 6, 2004, ICE commenced removal proceedings against Bah. Its removal order became final on May 23, 2005, when the Bureau of Immigration Appeals (BIA) denied Bah’s appeal. Bah was placed in custody pending his removal. Because ICE was unable to obtain travel documents from Liberia, Bah remained in custody for approximately fourteen months. During that time Bah petitioned this court for review of the BIA’s decision and also filed for and received Temporary Protective Status (TPS).
The Attorney General may grant an alien TPS if conditions in the alien’s home country would pose a threat to the alien’s safety if he were returned there. See 8 *683 U.S.C. § 1254a(b). Bah’s TPS designation shielded him from removal for at most seven months, from June 21, 2005 until January 18, 2006. 2
On August 7, 2006 Bah filed a petition in the district court for writ of habeas corpus under 28 U.S.C. § 2241.
3
Under
Zadvydas v. Davis,
This court granted Bah’s petition for review of his BIA decision and remanded to the BIA for further proceedings on August 9, 2006.
4
Bah v. Gonzales,
Bah then moved for an award of attorney fees and costs under the Equal Access to Justice Act (EAJA), which requires an “award to a prevailing party ... [of] fees and other expenses ... incurred by that party in any civil action ... unless the court finds that the position of the United States was substantially justified or that special circumstances make an award unjust.” 5 28 U.S.C. § 2412(d). The district court concluded that Bah had been the prevailing party but that he was not entitled to a fee award because the government’s position was substantially justified. Bah appeals, arguing that the government’s position, both preceding the litigation and during litigation, was not substantially justified.
We review for abuse of discretion a district court’s determination that the government’s actions were substantially justified.
See Pierce v. Underwood,
The government had argued in response to Bah’s habeas petition that our grant of review of his BIA decision meant that ICE’s May 23, 2005 removal order was no longer final and therefore did not have the effect of starting the six month detention period recognized in
Zadvydas
as presumptively reasonable. The district court noted that novel legal issues had been raised in the case, which required extensive analysis of when Bah’s detention period should be deemed to have commenced and whether any intervening time should be excluded from the calculation of his total detention time. The district court observed that the government’s primary argument found some support in a Second Circuit decision,
Wang v. Ashcroft,
Though it ultimately ruled against the government on Bah’s habeas petition, the district court determined that the government’s defense had been reasonable and denied Bah’s request for attorney fees. We agree that the legal position advanced by the government in such an open area of the law had “a reasonable basis in law and fact,” and conclude that the district court did not abuse its discretion in finding that the government’s position during the litigation was substantially justified.
Bah also contends that the government’s prelitigation conduct was unjustified. The EAJA requires courts to consider the government’s conduct leading up to the litigation in addition to its subsequent conduct.
See
28 U.S.C. § 2412(d)(2)(D) (defining “position of the United States” as not only “the position taken by the United States in the civil action, [but also] the action or failure to act by the agency upon which the civil action is based”). If the court finds that the government took an unjustified position in either of these stages, it must award fees under § 2412(d).
See Comm’r v. Jean,
Bah claims that his fourteen month detention was unjustified because it exceeded the presumptively reasonable six month detention period recognized in Zad-vydas v. Davis. Even if the government was justified in arguing during litigation that the appellate decision granting Bah’s petition reset the Zadvydas clock, it could not have relied on that rationale to justify his detention prior to that point, he says.
Under
Zadvydas
an alien who has been detained for more than six months can obtain release by showing that there is “no significant likelihood of removal in the reasonably foreseeable future,” which then re
*685
quires the government to respond with evidence sufficient to rebut that showing.
Bah also argues that the government illegally prolonged his detention based on a vacated felony conviction for second degree criminal sexual conduct. Citizenship and Immigration Services (CIS) cited Bah’s conviction as grounds for revoking his Temporary Protected Status. See 8 U.S.C. § 1254a(c)(2)(B)(i). Once Bah’s TPS was revoked, he again became subject to removal. The day after he filed his habeas petition, Bah filed a separate request for a writ of mandamus 6 to compel CIS to disregard the vacated conviction and grant him TPS.
The decision to grant TPS is committed to the discretion of the Attorney General,
see
8 U.S.C. § 1254a(a)(l)(A), and Congress has prohibited courts from reviewing any decision or action “the authority for which is specified under this title to be in the discretion of the Attorney General,”
id.
§ 1252(a)(2)(B). Based on these provisions, the district court determined that it lacked jurisdiction to review the government’s decision to refuse Bah TPS.
See also Rodas v. Chertoff,
In resolving Bah’s EAJA motion, the district court did not evaluate whether the government’s rejection of his TPS application had been substantially justified. This was appropriate because the district court lacked jurisdiction to review the government’s discretionary action. The government’s denial of Bah’s TPS application was not “the action ... by the agency upon which the civil action is based.” See 28 U.S.C. § 2412(d)(2)(D). The civil action in which Bah had prevailed was his petition for a writ of habeas corpus; he was not the prevailing party in any sense on his request for a writ of mandamus. The relief Bah sought by his mandamus request was different from that sought by his habeas petition. If Bah had been granted TPS, he would have been protected from removal, but he would not necessarily have been entitled to be released from detention. 7 Cf. 8 U.S.C. § 1254a(f) *686 (listing the benefits to aliens granted TPS). The decision to revoke his TPS and deny his subsequent reapplication was therefore not the basis for Bah’s habeas petition.
We conclude that the district court did not abuse its discretion in concluding that the government’s position regarding Bah’s detention and the subsequent litigation was substantially justified, and that Bah was therefore not entitled to attorney fees under 28 U.S.C. § 2412(d). The judgment of the district court is affirmed.
Notes
. The Honorable Patrick J. Schütz, United States District Judge for the District of Minnesota.
. Bah reapplied for TPS on March 22, 2006, and that application was denied on July 6, 2006.
. The REAL ID Act of 2005, Pub.L. No. 109-13, § 106(a), 119 Stat. 231, 310 (2005) (codified at 8 U.S.C. § 1252(a)(5)), requires that habeas petitions seeking relief from a final order of removal be filed in the court of appeals. The Act does not affect a district court's jurisdiction over habeas petitions challenging the detention associated with a removal order, however.
See
H.R.Rep. No. 109-72, at 175 (2005), U.S.Code Cong. & Admin.News 2005, pp. 240, 300 (Conf.Rep.);
see also Codina v. Chertoff,
. The BIA had previously ruled that Bah had failed to present, in his brief to the BIA, his argument that he had not knowingly and intelligently waived his right to appeal from the Immigration Judge’s determination. We concluded otherwise, granted his petition for review, and remanded to the BIA for it to determine whether or not Bah had waived his appellate rights.
Bah,
. The EAJA also permits the court to award attorney fees in its discretion, 28 U.S.C. § 2412(b), which the district court declined to do. Bah was awarded his costs under 28 U.S.C. § 2412(a)(1).
. These requests for relief were consolidated into a single amended pleading by Magistrate Judge Janie Mayeron.
. Bah was granted TPS on June 21, 2005, and CIS did not finally withdraw it until January 18, 2006. Between those dates Bah remained in custody.
