A drug delivery device comprises a cap releasably secured to a main body of the drug delivery device and a needle assembly retained within the cap. The drug deliver device also includes a pre-stressed biasing element disposed between the cap and the needle assembly and configured to bias the needle assembly in a distal direction with respect to the drug delivery device while the cap is secured to the main body. The drug delivery device further comprises one or more locking elements each having a locked position and an unlocked position. In the locked position, the locking elements prevent the needle assembly from engaging with a cartridge retained within the main body. In an initial position, the cap is configured to retain the locking elements in the locked position. In an intermediate position, the cap is configured to release the locking elements to allow the needle assembly to engage with the cartridge.