The terms Barbary Coast, Barbary, Berbery or Berber Coast were used in English-language sources (similarly to equivalent terms in other languages) from the 16th century to the early 19th to refer to the coastal regions of North Africa or Maghreb, specifically the Ottoman borderlands consisting of the regencies in Algiers and Tripoli, as well as the Beylik of Tunis and the Sultanate of Morocco. The term originates from the name of the Berbers.
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, Tripolitania, Beylik of Tunis, and Sharifan Empire. Major rulers and petty monarchs during the times of the Barbary States' plundering parties included the Dey of Algiers, the Pasha of Tripoli, the Bey of Tunis, and the Sultan of Morocco.
In 1625, Algiers' pirate fleet (by far the largest) numbered 100 ships of various sizes employing 8,000 to 10,000 men. The corsair industry accounted for 25 percent of the workforce of the city, not counting other activities related directly to the port. The fleet averaged 25 ships in the 1680s, but these were larger vessels than had been used since the 1620s, thus the fleet still employed some 7,000 men. In addition 2,500 men manned the pirate fleet of Tripoli, 3,000 in Tunis, and several thousand more in all the various minor pirate bases such as Bona, Susa, Bizerta, and Sale. The corsairs were not solely natives of their cities; while many were Arabs and Berbers, there were also Turks, Greeks, Albanians, Syrians, and renegade Italians (especially Corsicans) among their number.
The first military land action overseas by the United States was executed by the US Marines and the US Navy in 1805 at the Battle of Derna, Tripoli, a coastal town now in eastern Libya, in April 1805. It formed part of an effort to destroy all Barbary pirates, to reclaim American slaves in captivity and end piracy acts between the 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..." It was the first time that the US Marine Corps took part in offensive actions outside the United States.