; (III) the Secretary lawfully transfers custody of the alien to another Federal agency or to a State or local government agency in connection with the official duties of such agency; or (IV) a court or the Board of Immigration Appeals orders a remand to the immigration judge or to the Board of Immigration Appeals while the case is pending a decision on remand (with the removal period beginning anew on the date on which the alien is ordered removed on remand). (ii) Renewal If the removal period has been extended pursuant to clause (i), a new removal period shall begin on the date on which— (I) the alien makes all reasonable efforts to comply with the removal order or to fully cooperate with the Secretary of Homeland Security’s efforts to establish the alien’s identity and carry out the removal order; (II) the stay of removal is no longer in effect; or (III) the alien is returned to the custody of the Secretary. (iii) Mandatory detention for certain aliens The Secretary shall keep an alien described in section 236(c)(1) in detention during the extended period described in clause (i). (iv) Sole form of relief An alien may seek relief from detention under this subparagraph by filing an application for a writ of habeas corpus in accordance with chapter 153 of title 28, United States Code. No alien whose period of detention is extended under this subparagraph shall have the right to seek release on bond. ; (3) in paragraph (3)— (A) by inserting or is not detained pursuant to paragraph (6) after removal period ; and (B) in subparagraph (D), by inserting in order to prevent the alien from absconding, for the protection of the community, or for other purposes related to the enforcement of the immigration laws before the period at the end; (4) in paragraph (4)(A), by striking paragraph (2) and inserting in subparagraph (B)