although they otherwise retained complete autonomy from central control, while the deeper parts of the Sahara were completely independent from Algiers. Barbary raids in the Mediterranean continued to attack Spanish merchant shipping, and as a result, the Spanish Navy bombarded Algiers in 1783 and 1784. For the attack in 1784, the Spanish fleet was to be joined by ships from such traditional enemies of Algiers as Naples, Portugal and the Knights of Malta. Over 20,000 cannonballs were fired, much of the city and its fortifications were destroyed and most of the Algerian fleet was sunk. In 1792, Algiers took back Oran and Mers el Kébir, the two last Spanish strongholds in Algeria. In the same year, they conquered the Moroccan Rif and Oujda, which they then abandoned in 1795. In the 19th century, Algerian pirates forged affiliations with Caribbean powers, paying a "license tax" in exchange for safe harbor of their vessels. Attacks by Algerian pirates on American merchantmen resulted in the First and Second Barbary Wars, which ended the attacks on U.S. ships in 1815. A year later, a combined Anglo-Dutch fleet, under the command of Lord Exmouth bombarded Algiers to stop similar attacks on European fishermen. These efforts proved successful, although Algerian piracy would continue until the French conquest in 1830. French colonization (1830–1962) Under the pretext of a slight to their consul, the French invaded and captured Algiers in 1830. Historian Ben Kiernan wrote on the French conquest of Algeria: "By 1875, the French conquest was complete. The war had killed approximately 825,000 indigenous Algerians since 1830." French losses from 1831 to 1851 were 92,329 dead in the hospital and only 3,336 killed in action. The population of Algeria, which stood at about 2.9 million in 1872, reached nearly 11 million in 1960. French policy was predicated on "civilising" the country. The slave trade and piracy in Algeria ceased following the French conquest. The conquest of Algeria by the French took some time and resulted in considerable bloodshed. A combination of violence and disease epidemics caused the indigenous Algerian population to decline by nearly one-third from 1830 to 1872. On 17 September 1860, Napoleon III declared "Our first duty is to take care of the happiness of the three million Arabs, whom the fate of arms has brought under our domination." During this time, only Kabylia resisted, the Kabylians were not colonized until after the Mokrani Revolt