The Berber Revolt or the Kharijite Revolt of 740–743 AD (122–125 AH in the Islamic calendar) took place during the reign of the Umayyad Caliph Hisham ibn Abd al-Malik and marked the first successful secession from the Arab caliphate (ruled from Damascus). Fired up by Kharijite puritan preachers, the Berber revolt against their Umayyad Arab rulers began in Tangier in 740, and was led initially by Maysara al-Matghari. The revolt soon spread through the rest of the Maghreb and across the straits to al-Andalus.
Although the Berbers managed to end Umayyad rule in the western Maghreb following the battles of Badgoura and of the Nobles, the Umayyads scrambled and managed to prevent the core of Ifriqiya (Tunisia, eastern Algeria and western Libya) and al-Andalus (Spain and Portugal) from falling into rebel hands, notably securing victory in the decisive battle of al-Asnam. However, the rest of the Maghreb was never brought back under Umayyad rule. After failing to capture the Umayyad provincial capital of Kairouan, the Berber rebel armies dissolved, and the western Maghreb fragmented into a series of small statelets, ruled by tribal chieftains and Kharijite imams.