Shepherding, the task of guiding a herd of autonomous individuals in a desired direction, is an essential skill to herd animals, enable crowd control and rescue from danger. Equipping robots with the capability of shepherding would allow performing such tasks with increased efficiency and reduced labour costs. So far, only single-robot or centralized multi-robot solutions have been proposed. The former is unable to observe dangers at any place surrounding the herd, and the latter does not generalize to unconstrained environments. Therefore, we propose a decentralized control algorithm for multi-robot shepherding, where the robots maintain a caging pattern around the herd to detect potential nearby dangers. When danger is detected, part of the robot swarm positions itself in order to repel the herd towards a safer region. We study the performance of our algorithm for different collective motion models of the herd. We task the robots to shepherd a herd to safety in two dynamic scenarios: (i) to avoid dangerous patches appearing over time and (ii) to remain inside a safe circular enclosure. Simulations show that the robots are always successful in shepherding when the herd remains cohesive, and enough robots are deployed.