The Visigoths ruled after the Western Roman Empire's collapse near the end of the 5th century. Moorish Al-Andalus gained control in the early 8th century, after conquering the Visigothic kingdom in 711–718. After the defeat of Emir Abdul Rahman Al Ghafiqiwas's troops at Tours in 732, the Franks gradually gained control of the former Visigoth territories north of the Pyrenees, which had been captured by the Muslims or had become allied with them, in what is today Catalonia under French administration. In 795, Charlemagne created what came to be known by historiography and some Frankish chronicles as the Marca Hispanica, a buffer zone beyond the province of Septimania, made up of locally administered separate counties which served as a defensive barrier between the Umayyad of Al-Andalus and the Frankish Kingdom.