A protective device for an injection or infusion needle is provided comprising a needle hub at the proximal end of the needle, on whose shaft a protective member for the needle tip is displaceable, the protective member having an engaging section which engages with the needle shaft to prevent the protective member from being displaced beyond the needle tip, wherein the protective member is surrounded by a tube whose diameter is locally reduced or deformed such that the protective member is confined in the tube.