A needle guard for protecting a needle arranged in connection to said needle guard from accidental contact, comprising: a mounting base, having a lumen with a central axis, such that the needle arranged in connection to said needle guard is extending substantially along said central axis; a spring loaded needle shield, arranged at said mounting base, and being pivotable from an open position to a closed position, such that said spring loaded needle shield may be pivoted from said open position, in which said needle shield is separated from said needle, to said closed position, in which said needle shield is enclosing and protecting said needle; a hinge structure connecting said needle shield to said mounting base for forcing said needle shield into one of either said open position or said closed position, wherein said hinge structure is comprising at least one toggle joint and at least one tension member, said at least one toggle joint and at least one tension member being connected to said needle shield and to said mounting base; said mounting base being movably connected to said needle shield for enabling movement between said open and said closed position; wherein said needle shield is having a passive state and an active state, said needle shield being urged towards said closed position when in said active state; wherein said hinge structure has a dead-center position, such that when said needle shield is in said passive state the needle shield is being forced by said hinge structure into said open position if said dead-center position has to be passed to reach said closed position, and when the needle shield is in said active state the needle shield is being forced by said hinge structure into said closed position if said dead-center position has to be passed to reach said open position; and characterized in that said dead-center position is a position in which the angle between the central axis lumen of the mounting base and the longitudinal extension of said needle shield is in the range of 45 to 170°; wherein, after the user activates the safety function by manually moving the needle shield passed the dead-center position, the needle guard automatically, without the need of any further additional act by the user, protects the needle immediately after withdrawal of the needle from the skin of a patient. a mounting base, having a lumen with a central axis, such that the needle arranged in connection to said needle guard is extending substantially along said central axis; a spring loaded needle shield, arranged at said mounting base, and being pivotable from an open position to a closed position, such that said spring loaded needle shield may be pivoted from said open position, in which said needle shield is separated from said needle, to said closed position, in which said needle shield is enclosing and protecting said needle; a hinge structure connecting said needle shield to said mounting base for forcing said needle shield into one of either said open position or said closed position, wherein said hinge structure is comprising at least one toggle joint and at least one tension member, said at least one toggle joint and at least one tension member being connected to said needle shield and to said mounting base; said mounting base being movably connected to said needle shield for enabling movement between said open and said closed position; wherein said needle shield is having a passive state and an active state, said needle shield being urged towards said closed position when in said active state; wherein said hinge structure has a dead-center position, such that when said needle shield is in said passive state the needle shield is being forced by said hinge structure into said open position if said dead-center position has to be passed to reach said closed position, and when the needle shield is in said active state the needle shield is being forced by said hinge structure into said closed position if said dead-center position has to be passed to reach said open position; and characterized in that said dead-center position is a position in which the angle between the central axis lumen of the mounting base and the longitudinal extension of said needle shield is in the range of 45 to 170°; wherein, after the user activates the safety function by manually moving the needle shield passed the dead-center position, the needle guard automatically, without the need of any further additional act by the user, protects the needle immediately after withdrawal of the needle from the skin of a patient.