When the jail of any county is insecure or otherwise unfit for use, the judge of the district court therein, on the recommendation of the grand jury or of the judge’s own motion, may issue a written order condemning it; or, when the commissioner of corrections shall adjudge any county jail insecure or otherwise unfit for use, the commissioner may, with consent of the judge of the district court, issue a written order condemning it. After condemnation that jail shall not be used for the detention of any prisoner until the order of condemnation is rescinded.