A shroud lock for locking a position of a needle shroud relative to a housing of an autoinjector, includes a shroud beam arranged on the needle shroud and biased radially outwards, a stop arranged within the housing, a recess arranged proximal of the stop, and a cap coupled to the housing and adapted to prevent distal translation of the needle shroud relative to the housing. At least a portion of the shroud beam is within the recess when the cap is in place and, the shroud beam abuts the stop after the needle shroud is locked relative to the housing of the autoinjector. The disclosure further relates to an autoinjector and to a method for assembling such an autoinjector.