By the millennium, the Islamic world was prey to an array of centrifugal forces. At its core, the Abbasid caliphate had been reduced to a largely symbolic function by the Buwayhid emirate. In its turn the Buwayhids had passed their peak, and were increasingly threatened by internal dissent, and the coming powers to their east and west, the Ghaznavids and Fatimids. In 1029, Mahmud of Ghazni spared time from his Indian campaigns to depose the Buyid emir from his capital Rai. The Buyids lingered on in Baghdad until the arrival of the Seljuk Turks (1048). To the west, the Fatimids became the first Islamic Shiite dynasty. Originally from Kairouan, they conquered Egypt by 974 (encountering more resistance from raiding Karmatians of eastern Arabia than the local Abbasid puppet dynasty) and founded the city of Cairo (969). Their advance north was blocked in Syria by a succession of resolute Byzantine emperors.