Masayra was killed by his own followers, the revolt spread and the Berber rebels defeated three Arab armies. After the defeat of the third army, which included elite units of Syrians commanded by Kulthum and Balj, the Berber revolt spread further. At this time, the Berber military colonies in Spain revolted. At the same time, Uqba died and was replaced by Ibn Qatan. By this time, the Berbers controlled most of the north of the Iberian peninsula, except for the Ebro valley, and were menacing Toledo. Ibn Qatan invited Balj and his Syrian troops, who were at that time in Ceuta, to cross to the Iberian peninsula to fight against the Berbers. The Berbers marched south in three columns, simultaneously attacking Toledo, Cordoba, and the ports on the Gibraltar strait. However, Ibn Qatan's sons defeated the army attacking Toledo, the governor's forces defeated the attack on Cordoba, and Balj defeated the attack on the strait. After this, Balj seized power by marching on Cordoba and executing Ibn Qatan. Collins points out that Balj's troops were away from Syria just when the Abbasid revolt against the Umayyads broke out, and this may have contributed to the fall of the Umayyad regime. In Africa, the Berbers were hampered by divided leadership. Their attack on Kairouan was defeated, and a new governor of Africa, Hanzala ibn Safwan, proceeded to defeat the rebels in Africa and then to impose peace between Balj's troops and the existing Andalusi Arabs. Roger Collins argues that the Great Berber revolt facilitated the establishment of the Kingdom of Asturias and altered the demographics of the Berber population in the Iberian peninsula, specifically contributing to the Berber departure from the northwest of the peninsula. When the Arabs first invaded the peninsula, Berber groups were situated in the northwest. However, due to the Berber revolt, the Umayyad governors were forced to protect their southern flank and were unable to mount an offense against the Asturians. Some presence of Berbers in the northwest may have been maintained at first, but after the 740s there is no more mention of the northwestern Berbers in the sources. In al-Andalus during the Umayyad emirate When the Umayyad Caliphate was overthrown in 750, a grandson of Caliph Hisham, Abd ar-Rahman, escaped to north Africa and hid among the Berbers of north Africa for five years. A persistent tradition states that this is because his mother was