Gun salutes are the firing of cannons or arms as an (military or naval) honor. The custom originates in naval tradition, where a warship would fire its cannons harmlessly out to sea, until all ammunition was spent, to show that it was disarmed, signifying the lack of hostile intent.
As naval customs evolved, 21 volleys came to be fired for heads of state, with the number decreasing with the rank of the recipient of the honor. While the 21-gun salute is the most commonly recognized, the number of rounds fired in any given salute will vary depending on the conditions. Circumstances effecting these variations include the particular occasion and, in the case of military and state funerals, the branch of service, and rank (or office) of the person to whom honors are being rendered.