A locking system for locking a medical device at a holding structure, the medical device and the holding structure each provided with retaining structures which can cooperate with one another. The locking system includes a retaining lock for retaining the medical device when connected to the holding structure and being movable by a first manual control mechanism between a retaining position, in which the lock retains the medical device on the holding structure, and a free position, in which the lock does not retain the medical device on the holding structure. The locking system also includes a security lock which is movable by an automatic control device between active and inactive positions. The security lock, in the active position, prevents the medical device from being removed from the holding structure. In the inactive position, the security lock does not prevent the medical device from being removed from the holding structure.