If a jail or other county prison or any building near thereto is on fire, or if a bomb threat has been received, or there is reason to believe a bomb threat or similar threat exists, and the prisoners are exposed to danger thereby, the sheriff, jailer or other person in charge of the prison may remove them to a safe place, and there confine them as long as necessary to avoid the danger, and such removal and confinement shall not be deemed an escape of the prisoners.
Mass. Gen. Laws ch. 126, § 27