The M9 pistol is a 9mm semi-automatic handgun produced on Earth used by the armed forces of several nations and the teams of Stargate Command.
The weapon has been used by various teams as a side arm on 'normal' missions where the need for defense is greater than the need for capture. Curiously, while teams operating out of Stargate Command are seen sometimes armed with a Zat'nik'tel instead of the Beretta due to its versatility and nearly unlimited ammo; the teams in Atlantis, use the handgun more frequently with Dr. Meredith Rodney McKay, the Expedition's Chief Science Officer and member of Atlantis Reconnaissance 1 or AR-1 often being seen using the weapon whenever he is in the field.
The reason for this is unknown, considering the limited resources of the Atlantis base, the limit of ammunition, and the fact that the enemy that Atlantis reconnaissance teams are most likely to face, the Wraith, have healing abilities that take a considerable amount of damage before succumbing to their wounds.
In one instance, it took Sheppard two magazines just to kill one Wraith, although he did so in a slow manner, giving the prisoner a limited amount of time to heal from his wounds before his death.
Regardless, other than the weapon's effectiveness in the Milky Way, the mystery of why the Atlantis expedition mostly uses the Beretta, despite its ineffectiveness, is unknown.