A device to prevent urinary leakage intended to be implanted in a patient includes a compressor to compress the patient's urethra, an electronic controller to actuate the compressor, and a measurer to measure the patient's activity. The measurer is coupled with the controller and the controller functions according to a predictive model of urinary leakage based on patient activity, so as to anticipate a possible urinary leak in relation to the measured activity of the patient.