Except as provided in paragraphs (5) and (6), the Attorney General shall maintain custody of such an alien until the alien is removed from the United States. Except as provided in paragraph (6), such custody shall be maintained irrespective of any relief from removal for which the alien may be eligible, or any relief from removal granted the alien, until the Attorney General determines that the alien is no longer an alien who may be certified under paragraph (3). If the alien is finally determined not to be removable, detention pursuant to this subsection shall terminate.
The Attorney General shall place an alien detained under paragraph (1) in removal proceedings, or shall charge the alien with a criminal offense, not later than 7 days after the commencement of such detention. If the requirement of the preceding sentence is not satisfied, the Attorney General shall release the alien.
An alien detained solely under paragraph (1) who has not been removed under section 1231(a)(1)(A) of this title, and whose removal is unlikely in the reasonably foreseeable future, may be detained for additional periods of up to six months only if the release of the alien will threaten the national security of the United States or the safety of the community or any person.
The Attorney General shall review the certification made under paragraph (3) every 6 months. If the Attorney General determines, in the Attorney General’s discretion, that the certification should be revoked, the alien may be released on such conditions as the Attorney General deems appropriate, unless such release is otherwise prohibited by law. The alien may request each 6 months in writing that the Attorney General reconsider the certification and may submit documents or other evidence in support of that request.
Judicial review of any action or decision relating to this section (including judicial review of the merits of a determination made under subsection (a)(3) or (a)(6)) is available exclusively in habeas corpus proceedings consistent with this subsection. Except as provided in the preceding sentence, no court shall have jurisdiction to review, by habeas corpus petition or otherwise, any such action or decision.
Section 2241(b) of title 28 shall apply to an application for a writ of habeas corpus described in subparagraph (A).
Notwithstanding any other provision of law, including section 2253 of title 28, in habeas corpus proceedings described in paragraph (1) before a circuit or district judge, the final order shall be subject to review, on appeal, by the United States Court of Appeals for the District of Columbia Circuit. There shall be no right of appeal in such proceedings to any other circuit court of appeals.
The law applied by the Supreme Court and the United States Court of Appeals for the District of Columbia Circuit shall be regarded as the rule of decision in habeas corpus proceedings described in paragraph (1).
The provisions of this section shall not be applicable to any other provision of this chapter.