The device (1) has an electronic unit (13) including a detection component for detecting an insulation resistance between components of a battery system and a reference potential, which components are connected in an electrically conductive manner to battery cells (8). A cooling body (9) supplies and/or discharges heat to and/or from the cells through a heat transfer medium (9.1). A cut-off valve (10.1) interrupts a circular flow path of the medium, and is actuated by the electronic unit from an open position into a closed position when the resistance is below a predetermined limit value. An independent claim is also included for a method for controlling a safety device of a vehicle.