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.
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.
Purchase of Christian captives in the Barbary States.
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.