In firearm ballistics, the primer (/ˈpraɪmər/) is a component of pistol, rifle, and shotgun rounds. Early primers were simply the same black powder used to fire the weapon but poured into a pan or tube where it could be ignited by some external source of ignition such as a fuse or a spark. This external powder was connected though a tube in the barrel that led to the main charge. As powder won't burn when wet, this led to difficulty, or even the inability, to fire weapons in the rain.
Modern primers are shock sensitive chemicals. In smaller weapons the primer is usually integrated into the rear of a cartridge. In larger weapons like cannon the primer is a separate component placed inside the barrel to the rear of the main propellant charge. Upon being struck with sufficient force generated by the firing pin or, typically in larger weapons, being electrically ignited, these primers react chemically to produce heat which ignites the main propellant charge and fires the projectile. Due to their small size these primers lack the ability to fire the projectile but still have enough energy to drive a bullet partway into the barrel (a dangerous condition called a squib load) and such a condition was instrumental in the death of Brandon Lee.
The first step to firing a firearm of any sort is igniting the propellant. The earliest firearms were cannons, which were simple closed tubes. There was a small aperture, the "touchhole", drilled in the closed end of the tube, leading to the main powder charge. This hole was filled with finely ground powder, which was then ignited with a hot ember or torch. With the advent of hand-held firearms, this became an undesirable way of firing a gun. Holding a burning stick while trying to pour a charge of black powder carefully down a barrel is dangerous, and trying to hold the gun with one hand while simultaneously aiming at the target and looking for the touchhole makes it very difficult to fire accurately.