Method for operating an anti-collision device for a motor vehicle comprising: - a detection module capable of identifying objects present in front of the host vehicle and determining their relative position and speed with respect to said host vehicle; - a module for evaluating the driving environment context capable of identifying, from the data provided by the detection module, the existence of a risk of collision between said host vehicle and an approaching moving object moving in the opposite direction to the direction of movement of said host vehicle on a lane adjacent to its traffic lane; and - an actuation module capable of controlling, in the event of identification of a risk of collision by said driving environment context evaluation module, the execution by said host vehicle of an avoidance response intended to prevent the occurrence of such a collision; said method comprising the following steps: - detection, by said detection module, of the demarcation line separating the traffic lane of said host vehicle from that of said mobile object, and - identification, by said evaluation module, of the existence of a risk of collision when said host vehicle crosses a first virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line, or when said approaching mobile object crosses a second virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line; characterized in that at least one of said first and second virtual safety margins (7, 8) has a width that varies according to a function of the distance between said host vehicle and said approaching mobile object. - a detection module capable of identifying objects present in front of the host vehicle and determining their relative position and speed with respect to said host vehicle; - a module for evaluating the driving environment context capable of identifying, from the data provided by the detection module, the existence of a risk of collision between said host vehicle and an approaching moving object moving in the opposite direction to the direction of movement of said host vehicle on a lane adjacent to its traffic lane; and - an actuation module capable of controlling, in the event of identification of a risk of collision by said driving environment context evaluation module, the execution by said host vehicle of an avoidance response intended to prevent the occurrence of such a collision; said method comprising the following steps: - detection, by said detection module, of the demarcation line separating the traffic lane of said host vehicle from that of said mobile object, and - identification, by said evaluation module, of the existence of a risk of collision when said host vehicle crosses a first virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line, or when said approaching mobile object crosses a second virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line; - detection, by said detection module, of the demarcation line separating the traffic lane of said host vehicle from that of said mobile object, and - identification, by said evaluation module, of the existence of a risk of collision when said host vehicle crosses a first virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line, or when said approaching mobile object crosses a second virtual safety margin extending laterally on the inner side of its traffic lane from said demarcation line;