Commodore Edward Preble had assumed command of the U.S. Mediterranean Squadron in 1803. By October of that year Preble had begun a blockade of Tripoli Harbor. The first significant action of the blockade came on October 31 when the USS Philadelphia ran aground on an uncharted coral reef and the Tripolitan Navy was able to capture the ship along with its crew and Captain William Bainbridge. The Philadelphia was turned against the Americans and anchored in the harbor as a gun battery.
On the night of February 16, 1804, a small contingent of U.S. sailors in a captured Tripolitan ketch rechristened USS Intrepid and led by Lieutenant Stephen Decatur, Jr. were able to deceive the guards on board the Philadelphia and float close enough to board the captured ship. Decatur's men stormed the vessel and decimated the Tripolitan sailors standing guard. To complete the daring raid, Decatur's party set fire to the Philadelphia, denying her use to the enemy. Decatur's bravery in action made him one of the first American military heroes since the Revolutionary War.
Preble attacked Tripoli outright on July 14, 1804 in a series of inconclusive battles, including a courageous but unsuccessful attack by the fire ship USS Intrepid under Captain Richard Somers. Intrepid, packed with explosives, was to enter Tripoli harbor and destroy itself and the enemy fleet; it was destroyed, perhaps by enemy guns, before achieving that goal, killing Somers and his crew.
The actions against Tripoli harbor continued to prove indecisive until September when Commodore Samuel Barron assumed command of the Mediterranean Squadron and focused the fleet's attention on supporting William Eaton's attack on Derna.
Several of the United States' early naval heroes served in the blockade including Stephen Decatur, William Bainbridge, Charles Stewart, Isaac Hull, David Porter, Reuben James and Edward Preble. Collectively referred to as "Preble's Boys", many of these officers would play a significant role in the upcoming War of 1812.
Six Frigates: The Epic History of the Founding of the U.S. Navy by Ian W. Toll, 2005