A handgun having a device for ascertaining the shot count has electronics having a microprocessor (18) and a memory which may be read out, as well as an acceleration sensor (22), which detects the acceleration of the firearm in at least one spatial direction. Reference values for the intensity curve of the acceleration measured by the acceleration sensor (22) upon firing the weapon are stored in the memory. The microprocessor (18) is designed in such a way that it outputs a count pulse to the memory in the event of positive comparison of an intensity curve of the acceleration measured using the acceleration sensor to the reference values stored in the memory.