If, by reason of a jail, or a building near a jail, being on fire, there is reason to apprehend that some or all of the prisoners confined in the jail, may be injured, or may escape, the sheriff or keeper of the jail may, in his discretion, remove them to some safe and convenient place, and there confine them, until they can be safely returned to the jail or, if the jail is destroyed, or so injured, that it is unfit or unsafe for the confinement of the prisoners, until a designation is made, as prescribed in section five hundred and four of this article.
N.Y. Correct.Law § 507