More than three years into the Civil War, the Union naval blockade of Southern ports had choked most of the Confederacy’s nautical lifelines. Blockade runners, however, still operated out of one major haven along the coast of the Gulf of Mexico—Mobile, Alabama.

Ever since his capture of New Orleans in April 1862, Union Admiral David Farragut had itched to storm Mobile Bay, but his commanders had held him back. “If I had the permission I can tell you it would not be long before I would raise a row with the rebels in Mobile,” he wrote to his son in February 1864. When General Ulysses S. Grant, who made the capture of the Alabama port one of his top priorities, assumed command of the Union forces weeks later, Farragut finally received his chance.

On August 5, 1864, the sailors in Farragut’s 18-ship flotilla awoke at 3 a.m. to prepare for battle. A formidable obstacle awaited them. The imposing knuckles of Fort Morgan and Fort Gaines guarded the entrance to the bay, which was so heavily seeded with floating sea mines—called “torpedoes” during the Civil War—that ships were forced to thread a narrow channel directly under the citadels’ guns.

The good news for Farragut was that if his fleet could slip by the torpedoes and forts, Mobile Bay was defended by only four Confederate ships under the command of Admiral Franklin Buchanan, the only man to hold that rank in the Confederacy. Few dogs were saltier than “Old Buck,” who had spent 49 years at sea, but the 63-year-old Farragut was one of them. The Union admiral had joined the U.S. Navy at the age of 9. Three years later he became a prize master responsible for captured British vessels during the War of 1812. The Civil War successes of the man whose naval career spanned more than a half-century were particularly rankling to the South, which viewed him as a traitor. Born in Tennessee, Farragut was raised in New Orleans, the city he had seized earlier in the war, and married to a Southerner. (Buchanan, a Maryland native, shared a similar treacherous reputation in the North.)

Implementing a battle plan he had plotted on a map using small wooden boats carved by his ship’s carpenter, Farragut ordered his vessels into two parallel columns, with four ironclad monitors in one line to pass nearest Fort Morgan and seven pairs of wooden vessels in the other. Larger ships were lashed side by side to smaller gunboats to shield them from Fort Morgan’s devastating fire. Farragut initially announced that his flagship, USS Hartford, would take the lead, but the admiral reluctantly changed his mind after his captains lobbied to have USS Brooklyn, which had a mine-sweeping device under its bow, go first.

Shortly before 7 a.m., the battle commenced as shots rang out through the overcast skies. With black cannon smoke mixing with the summer haze, Farragut could no longer see the action. Although he suffered from vertigo, the admiral climbed 20 feet up the rigging, nearly level with the pilot, for a better perch. With one hand clinging to the ropes and another clutching a pair of binoculars, Farragut surveyed the battle as shots whizzed by him. Percival Drayton, Hartford’s captain, worried for the admiral’s safety and dispatched a signalman with a piece of line to tie Farragut to the rigging.

Then suddenly on Hartford’s starboard side, an explosion rang out and the bow of one of the Union’s iron-hulled monitors, USS Tecumseh, suddenly heaved up out of the water. It turned on its starboard side like a wounded whale. The stern rose high in the air with Tecumseh’s exposed propeller still revolving before the ship suddenly sank out of sight with 90 men still on board.

Realizing that a torpedo had sunk Tecumseh and fearful of striking another, the commander of the lead ship, Brooklyn, ordered the engines stopped. Farragut watched as confusion spread across the Union fleet as it began to pile up directly in the firing line of Fort Morgan’s pounding guns. A private reported that Hartford’s “cockpit looked more like a slaughter house.” Sensing impending disaster, the admiral took control to rally his confused charges and ordered Hartford and its consort to pass through the minefield to get to the front of the line. Although not prone to swearing, Farragut supposedly exhorted, “Damn the torpedoes! Full speed ahead!” Nervous sailors heard the bobbing torpedoes banging and scraping Hartford’s hull as well as the primers snapping on the mines. Fortunately for Farragut’s men, the torpedoes were either faulty or corroded by salt water and failed to ignite.

Hartford safely led the Union flotilla through the mines and out of range of Fort Morgan’s guns. All that remained was the badly outnumbered Confederate force. Although he faced overwhelming odds, Buchanan ordered his flagship, the 200-foot-long ironclad CSS Tennessee, to charge Hartford. The two vessels passed so closely to each other that a sailor on board Hartford threw a spittoon at the enemy while a rebel leaned out of a gun port and stabbed a Union sailor with a bayonet. Farragut’s forces pounded Tennessee until it could no longer fight. The crippled iron monster raised a white flag in surrender.

The Union had seized control of Mobile Bay and sealed it off from blockade runners. Fort Gaines surrendered three days later followed by Fort Morgan on August 23. The city of Mobile itself remained too fortified to capture, and it did not surrender until April 12, 1865, three days after Appomattox.

The Battle of Mobile Bay was Farragut’s crowning achievement and also the last naval combat he ever saw. The admiral never claimed to have spoken his immortal words, but they became legendary. By Farragut’s death in 1870, they began to find their way into print with variations of the second line of the order including “Four bells!” or “Go ahead!” Whether Farragut’s iconic phrase was ever uttered or not, his actions in Mobile Bay certainly embodied the words.