The present invention relates to a device for automatic injection of a product, comprising: a body (3) housing a container, the container being movable relative to said body between an initial position, to an insertion position a safety shield (26) movable with respect to said container and said body between an insertion position to a protection position, when the user removes the device from an injection site an external socket (48) receiving the body and provided with selection means (53) which can be placed by a user: either in a first position, in which the body (3) and the external socket (48) are bound to each other, the safety shield extending beyond the distal end of both said body and said external socket in the protection position or in a second position, in which the external socket (48) is able to move axially in the distal direction with respect to the body (3), both the safety shield and the external socket extending beyond the distal end of said body, in the protection position.