An armed merchantman is a merchant ship equipped with guns, usually for defensive purposes, either by design or after the fact. In the days of sail, piracy and privateers, many merchantmen would be routinely armed, especially those engaging in long distance and high value trade.
In more modern times, auxiliary cruisers were used offensively as merchant raiders to disrupt trade chiefly during both World War I and World War II, particularly by Germany.
While armed merchantmen are clearly inferior to purpose-built warships, sometimes they have scored successes in combat against them. Examples include East Indiamen mimicking ships of the line and chasing off regular French warships in the Battle of Pulo Aura in 1804, and the German auxiliary cruiser Kormoran sinking the Australian light cruiser HMAS Sydney in their battle in 1941, although Kormoran was also destroyed and had to be scuttled.
East Indiamen of various European countries were heavily armed for their long journeys to the Far East. In particularly dangerous times, such as when the home countries were at war, a convoy system would be used whereby the ships were escorted by a warship. However, many East Indiamen also travelled on their own, and therefore were heavily armed in order to defend themselves against pirates and privateers. They also defended themselves against warships, scoring signal victories at the Battle of Pulo Aura and the action of 4 August 1800. The British Royal Navy purchased several that it converted to ships of the line.
In 1856, privateering (or seizure of a belligerent country's merchant ships as a private enterprise) lost international sanction under the Declaration of Paris. From 1861 to 1865 European countries built high-speed ships to run the Union Blockade during the American Civil War. Some of these were armed and served as Confederate States Navy raiders.
Russia purchased three ships in 1878 of 6,000 long tons (6,100 t) armed with 6-inch (150 mm) guns for use as auxiliary cruisers for a Russian Volunteer Fleet. Germany and the United Kingdom responded to the precedent by asking their shipping companies to design fast steamers with provision for mounting guns in time of war.
In 1890 German and British shipyards built new civilian ships designed for wartime conversion, and France, Italy, Japan, Austria-Hungary, and the United States made similar agreements with their shipyards. In 1892 Russia likewise built two more auxiliary cruisers.
In 1895 the Imperial German Navy mobilized the provisional auxiliary cruiser Normannia for a 15-day trial armed with eight 6-inch guns, two 3.5-inch (89 mm) guns, six 37-millimetre (1.46 in) guns, and two torpedo boats. 
In both World Wars, both Germany and the United Kingdom used auxiliary cruisers. While the British used armed passenger liners defensively for protecting their shipping, the German approach was to use them offensively to attack enemy shipping.
The armed merchant cruisers (AMC) of the British Royal Navy were employed for convoy protection against enemy warships. They ultimately proved to have limited value and many, particularly ocean liners, were later converted into troopships, a role for which they were more suited. Documentary evidence quoted by the BBC researched from the early stages of the First World War suggests that the express liners had greater speed than most warships (few warships of the period could exceed 21 knots), which made them suitable as AMCs.[ citation needed] The downside proved to be their high fuel consumption; using them in a purely AMC role would have burned through the Admiralty reserve supplies of steam coal in less than three months.[ citation needed] The ships were vulnerable to enemy fire because they lacked warship armour, and they used local control of guns rather than director fire-control systems, which reduced their effective fire power.
A famous AMC of World War I was the British RMS Carmania which, after a battle that caused heavy damage on both sides, sank the German auxiliary cruiser SMS Cap Trafalgar near the Brazilian island of Trinidade in 1914.  By coincidence, Cap Trafalgar was disguised as Carmania. In World War II, HMS Jervis Bay, the sole escort for convoy HX 84 in November 1940, stood off the pocket battleship Admiral Scheer, when the German ship attacked the convoy. Though she and five vessels of the convoy were sunk, this enabled the rest of the convoy to escape. Her master, Acting Captain Edward Fegen was awarded the Victoria Cross posthumously for his actions. Another famous action involving an armed merchant cruiser was the November 1939 battle between HMS Rawalpindi and the German battlecruisers Scharnhorst and Gneisenau. Outgunned, the Rawalpindi was quickly sunk.
The Spanish and United States Navies used auxiliary cruisers during the Spanish–American War of 1898. In World War I, too, American auxiliary cruisers fought several engagements with German U-boats.
The German practice was to arm merchantmen with hidden weapons and use them as commerce raiders. An auxiliary cruiser, Hilfskreuzer or Handels-Stör-Kreuzer (HSK), usually approached her target under a false flag with guns concealed, and sometimes with her appearance altered with fake funnels and masts and often a fake paint scheme. The victim was thus engaged at point-blank range and had no chance to escape. In World War I, the Imperial German Navy initially used fast passenger ships, such as past holders of the Blue Riband for fastest North Atlantic crossings, but they made obvious and easy targets because of their very familiar silhouettes. The Germans, therefore, soon moved on to using captured and refitted Allied vessels, but principally modified transport ships. These were slower, but less recognizable. In both world wars, these ships were vulnerable to attack, and were withdrawn before the war ended. Many were sunk after being caught by regular warships – an unequal battle, since auxiliary cruisers had poor fire control and no armor. There were, however, a few success stories. Kaiser Wilhelm der Grosse was a former passenger liner that sank two freighters in 1914 before being caught by HMS Highflyer. Her sister ship, Kronprinz Wilhelm, had a legendary journey, sinking or capturing a total of 15 ships in 1914 and 1915, before finally running out of supplies and having to put into port in Virginia, where the Americans interned her and eventually converted her into the United States Navy troop transport USS Von Steuben. The most famous German commerce raider of World War I probably was Seeadler, a sailing ship under the command of the legendary Count Felix von Luckner. However, both Wolf and Möwe were each much more successful than Seeadler.
In World War II, Nazi Germany's Kriegsmarine operated ten very successful auxiliary cruisers, ranging in tonnage from 3,860 to 9,400; typically these vessels were equipped with:
To preserve their cover, these ships flew the flags of neutral or occasionally Allied nations. They were refueled and provisioned from special supply ships, from Japanese island bases or from prizes they had taken.[ citation needed] To counter the effectiveness of these disguises, the Allies introduced the check-mate system in 1942 to identify individual ships on a one-by-one basis with the Admiralty in London.
In one incident, the German Kormoran (ex-merchantman Steiermark) managed to surprise and sink the Australian light cruiser HMAS Sydney, which approached too close, though Kormoran was also sunk in the engagement. This was the only occasion in history when an armed merchantman managed to sink a modern warship; in most cases, auxiliary cruiser raiders tried to avoid confrontation with warships. Kormoran's attack upon Sydney was motivated by desperation.[ citation needed] She was not the most successful German raider of World War II (both Atlantis and Pinguin scored higher kill tonnages). Another, Stier, was also sunk in a mutually destructive engagement with the American Liberty ship SS Stephen Hopkins.
The only encounters between Allied and Axis auxiliary cruisers in World War II were all with the raider Thor. This small vessel, which captured or sank 22 merchantmen, encountered three British AMCs in her career, defeating RMS Alcantara and HMS Carnarvon Castle and later sinking HMS Voltaire in the Action of 4 April 1941. During World War II, German auxiliary cruisers are believed to have either sunk or captured some 800,000 long tons (810,000 t) of Allied shipping. Compare to the Q-ship, which was a disguised merchantman for anti-submarine operations.
The CAM ship (from catapult armed merchantman) was a British merchantman fitted with a catapult that could launch, but not recover, a single fighter aircraft.
The merchant aircraft carrier or "MAC" was a British or Dutch cargo ship with a flight deck that could carry a small number of aircraft.
CAM and MAC ships remained as civilian ships operated by civilian crews, with Fleet Air Arm or Royal Netherlands Navy "air parties".
Despite a rise in modern piracy, it was up until the early 2010s very unusual for modern merchant ships to be armed, save for maybe a number of small arms and the use of the ship's fire hoses to repel boarders. One notable exception to this were the ships of Pacific Nuclear Transport Limited,  which are used to transport spent nuclear fuel and reprocessed uranium on behalf of British Nuclear Fuels Limited. Transporting enough fissile material between them to produce 50–60 nuclear weapons, these ships, beginning with the Pacific Pintail and Pacific Teal, became armed in 1999 to avoid the cost of a Royal Navy escort.  Travelling together in convoy during these ships' intermittent voyages, they have an onboard escort of armed police from the UKAEAC and its successors  and are equipped with two or three 30 mm (1.18 in) autocannons.  Another exception were various ships of the Soviet Union's Merchant Marine (MORFLOT) during the Cold War (MORFLOT often operated as an adjunct to Soviet foreign and military policy, both overtly and otherwise).
In 2007, facing a chronic shortage of naval vessels the Cuban Navy placed into service the Rio Damuji class of frigates, which are large fishing trawlers converted into warships.
In April 2010, it was reported that a Russian company was offering a version of the 3M-54 Klub missile that could be disguised and launched from a shipping container, in theory enabling any cargo ship to be armed with an anti-ship missile. This type of missile was allegedly capable of disabling or even sinking an aircraft carrier, but "it's not known how many of them would have to hit a carrier to knock it out of action, much less sink it." 
During the 2011 Libyan civil war, forces loyal to Gaddafi armed several merchant vessels and attempted to use them to blockade the port of Misrata.
In October 2011, British Prime Minister David Cameron announced that British merchant shipping passing through areas known for piracy were permitted to carry firearms. 
Since the late 19th century various navies have used armed merchant ships in the role of auxiliary cruisers, also called armed merchant cruisers. Significant use of this type of ship was made by Britain and Germany in both World Wars.
Some of the ships used in this role include: