Achieving independence from Great Britain was a triumphant moment for the United States of America. Consequently, independence resulted in American shipping losing protection from the mighty Royal Navy. As a result, merchant ships were soon set upon by marauding pirates from the North African Barbary states. In response, President George Washington ordered the establishment of the United States Navy. After the new ships had been constructed, they would sail across the Atlantic Ocean and attempt to end the tyranny of the Barbary pirates.
Who Were the Barbary Pirates?

Between the 16th and 19th centuries, those traveling Mediterranean waters were preyed upon by daring pirates from North Africa. Today, encompassing Algeria, Libya, Tunisia, and Morocco, this region was named the “Barbary states” by the Europeans. Due to its lack of resources and agricultural potential, the inhabitants of the Barbary states soon realized the prospective bounty they could reap from the cargo-laden vessels sailing off their coast.
The Barbary states would gain the favor and protection of the powerful Ottoman Empire, which would encourage piracy against their Christian rivals in Europe. Becoming increasingly audacious in their attacks, the Barbary pirates would spread their operations from the west coast of Africa to as far north as Iceland.
As well as attacking ships and pillaging their cargo, the Barbary pirates began capturing sailors and even raiding coastal towns throughout Europe to take captives. Approximately 1,250,000 Europeans were captured and sold in slave markets across the Barbary states and the Ottoman Empire, and subjected to a life of cruelty and squalor.
The United States of America Gains Independence

The Barbary pirates were a great menace to the European imperial powers. The Europeans, however, were increasingly distracted by fighting each other, notably during the Napoleonic Wars. Instead, many nations signed treaties with the Barbary states and agreed to pay tribute to the pirates in return for free passage for their ships.
As part of the British Empire, American ships enjoyed protection through Britain’s treaty with the pirates as well as the protection of the formidable Royal Navy. However, upon the United States’ declaration of independence in 1776, this protection was lost, and Britain was quick to inform the Barbary states that American ships were now free for them to attack.
During the War of Independence, the United States had the Continental Navy, which was a relatively small fleet compared with the might of the British Royal Navy. In 1775, the United States Congress authorized the construction of 13 new frigates. However, by 1781, almost all of these new ships had been sunk or captured by the far superior Royal Navy. By the end of the Revolutionary War in 1783, very few of the Continental Navy’s ships remained in service. Two years later, the Continental Navy was disbanded, and the few remaining ships were sold.
Algerian Attacks on US Shipping

Without a recognized navy or British protection, American ships were exceptionally vulnerable to attacks from pirates. In 1785, Dey Muhammad declared war on all maritime nations that did not pay the customary tribute fee in return for safe passage. Almost immediately, American ships fell prey to pirate attacks, with two being attacked within the month of July. A merchant ship named the Rambler almost became a third when it was approached by pirates. However, the ship’s captain cunningly raised a British flag and thus evaded capture.
Despite the United States suffering increasing attacks from Algiers, the newly founded nation fostered friendly relations with another Barbary state—Morocco. The North African country was one of the first nations to recognize the United States’ independence and wanted to enter into an international trade relationship. Signed in 1786, the Moroccan-American Treaty of Friendship was the first treaty signed by the US with an African and Muslim nation. Today, it remains the longest unbroken diplomatic relationship between the US and another nation.

Algerian attacks on US shipping continued for a decade until 1795. Facing no alternative, the United States dispatched diplomats to Algiers to negotiate a peace treaty. The Treaty of Peace and Amity was signed in 1795. It ensured the safe passage of US ships and the release of American sailors being held captive in Algiers. In return, the US agreed to pay an annual tribute of $21,600 for safe passage and a fee of $642,500 for the release of captives.
Establishment of the US Navy

The Algerian attacks illustrated the alarming vulnerability of US merchant ships. Thomas Jefferson urgently advocated for the creation of a naval force. The Naval Act of 1794 was passed by Congress and signed into law by President George Washington. Six frigates were authorized to be constructed, which together would form the start of the US Navy.
The six frigates consisted of three 44-gun ships, the USS Constitution, the USS President, and the USS United States, as well as three 38-gun ships, the USS Congress, the USS Constellation, and the USS Chesapeake. All six ships were launched between 1797 and 1800.

Accompanying these ships was the USS Philadelphia. The citizens of the city, from which the ship was named, funded the vessel themselves, raising approximately $100,000 in a single week. During this period, the United States was fighting the Quasi-War against the First French Republic. Inspired by a newfound sense of patriotism, the people of Philadelphia wanted to help increase their country’s naval power and protect trade, which was important to the city.
With a steadily growing navy and thus a greater presence at sea, the United States government became increasingly disinterested in appeasing the Barbary pirates’ demands.
Declaration of War

Despite the treaties between the US and the Barbary states, the North African pirates continuously increased their tributary demands. Believing they were being extorted, the United States Congress opposed continuing such payments.
Tensions rose when, in 1800, the USS George Washington arrived in Algiers to deliver tribute. Once docked, the Dey of Algiers insisted that the American ship transport Algerian goods to Constantinople. Surrounded by Algerian ships, Captain William Bainbridge was compelled to comply, fearing capture and imprisonment should he refuse. The Algerian flag was raised upon the USS George Washington, and the crew subsequently sailed the ship to Constantinople. Many in the United States considered the incident a staggering humiliation, which greatly deteriorated the relations between the US and Algiers.
The following year, the Pasha of Tripoli demanded greater tribute from the US, but the recently elected president, Thomas Jefferson, a long-time critic of US tribute payments, refused. Infuriated, the Pasha of Tripoli expelled the US consul from the city and declared war on the United States.
Naval Blockade and the USS Philadelphia

Thomas Jefferson immediately dispatched two naval squadrons to Tripoli. The American ships were accompanied by a flotilla of Swedish ships, who, like the Americans, were at war with the Barbary states over tribute payments. Together, the American and Swedish ships attempted to enforce a naval blockade of Tripoli. However, the blockade proved futile as the smaller pirate ships were able to sneak through.
During October 1803, the USS Philadelphia, while attempting to pursue a Barbary ship, ran aground upon a reef. Captain William Bainbridge (the former captain of the USS George Washington) attempted to refloat the ship. However, under fire from four Barbary gunboats, he was ultimately forced to surrender.

Alarmingly for the US, the pirates were able to refloat the Philadelphia and sail it to Tripoli’s port. If the captured Philadelphia was repaired, it could turn the tides of the war against the United States.
In February 1804, Lieutenant Stephen Decatur captured a small Barbary ship. Renaming it the USS Intrepid, Decatur and his crew infiltrated the Port of Tripoli while disguising the Intrepid as a merchant ship from Malta. Attempting to recapture the Philadelphia, however, proved impossible. Therefore, the decision was made to plant explosives in the ship’s hull. As Decatur and his men escaped the harbor, the USS Philadelphia was destroyed.
The Battle of Derna

Although the naval blockade of Tripoli continued, it did not inflict enough harm to the Barbary state to force its submission. Instead, the US government hatched a plan to defeat Tripoli. Yusuf Karamanli, the Pasha of Tripoli, had gained his throne by deposing his brother, Hamet. William Eaton, the Naval Agent to the Barbary states, was permitted by the US government to restore Hamet to the throne. Supported by seven US Marines under the command of First Lieutenant Stephen O’Bannon, Eaton requisitioned the assistance of 400 mercenaries. In March 1805, Eaton and his small force crossed from Egypt into the Libyan desert.
After an arduous journey, Eaton reached the city of Derna. With the support of the USS Argus stationed off the coast, Eaton and his force attacked the city. Split into two forces, Eaton and his men assaulted the city’s defensive fort while Hamet led an attack on the governor’s palace. In just over an hour, the city was captured. A few weeks later, Barbary forces attempted to retake the city but were repelled.

The Battle of Derna was the first land battle fought by the United States on foreign soil. Threatened with his potential deposal, Yusuf Karamanli agreed to enter peace negotiations.
President Thomas Jefferson agreed to pay $60,000 for the release of American prisoners. However, the US abandoned its promise to Hamet Karamanli of returning him to power, which greatly angered William Eaton.
Commencement of the Second Barbary War

Despite achieving victory during the First Barbary War, Tripoli’s defeat did little to dispel pirate attacks on American shipping. While attacks continued, US attention was averted due to the War of 1812 against the United Kingdom.
The same year, the new leader of Algiers, Hajji Ali, rejected the previously agreed tribute payments from the US. Meanwhile, relations between Algiers and the United Kingdom had greatly improved. As a result, Algiers declared war on the US, coinciding with the War of 1812. Throughout the war, Algerian pirates attacked and terrorized American shipping.
It was not until three years later that Congress authorized President James Madison to use force against Algiers. By 1815, the US Navy had vastly improved, allowing President Madison to dispatch an entire squadron of ten ships under the command of Commodore Stephen Decatur, who commanded the flagship, the USS Guerriere.
Battle of Cape Gata and Peace

By June 1815, Decatur and his squadron reached the Mediterranean Sea. While pursuing Algerian ships, the Americans encountered the Algerian flagship, the Meshuda. Under the command of Admiral Rais Hamidou, the Meshuda was one of Algiers’ most powerful ships.
Overwhelmingly outnumbered, Hamidou attempted to flee back to Algiers before attempting to seek refuge in a neutral Spanish Port. However, the US squadron caught the Meshuda at Cape Gata along the Spanish coastline. The US squadron engaged the Meshuda, inflicting substantial damage to the ship and killing Admiral Hamidou. Fearing total destruction, the remaining Algerians surrendered.

Losing the Meshuda and Admiral Hamidou was a devastating blow to Algiers. The leader of Algiers agreed to enter negotiations with the US. Aboard the USS Guerriere, the US and Algiers signed a treaty that granted US shipping free passage through the Mediterranean without tribute payments. Decatur would later sail to Tripoli and Tunis and sign similar treaties with the other Barbary states.

While the US had successfully ensured its protection against Barbary piracy, pirate attacks would continue for another two decades until the French invasion of Algeria would finally end the pirate scourge.
The Barbary Wars were the first wars the newly independent United States fought on foreign soil. Both victories were indicative of the United States’ emergence as a new global power, showcasing the nation’s naval capabilities and its ability to wage war far from its shores. Barbary attacks on US shipping also directly led to the establishment of the US Navy, which today stands as the most powerful naval force in the world, symbolic of the country’s ability to project power throughout the world’s oceans.