Looking for somewhere to visit before or after the Caminito del Rey? The archaeological site of Bobastro, near El Chorro in Málaga province, is an interesting detour into the history of Al-Andalus.
Bobastro was the stronghold of Omar ben Hafsun, a rebel leader who challenged the rulers of Córdoba in the late ninth and early tenth centuries. Today, you can explore the remains of his fortified settlement and visit the remarkable rock-cut Mozarabic church, set among the rugged hills above the Guadalhorce reservoirs.
You’ll need a car to reach the site, but it offers something quite different from the Caminito del Rey itself. It’s worth considering if you have extra time in the area and an interest in its history.
The Story of Bobastro and Omar ben Hafsun
The area around Bobastro was the centre of a prolonged rebellion led by Umar ibn Hafsun ibn Ja’far ibn Salim (Arabic: عمر بن حَفْصُون بن جعفر بن سالم), known in Spanish as Omar ben Hafsun. He challenged the Umayyad rulers of Córdoba and established a stronghold at Bobastro, from where he controlled territories across parts of what is now southern Spain.
Ibn Hafsun began his rebellion in 881 and resisted the forces of Córdoba for more than three decades. Although born a Muslim, he later converted to Christianity, taking the name Samuel. He died in 917, but the resistance continued under his successors until Bobastro was captured in 928.
Ancestry of Omar Ben Hafsun
The ancestry of Umar ibn Hafsun is uncertain. The tenth-century writer Ibn Abd Rabbih referred to him as a Sawada, a term associated in historical accounts with people of African ancestry. More than a century later, the historian Ibn Hayyan recorded a genealogy tracing Ibn Hafsun’s family back to his great-grandfather, Ja’far ibn Salim, who was said to have converted to Islam and settled in the Ronda area of what is now Málaga province.
Later historians repeated and developed this family history, tracing the lineage back through several generations to a figure called Marcellus, or possibly Frugelo, who was described as the son of Alfonso and associated with the Christian Visigothic past of the Iberian Peninsula.
However, the reliability of this genealogy has been questioned. Historian David Wasserstein argued that the part of the family tree predating the conversion to Islam may have been invented by Ibn Hafsun himself. In 1820, the historian José Antonio Conde likewise described his ancestry as obscure and uncertain.
His Life
Umar ibn Hafsun was born around the middle of the ninth century, probably in the mountainous countryside near Parauta in what is now Málaga province.

Historical accounts portray him as a rebellious young man who became involved in violent disputes. After an alleged murder around 879, he joined a group of bandits and was eventually captured by the governor of Málaga. He later escaped and fled to North Africa, where he is said to have worked briefly as a stonemason.
Returning to Al-Andalus, Ibn Hafsun became involved in the growing resistance to the Umayyad rulers of Córdoba. His military ability and leadership helped him rise through the ranks of the rebels, and he eventually established his base at Bobastro, occupying and rebuilding the remains of the old fortified settlement.
Over the following years, Ibn Hafsun strengthened Bobastro and fortified nearby Ardales. He drew support from muwallads (people of local Iberian ancestry who had converted to Islam) and Mozarabs (Christians living under Muslim rule), capitalising on resentment towards the Umayyad authorities over taxation and their treatment of local communities.
His influence extended well beyond Bobastro. At different times, he controlled or allied himself with settlements and fortifications across parts of what are now the provinces of Málaga, Cádiz, Granada, Jaén and Seville.

By 883, Ibn Hafsun had become the leader of the rebels in the provinces to the south and west of the Emirate of Córdoba. The previous year, in 882, he is said to have fought the Emir in a battle in which his Christian ally, García Íñiguez of Pamplona, was killed.
Around 885, Ibn Hafsun moved his headquarters to the town of Poley, now known as Aguilar de la Frontera, to place himself more centrally and respond more quickly to threats from his enemies.
After his defeat by the forces of Abdallah ibn Muhammad at the Battle of Poley in 891, Ibn Hafsun returned his headquarters to Bobastro. In 898, Lubb ibn Muhammad of the Banu Qasi was marching an army to support him, but the death of Lubb’s father at Zaragoza forced him to abandon the campaign.
In 899, Ibn Hafsun renounced Islam and converted to Christianity, taking the name Samuel. His motivation was probably political, and he may have hoped to secure military support from Alfonso III of León.
His conversion proved a major political mistake which although helping to attract significant Mozarab support, cost him the support of most of his Mullawad followers.
Although seriously weakened by his conversion to Christianity, Ibn Hafsun did remain a serious threat to the Caliphs of Córdoba and in 910 he offered allegiance to the Fatimid rulers of north Africa.
But, when Abd-ar-Rahman III became Emir of Cordoba in 912 he instigated a policy of annual Spring offensives using mercenary troops against Ibn Hafsun.
In 913 the mercenaries captured the city of Seville, and by the end of 914 had captured 70 of Ibn Hafsun’s castles.
In 916, he strangely joined forces with his enemies, the Umayyads in a campaign against northern Christian kingdoms, the reasons for this are not clear, maybe he saw the end coming and was trying to compromise or maybe just to save his own skin. For a while, even taxes and tributes were paid to the Umayyads (Something that Ibn Hafsun never did).
Ibn Hafsun died in 917 and was buried in the Iglesia Mozarabe (Mozarab Church) that he also had built at Bobastro. After his death, the fragile coalition then crumbled and even though his three sons Ja’far,’ Abd-ar-Rahman and Hafs tried to continue the resistance, they eventually fell to ‘Abd-ar-Rahman III’s armies. The last, Hafs, surrendered Bobastro in 928 and afterward is believed to have fought with the Umayyad army in Galicia.
With Bobastro’s fall, the mortal remains of Ibn Hafsun and his slain sons are said to have been exhumed by the emir and posthumously crucified outside the Great Mosque of Córdoba.
Visiting Bobastro: admission and opening hours
Admission to the Bobastro archaeological site costs €3 for adults, with a reduced price of €2 for pensioners and children aged 5 to 12, according to the published visitor information.
Guided visits are advertised from Tuesday to Sunday, with tours starting approximately every hour between 10 am and 3 pm. The guided tour is in Spanish, but information boards are also available in English.
Opening hours and tour arrangements can change, particularly during the summer, so check the latest information before setting off. For enquiries and bookings, contact Ardales Town Hall on 952 458 046. (Expect to speak Spanish)
Getting to Bobastro from El Chorro
Bobastro is reached by road from the El Chorro and Ardales area, on the hills above the Guadalhorce reservoirs. You’ll need a car, as there is no regular public transport serving the archaeological site.
From El Chorro, follow the MA-444 towards Ardales and look out for the turn-off signposted for Bobastro and the Mesas de Villaverde. The access road climbs towards the archaeological site, where you can visit the remains of the fortified settlement and its rock-cut church.
Allow extra time for the drive and your visit if you’re fitting Bobastro around a booking for the Caminito del Rey.
Bobastro and Omar Ben Hafsun: Frequently Asked Questions
Omar ben Hafsun was a rebel leader who challenged the Umayyad rulers of Córdoba in the late ninth and early tenth centuries. He established his stronghold at Bobastro, where he maintained resistance until his death in 917. His successors continued the struggle until the settlement fell in 928..
The archaeological site contains the remains of the fortified settlement associated with Omar ben Hafsun, including the remarkable rock-cut Mozarabic church. The ruins occupy a dramatic hillside setting above the Guadalhorce reservoirs and offer an insight into a turbulent period of Andalusian history.
You need a car to reach Bobastro, as there is no regular public transport to the archaeological site. From El Chorro, follow the road towards Ardales and the signs for Bobastro and Mesas de Villaverde.
Published visitor information lists an adult admission price of €3, with reduced admission of €2 for pensioners and children aged 5 to 12. Guided visits are advertised from Tuesday to Sunday, with tours approximately every hour between 10 am and 3 pm. Tours are in Spanish, although information boards are available in English. Confirm the latest prices and arrangements before visiting.
In 899, Ben Hafsun converted from Islam to Christianity, likely to gain military support from the Christian kingdoms in the north. Though the move attracted support from Mozarabs, it alienated many of his Muslim followers and weakened his cause.
I’ve been living in this lovely area of Western Andalucia for the last 20 years or so and dedicate most of my time to the running of English language tourist information websites for the towns of Cádiz, Ronda, Grazalema, the famous or infamous Caminito del Rey, and also Wildside Holidays, which promotes sustainable and eco-friendly businesses running wildlife and walking holidays in Spain. My articles contain affiliate links that will help you reserve a hotel, bus, train or activity in the area. You don’t pay more, but by using them you do support this website. Thankyou!
2 thoughts on “Bobastro castle and Omar ben Hafsun”
Comments are closed.