Castle, now ruined, in the gorge of the River Guadalhorce, in the Serranía de Ronda, a mountainous region in the south of Spain. It lies northeast of Ronda, WSW of Antequerra and northwest of Málaga.
It was the headquarters of Umar ibn Hafsun, an outlawed murderer who became chief of a brigand band, c.881. He surrendered in 883, but escaped and returned to Bobastro and brigandage. In 888 the Amir al-Mundhir, who had succeeded his father in 886 and was vigorous and able, died while besieging Bobastro. His brother and successor, Abd Allah, was feeble, so ibn Hafsun flourished. The space he controlled varied. In 891 he established a base at Aguilar, between Antequerra and Córdoba, and raided as far as the walls of Córdoba itself.
He was weakened after converting to Christianity in 899 (he came from a muwallad family, that is, one that had converted from Christianity to Islam), but he survived. In 912 Abd al-Rahman III became Amir and began the steady recovery of Umayyad power. By 914 ibn Hafsun was confined to the mountains. He died in 917, leaving four sons. In January 928 Bobastro surrendered.
Bobastro, in some of the wildest mountain country in Spain, may have been in the back of beyond, but it lay close to places that were far from being the back of beyond so far as the Amirs were concerned. Their authority and prestige had been badly dented by having such an audacious brigand playing fast and loose so near to the centre of their realm.