Perhaps it was a slamfire?
Edited to add, from Wikipedia:
A slamfire is a premature, unintended discharge of a firearm that occurs as a round is being loaded into the chamber. Slamfires are most common in military firearms that have a free-floating firing pin, as opposed to a spring-loaded one. In the action of a typical semi-automatic weapon, the energy of a fired round forces the bolt and bolt carrier rearward, ejecting the empty case. A spring then forces the bolt forward again, and in the process a fresh round is stripped out of the magazine. When the face of the bolt hits the head of the chamber, unless there is a spring around the pin to retard its movement, inertia causes the firing pin to continue forward until it is stopped on the primer of the round. Sometimes this inertial force is sufficient to set off the primer, thereby firing the round. This can potentially occur repeatedly, until the magazine has been emptied