The sword has been a symbol of authority, high office and rank throughout the history of warfare, and with good reason. In ancient days when weapons were first fabricated, metals were scarce. Metal was also difficult or expensive to manufacture and work into tools. Up until the Middle Ages weapons and armor for the common soldier were made mostly of wood and leather, with very small bits of metal used in their construction. Items such as arrow tips, spear points or axe heads required relatively small quantities of metals. It took much more wealth, or skills and training to acquire, create and train to effectively use a sword. Financially well-to-do lords of the manor were the only ones who could afford to raise and command an army, and to afford to own expensive swords. Incidentally, this is the origin of the idea that officers belonged exclusively to the ranks of the "landed gentry".
As time went on, this distinction became more official. In Europe a class of professional warriors, (knights) was created, embodying a code of honor, service to the state, and chivalry to accompany the high status of sword bearer. In England, much from the legend of King Arthur was tied closely to the magical sword Excalibur, thought by some to symbolize the spirit of England itself. Mystical and religious themes were also incorporated into ceremonies involving the bestowing of sword and armor to a newly-trained knight.
On the day prior to the ceremony a priest would bless the sword and armor, and the squire would pray over his equipment throughout the night. On the next morning, the ceremony was presided over by the monarch or lord. The squire in his armor owuld kneel before the monarch. After touching the squire on the shoulder with the side of the royal sword, the new knight was summoned to rise and take his place by the ruler's side. The design of many medieval swords was that of the Christian Cross, and knights would often be seen after winning a great victory, kneeling in prayer of thanks while holding the sword before them like a crucifix. To be stripped of arms and armor for cowardice or criminal conduct was the worst disgrace a knight could face. This would be done in public, with the breaking of the knight's sword by the ruler symbolizing a broken trust between king and knight.
In feudal Japan the sword, more than just a weapon, stood as the badge of rank and status of the "Bushi", or Samurai warrior class. These powerful swords were only allowed to be made by Imperially-licensed craftsmen, and took as long as a year each to produce. They were rumored to acquire aspects of the swordmaker's own personality and philosophy in the forging process. These treasured family heirlooms were passed on from father to son to grandson. Some of these swords still exist today, fully functional and razor sharp after centuries of hard use. All can trace an unbroken lineage of ownership back to the Middle Ages. The sword was an integral part of the samurai's entire life. If he were to suffer humiliating disgrace, the "Bushido" code of conduct would require that the samurai use his sword to disembowel himself in public ritual suicide, or Seppuku.
Aboard ships at sea during the age of fighting sail, a captain's sword was the symbol of his ultimate authority, and the captain would only put on his sword for formal ceremonies, court-martials and for battle. If he were defeated in combat, it would be expected that a captain hand over his sword to the victor of the fight. In some cases, as did Raphael Semmes of the CSS Alabama, a defeated officer might throw his sword over the side rather than face the humiliation of handing it over to the enemy. If the victorious captain felt that his adversary had fought his ship well and bravely, he might return the captured sword as a gesture of respect. A noted example of this was after the capture of the USRC Surveyor by the British frigate HMS Narcissus. Captain Travis' sword was returned to him by the British captain, along with an open letter praising his "inch by inch defense of his vessel from attack by over three times his numbers."
During court-martial, an accused officer was required to leave his sword, in its scabbard, on the green tablecloth where the presiding officer was seated during the trial. Upon returning to the cabin at the end of deliberations, the position of the sword silently communicated the verdict. If the sword lay on the table, hilt toward the accused, the verdict was "not guilty"; the exonerated officer could pick up his sword and resume his duties. However, if the sword was pointed toward the accused, the verdict was "guilty", and punishment was often severe to the point of dismissal from the service.
Of course, nowadays ships will never again fight rail to rail in mortal combat, and on land the rifle, the pistol, the submachine gun and the nuclear warhead have made swords obsolete as practical fighting weapons. However, in ceremonial use, the sword will always be known to those familiar with ancient tradition as the defining symbol, the badge of rank of the officer's rank and status.