In 1671 the taifa rebelled, killed the agha, and placed one of its own in power. The new leader received the title of dey. After 1689 the right to select the dey passed to the divan, a council of some sixty notables at first was dominated by the ojaq, but by the 18th century it had become the dey's instrument. In 1710 the dey persuaded the sultan to recognize him and his successors as regent, replacing the pasha in that role. Although Algiers remained a part of the Ottoman Empire, the Ottoman government, ceased to have effective influence there. The dey was in effect a constitutional autocrat. The dey was elected for a life term, but in the 159 years (1671-1830) that the system survived, fourteen of the twenty-nine deys were assassinated. Despite
The Barbary pirates preyed on Christian and other non-Islamic shipping in the western Mediterranean Sea. The pirates forced the people on the ships they captured into slavery; the pirates also attacked coastal villages in southern and Western Europe in order to enslave the inhabitants. They often made raids, called Razzias, on European coastal towns to capture Christian slaves to sell at slave markets in places such as Turkey, Egypt, Iran, Algeria and Morocco.
In 1558, Barbary corsairs captured the town of Ciutadella (Minorca), destroyed it, slaughtered the inhabitants and took 3,000 survivors to Istanbul as slaves. Barbary pirates often attacked the Balearic Islands, and in response many coastal watchtowers and fortified churches were erected. The threat was so severe that the island of Formentera became uninhabited. Between 1609 to 1616, England lost 466 merchant ships to Barbary pirates. In the 19th century, the pirates forged affiliations with Caribbean powers, paying a "license tax" in exchange for safe harbor of their vessels. One American slave reported that the Algerians had enslaved 130 American seamen in the Mediterranean and Atlantic from 1785 to 1793.