This is the dynastic name generally given to the caliphs of Baghdad, the second of the two great Sunni dynasties of the Arab Empire. The Abbasids overthrew the Umayyad caliphs from all their lands except Spain. The Abbasids continued the policy of the Umayyads with respect to Yemen. Frequently, a member of the highest Abbasid aristocracy, including princes of the dynasty, served as governors. But Yemen remained fragmented: the historian al-Yaqubi (d. 897) speaks of 84 provinces and a large number of tribes. Activities of the Alids threatened the Abbasid hold over Yemen. Ibrahim ibn Musa al-Kazim, brother of the well-known Alid Ali ar-Ridha, occupied San'a and the highlands in 815 and struck coins in his own name. He was, however, soon defeated by the troops of Caliph al-Ma'mun. Nevertheless, after the caliph had reached an understanding with the Alids, the same Ibrahim ibn Musa was appointed governor of Mecca and Yemen. San'a remained under the control of the caliph for some time. In the course of the late 9th century, however, the power of the Abbasids over various fringe areas waned. Local Yemeni dynasties began to appear, either opposed to the Abbasids or acknowledging them.