Described is a needle safety device comprising a needle hub, a needle coupled to the needle hub and having a distal tip, an outer needle shield telescopically coupled to the needle hub, and an inner needle shield telescopically coupled to the outer needle shield. The needle safety device has a first state in which the distal tip is covered by the inner needle shield and the inner needle shield is movable in a proximal direction relative to the outer needle shield, a second state in which the distal tip is exposed from the inner needle shield, and a third state in which the distal tip is covered by the inner needle shield and the inner needle shield is immovable in the proximal direction relative to the outer needle shield. The needle safety device includes a first locking mechanism (L1, L101) engaging the inner needle shield to the outer needle shield in the first state. The needle hub includes a release element adapted to release the first locking mechanism (L1, L101) in the second state.