The present invention relates to a monitoring unit (200) for a medicament delivery device, which monitoring unit comprises a housing (202), monitoring circuit (398) arranged in said housing (202), capable of detecting and monitoring functions of the medicament delivery device, releasable holding elements (208), which releasable holding elements (208) are designed to interact with a medicament delivery device for releasibly holding said monitoring unit (200) when attached to a medicament delivery device,characterised in locking elements (500, 508, 514) operably arranged in said monitoring unit and designed to act on said attachment mechanism,- at least one drive element (502) operably connected to said locking elements (500, 508, 514) wherein, upon activation of said monitoring unit, said at least one drive element (502) causes said locking elements (500, 508, 514) to act on said releasable holding elements (208), preventing detachment of said monitoring unit (200) from said medicament delivery device.