A method for the safe operation of a machine which has a movable machine part comprising a hazardous section, in particular as part of a human-robot collaboration, wherein the method comprises: - the movable machine part moving according to a sequence program predefined for the machine; and - an environment of the hazardous section being monitored, wherein, in the event of an engagement of an object (19, 21) into a defined protective volume within the monitored environment, a safety-related reaction is triggered that comprises the movement of the movable machine part being stopped if the engagement exceeds a defined engagement threshold of the protective volume; wherein the protective volume is variable, namely depending on the current position of the hazardous section, to permit a scheduled approach of the hazardous section to one or more objects (19; 21), characterized in that the protective volume is taught: - in that an initial protective volume is first predefined; - in that the machine is controlled so that the movable machine part moves according to the predefined sequence program while the environment of the hazardous section is monitored; - in that, if the movement of the movable machine part is stopped as a result of an object (19, 21) engaging into the initial protective volume, a teach-in mode can be started by means of a first user input, - in that, in the teach-in mode, the movement is continued in line with the path so that the hazardous section is moved along the same movement path which corresponds to the sequence program and along which said hazardous section would also move without an object (19, 21) engaging into the protective volume and the teach-in mode being started, and position data of objects (19, 21) in the environment of the hazardous section are acquired in so doing; - in that the teach-in mode can be terminated by means of a second user input; and - in that the protective volume is defined based on the acquired position data. wherein the method comprises: - the movable machine part moving according to a sequence program predefined for the machine; and - an environment of the hazardous section being monitored, wherein, in the event of an engagement of an object (19, 21) into a defined protective volume within the monitored environment, a safety-related reaction is triggered that comprises the movement of the movable machine part being stopped if the engagement exceeds a defined engagement threshold of the protective volume; - the movable machine part moving according to a sequence program predefined for the machine; and - an environment of the hazardous section being monitored, wherein, in the event of an engagement of an object (19, 21) into a defined protective volume within the monitored environment, a safety-related reaction is triggered that comprises the movement of the movable machine part being stopped if the engagement exceeds a defined engagement threshold of the protective volume; wherein the protective volume is variable, namely depending on the current position of the hazardous section, to permit a scheduled approach of the hazardous section to one or more objects (19; 21), characterized in that the protective volume is taught: - in that an initial protective volume is first predefined; - in that the machine is controlled so that the movable machine part moves according to the predefined sequence program while the environment of the hazardous section is monitored; - in that, if the movement of the movable machine part is stopped as a result of an object (19, 21) engaging into the initial protective volume, a teach-in mode can be started by means of a first user input, - in that, in the teach-in mode, the movement is continued in line with the path so that the hazardous section is moved along the same movement path which corresponds to the sequence program and along which said hazardous section would also move without an object (19, 21) engaging into the protective volume and the teach-in mode being started, and position data of objects (19, 21) in the environment of the hazardous section are acquired in so doing; - in that the teach-in mode can be terminated by means of a second user input; and - in that the protective volume is defined based on the acquired position data. - in that an initial protective volume is first predefined; - in that the machine is controlled so that the movable machine part moves according to the predefined sequence program while the environment of the hazardous section is monitored; - in that, if the movement of the movable machine part is stopped as a result of an object (19, 21) engaging into the initial protective volume, a teach-in mode can be started by means of a first user input, - in that, in the teach-in mode, the movement is continued in line with the path so that the hazardous section is moved along the same movement path which corresponds to the sequence program and along which said hazardous section would also move without an object (19, 21) engaging into the protective volume and the teach-in mode being started, and position data of objects (19, 21) in the environment of the hazardous section are acquired in so doing; - in that the teach-in mode can be terminated by means of a second user input; and - in that the protective volume is defined based on the acquired position data.