Guns were invented primarily as weapons to propel projectiles using explosive force or pressure. The earliest gun-like devices appeared in China around the 10th to 12th centuries, evolving from fire lances—tubes containing gunpowder mounted on spears used as flamethrowers—to metal-barrel firearms that fired projectiles. The invention of guns was driven by the need for military advantage, including defending against enemies and advancing offensive capabilities in warfare. They were later adapted for hunting and other uses as well. The key motivations behind inventing guns were to increase the power, range, and effectiveness of weapons beyond traditional melee arms and bows. Guns changed the nature of combat by allowing for projectile weapons with greater force and impact. Over centuries, gun technology spread and evolved globally, enhancing their effectiveness and leading to various types of firearms including rifles, pistols, and machine guns. In summary, guns were invented as powerful weapons for military use, to improve the effectiveness and lethality of projectile weapons, and were later also used for hunting and self-defense.