 April 27th, 1805. During the tail end of the First Barbary War, also known as the Tripolitanian or Barbary Coast War, the Battle of Dernet began. The First Barbary War was the first overseas war conducted by the United States, who fought alongside Sweden against the pirates from the nations of Tripoli, Algiers, Tunis, and Morocco, also known collectively as the Barbary States from 1801 to 1805. In 1804, Army Lieutenant William Eaton was given permission by Thomas Jefferson to back the claim of Hamat Karmanli, who claimed he was the rightful heir to the throne of Tripoli after being deposed by his brother Yusef, who murdered his older brother by shooting him in front of his mother. When Eaton returned to the Mediterranean, he sought out Hamet in Egypt where he was an exile, and made a proposal to put him back on the throne. Hamet accepted. On March 6th, 1805, Eaton and a small detachment of eight marines led by First Lieutenant Presley O'Bannon led a force of approximately 400 Arab-Turkish and Greek mercenaries on a 500-mile hike from Alexandria Egypt across the Libya-North African Desert to their objective of Dernet, capital of the Ottoman Empire Providence of Sarenake, which is considered modern-day East Libya. The morning of April 26th, Eaton sent a letter to Mustafa Bey, the governor of Dernet. Dear Mustafa, governor of Dernet, my men and I were wondering if we could have safe passage through your city and maybe have some additional supplies? Sincerely, Lieutenant William Eaton. You've got mail. Though he was pretty sure he knew the response, the governor reportedly responded with, Dear Mr. Eaton, my head or yours. Sincerely, Mustafa Bey. Hmm, very well then. The attack on the city began at 2.45 p.m. on April 27th and by 4 o'clock the entire city guarded by 4,000 men had fallen. Only two Americans were killed and three were wounded while only nine of the mercenaries were killed or wounded during the attack. The casualties of the defenders are still unknown. Youssef, who was in Tripoli to the west, sent reinforcements to Dernet. By the time his men got there, the city had already fallen. After several failed attempts to retake the city, Eaton planned to march on to attack Tripoli by land but was stopped during his march in order to go back to Egypt after a treaty was signed between Youssef and the US Department of State. The battle of Dernet was the first land battle of the United States on foreign soil since the Revolutionary War. The attack on Dernet was the event that was the inspiration for the lyrics of To the Shores of Tripoli in the Marine's Hand.