Click on images to enlarge
This three barreled weapon was in service with the Russians since 1986 to 2006 and has been carried by their cosmonauts on several space missions. The two top barrels are side-by-side smoothbore barrels that can fire shotgun shells and signalling flares. The bottom barrel is rifled and fires more conventional 5.45x39 mm. ammunition (the same as that used by the AK-74 assault rifle)
So why carry a firearm into space? Are they expecting an invasion of little green men from Mars? Well, the real reason is to protect their cosmonauts from earth-based predators. Here's why the need for a firearm came about.
In the 1960s when the US and the Soviets were both trying to win the space race, both countries were launching spacecraft that returned the astronauts to earth via parachutes. In America's case, the landings were often over water (specifically, oceans) and the US Navy had the job of recovering the astronauts after splashdown. In the Soviet case, they had vast underpopulated areas and would try to land their capsules in their own territory. However, they often had issues where the space capsules would land well away from the intended landing zone.
In 1965, on the Voshkod 2 mission, Alexei Leonov became the first man to walk into space. This feat made major headlines worldwide. What is not nearly well-known is the number of glitches that happened in this mission: Leonov's space suit inflated too much during his spacewalk, he had to bleed some air to get back in the hatch, got stuck, overheated and nearly died out there. On the way back to re-entry on earth, the automatic landing system malfunctioned and Leonov and his fellow cosmonaut, Pavel Belyayev, had to take over with manual controls, which meant that they could not return to their seats immediately and disrupted the center of gravity of their capsule. All this meant that they landed over 350 km. (about 220 miles) away from their intended landing zone, in the middle of the Ural mountains. There were not too many people there, but plenty of wolves and bears! While the Soviets had a rough idea where they had landed, they could not dispatch helicopters immediately to their rescue. The two cosmonauts allegedly had to stay inside the capsule for several hours, while a hungry pack of wolves was prowling outside, trying to get into the capsule.
The solution to this issue was fairly simple. The next Soviet space mission added to the survival kit, a firearm that was known for its reliability and simplicity: the AKM assault rifle (this is per a former Soviet defector named Vladimir Rezun (who writes under the pen-name "Victor Suvorov") in one of his books.) and all Soviet space missions since 1965 have always carried some sort of firearm into space.
AKM and AK-74 rifles were reportedly carried along during Soviet space missions in the 60s and 70s, all the way to the mid 80s. The TP-82 was developed in 1982 and came into service around 1986. It combines the capabilities of a shotgun (to hunt birds and small animals), a flare pistol (to signal rescuers where they are) and a rifle (to shoot bigger predators and larger game) in one firearm. It has three barrels, two side-by-side smoothbore barrels and a rifled barrel underneath. The two smoothbore barrels can fire 12.5x70 mm. shells (approx 40. gauge) and the rifled barrel can fire a 5.45x39 mm. AK-74 round. The rifle barrel has been tested and found effective to kill elk, deer, wild boar, ibex, antelope and other large animals weighing upto 200 kg. (440 lbs.) for distances up to 200 meters and the shotgun barrel has been used effectively against rabbits, foxes, partridges, ducks, geese, pheasants etc. The stock is detachable and contains a machete inside it, to cut wood and build shelters. The stock can also double as a small spade or shovel to dig holes in the ground. The entire firearm with the stock weighs about 2.4 kg. (5.3 lbs.) and without the stock, it weighs 1.6 kg (3.5 lbs.). The three types of ammunition for this weapon come on a belt that is attached to the gun.
The TP-82 remained in service until 2006 or early 2007, when the ammunition that was made for it degraded and became unusable. Since then, the Russian missions have reportedly carried a semi-automatic pistol (reportedly, a Makarov PM) for self-defense.