Apulia was an autonomous duchy until 1130 when its duke became king of Sicily. After 1282, when the kingdom lost the island of Sicily itself, Apulia remained part of the remnant Kingdom of Naples (confusingly known also as the Kingdom of Sicily), and remained so until the unification of Italy in 1861. This kingdom was independent under the House of Anjou from 1282 to 1442, then was part of Aragon until 1458, after which it was again independent under a cadet branch of the House of Trastámara until 1501. As a result of the French–Spanish war of 1501–1504, Naples again came under the rule of Aragon and the Spanish Empire from 1504 to 1714. When Barbary pirates of North Africa sacked Vieste in 1554, they took an estimated 7,000 slaves. The coast of Apulia was occupied at times by the Turks and at other times by the Venetians.