Prior to the introduction of cartridge-loading firearms, there was little standardization with regard to the handguns carried by military personnel, although it had been important for officers, artillerymen, and other auxiliary troops to have a means of defending themselves, especially as it was not always practical for them to have a full-length rifle or carbine.
As a result, swords were retained only by officers (who were less likely to be at the front of the pike-and-musket hedge) and by cavalry, for whom early single-shot handguns were of limited use.
Service pistols, on the other hand, were generally issued to officers, NCOs, and others who needed to carry personal weapons as part of their duties.
Service pistols are issued to military police and other soldiers acting in a law enforcement capacity as part of their duties.
The United States Marine Corps, for example, requires all enlisted personnel and all officers below the rank of Lieutenant colonel to carry the M27 IAR as their primary weapon.