The invention relates to a shroud lock (17) for locking a position of a needle shroud (7) relative to a housing (2) of an autoinjector (1) wherein the shroud lock (17) comprises: a shroud beam (7.1) arranged on the needle shroud (7) and biased radially outwards a stop (2.12) arranged within the housing (2) a recess (2.13) arranged proximal of the stop (2.12) and a cap (11) coupled to the housing (2) and adapted to prevent distal translation of the needle shroud (7) relative to the housing (2) wherein at least a portion of the shroud beam (7.1) is within the recess (2.13) when the cap (11) is in place and the shroud beam (7.1) abuts the stop (2.12) after the needle shroud(7) is locked relative to the housing (2) of the autoinjector (1). The invention further relates to an autoinjector (1)and to a method for assembling such an autoinjector (1).