In the late 10th century, the Abbasid Caliphate had split into many independent states and was weakened by internal fighting. The Shia Fatimids, who broke from the Abbasids in 909, took control of Egypt c. 969 and occupied the holy cities of Medina and Mecca. In 945, the Iranian Buyids conquered Iraq and made Baghdad their capital. Ar-Radi (r. 934–940), the 20th Abbasid caliph, continued to rule in Baghdad, but as a Buyid puppet. The Buyids conquered Fars, Daylam, Tabaristan and Ahwaz. The Samanid domains in Transoxiana, Afghanistan, Multan and Sistan were seized in 999 by a Turkic dynasty, known as the Karakhads, while the Ghaznavid dynasty controlled central Afghanistan. The Hamdanid dynasty briefly controlled Aleppo and Mosul c. 979, but were deposed by the Fatimids in 1003. Meanwhile, the Byzantine Empire was going through a period of expansion.
— OR —