A locking device for securing a rod-shaped element is provided in a receiving part of a bone anchor, said locking device comprising: a first locking member (6, 600, 6) having a first end (61, 601) and a second end (62, 602) which is provided with an external thread (63, 603) on at least a portion thereof, a coaxial bore (64, 604) passing entirely through the first locking member the coaxial bore having a bore axis (C) and an internal thread (65, 605) provided in at least a portion of said bore, a second locking member (7, 700, 7), the second locking member having a first end (71, 701) and a second end (72, 702), an outer surface with an external thread (73, 703) in at least a portion thereof which cooperates with the internal thread provided at said bore of the first locking member, wherein the second locking member (7, 700, 7) is movable along the bore axis (C) by rotating it and wherein a path of advancement of the second locking member is limited towards the first end by a first stop (66, 606c) and towards the second end (62b, 606d) by a second stop.