The Director, sheriff, or other official in charge of the facility in which an alien is incarcerated may, upon receipt of a detainer from U.S. Immigration and Customs Enforcement, transfer custody of the alien to U.S. Immigration and Customs Enforcement no more than five days prior to the date that he would otherwise be released from custody. Upon transfer of custody, notwithstanding any other provision of law, the alien shall receive credit for the number of days remaining before he would otherwise have been released.
Va. Code § 53.1-220.2