 Devastated by the Vandals and other Germanic tribes, Cerdanya was part of the Visigothic kingdom of Toulouse and later Toledo, until eventually it was conquered by the Muslims.After Muslim expansion was halted by Odo the Great in the Battle of Toulouse (721), the Berber commander Uthman ibn Naissa established a small realm in Cerdanya and allied with Odo, so that the Aquitanian leader could secure his south-eastern borders.However, Uthman ibn Naissa came next under Umayyad attack and the Berber lord was defeated, opening the way to Abdul Rahman Al Ghafiqi's expedition into Aquitaine.