The term Barbary Coast (also Barbary, Berbery or Berber Coast) was used by Europeans from the 16th century to the early 19th to refer to the coastal regions of North Africa, which were inhabited by Berber people. Today this land is part of the modern nations of Morocco, Algeria, Tunisia and Libya.
The English term "Barbary" (and its European varieties: Barbaria, Berbérie, etc.) could refer to all the Berber lands whether coastal or not, as seen in European geographical and political maps published during the 17th-20th centuries.
The name derives from the Berber people of North Africa, from Greek Bàrbaroi (Ancient Greek: , literally meaning barbarians) and the Arabic Barbar ( ? ), meaning "barbaric". In the Western world, the name commonly evoked the Barbary pirates and the Barbary slave traders based on that coast--who attacked ships and coastal settlements in the Mediterranean Sea and eastern North Atlantic Ocean, and captured and traded slaves or goods from Europe, the United States and sub-Saharan Africa. These actions finally provoked the Barbary Wars of the early 19th century.
Barbary was not always a unified political entity. From the 16th century onwards, it was divided into the political entities of the Regency of Algiers, Tunis, and Tripolitania (Tripoli). Major rulers and petty monarchs during the times of the Barbary states' plundering parties included the Pasha or Dey of Algiers, the Bey of Tunis and the Bey of Tripoli.
Before then, the territory was usually divided between Ifriqiya, Morocco, and a west-central Algerian state centered on Tlemcen or Tiaret. Powerful Berber dynasties such as the Almohads (12th century) and briefly thereafter the Hafsids, occasionally unified it for short periods. From a European perspective, Tripoli in modern-day Libya was considered its capital or chief city, though Marrakesh in Morocco was the largest and most important Berber city at the time. Some[by whom?] saw Algiers in Algeria or Tangiers in Morocco as the capital.
The first United States military land action overseas, executed by the U.S. Marines and Navy, was the Battle of Derna, Tripoli (a coastal town in modern eastern Libya) in April 1805. It formed part of an effort to destroy all of the Barbary pirates, to free American slaves in captivity, and to put an end to piracy acts between these warring tribes on the part of the Barbary states, which were themselves member states of the Ottoman Empire. The opening line of the Marines' Hymn refers to this action: "From the halls of Montezuma to the shores of Tripoli..." This was the first time the United States Marine Corps took part in offensive actions outside of the United States.