; and (B) to determine whether there is any criminal, national security, or other factor that would render the alien ineligible for such status. (2) Completion of background checks The security and law enforcement background checks of an alien required under subparagraph (A) shall be completed, to the satisfaction of the Secretary, before the date on which the Secretary grants such alien permanent resident status under this section. (f) Medical examination (1) Requirement An alien applying for permanent resident status under this section shall undergo a medical examination. (2) Policies and procedures The Secretary, with the concurrence of the Secretary of Health and Human Services, shall prescribe policies and procedures for the nature and timing of the examination required under paragraph (1). (g) Military selective service An alien applying for permanent resident status under this section shall establish that the alien has registered under the Military Selective Service Act ( 50 U.S.C. 3801 et seq.), if the alien is subject to registration under such Act. (h) Treatment of aliens pending grant of permanent residence (1) Limitation on removal The Secretary or the Attorney General may not remove an alien who— (A) has pending an application for relief under this section and appears prima facie eligible for such relief; (B) has an approved application for relief under this section and is awaiting the availability of an immigrant visa pursuant to section 4; or (C) is ineligible to apply for relief under this section solely due to the date limitation in subsection (a)(3). (2) Provisional protected status (A) In general In the case of an alien described in paragraph (1) whose DACA grant has ended, the Secretary shall grant provisional protected presence to the alien and shall provide the alien with employment authorization effective until the date on which— (i) the alien’s application for relief under this section is finally denied