On April 27, 1805, US Marines attacked the shores of Tripoli. From the article:
"U.S. agent William Eaton leads U.S. forces “to the shores of Tripoli”
After marching 500 miles from Egypt, U.S. agent William Eaton leads a small force of U.S. Marines and Berber mercenaries against the Tripolitan port city of Derna. The Marines and Berbers were on a mission to depose Yusuf Karamanli, the ruling pasha of Tripoli, who had seized power from his brother, Hamet Karamanli, a pasha who was sympathetic to the United States.
The First Barbary War had begun four years earlier, when U.S. President Thomas Jefferson ordered U.S. Navy vessels to the Mediterranean Sea in protest of continuing raids against U.S. ships by pirates from the Barbary states–Morocco, Algeria, Tunis, and Tripolitania. American sailors were often abducted along with the captured booty and ransomed back to the United States at an exorbitant price. After two years of minor confrontations, sustained action began in June 1803, when a small U.S. expeditionary force attacked Tripoli harbor in present-day Libya.
In April 1805, a major American victory came during the Derna campaign, which was undertaken by U.S. land forces in North Africa. Supported by the heavy guns of the USS Argus and the USS Hornet, Marines and Arab mercenaries under William Eaton captured Derna and deposed Yusuf Karamanli. Lieutenant Presley O’ Bannon, commanding the Marines, performed so heroically in the battle that Hamet Karamanli presented him with an elaborately designed sword that now serves as the pattern for the swords carried by Marine officers. The phrase “to the shores of Tripoli,” from the official song of the U.S. Marine Corps, also has its origins in the Derna campaign."