<P> In the 16th century the Hafsids became increasingly caught up in the power struggle between Spain and the Ottoman Empire - supported Corsairs . Ottomans conquered Tunis in 1534 and held one year . Due to Ottoman threat, Hafsids were vassal of Spain after 1535 . Ottomans again conquered Tunis in 1569 and held it for 4 years . Don Juan of Austria recaptured it in 1573 . The latter conquered Tunis in 1574 and the Hafsids accepted becoming a Spanish vassal state to offset the Ottoman threat . Muhammad IV, the last Caliph of the Hafsids was brought to Constantinople and was subsequently executed due to his collaboration with Spain and the desire of the Ottoman Sultan to take the title of Caliph as he now controlled Mecca and Medina . The Hafsid lineage survived the Ottoman massacre by a branch of the family being taken to the Canary Island of Tenerife by the Spanish . </P> <Dl> <Dd> See also History of Ottoman Egypt </Dd> </Dl> <Dd> See also History of Ottoman Egypt </Dd> <P> After the Middle Ages, Northern Africa was loosely under the control of the Ottoman Empire, except for the region of Morocco . Ottoman rule was centered on the cities of Algiers, Tunis, and Tripoli . </P>

Country ruled by military dictatorship in northern africa