During the Abbasid Caliphate, there were many rebellions by Kurds. During rebellions in 840, 846, and 866, Kurds took control of Mosul. Some Kurds were part of the Zanj Rebellion (869–883) and some were part of Ya'qub ibn al-Layth as-Saffar's rebellion. The Abbasid Caliphate became weak in the 9th century, and Kurdish lords were sometimes able to take control of government in the mountains.