Bobastro was a castle of Roman origin, rebuilt as the headquarters of Umar ibn Hafsun during his rebellion against the Caliphate of Córdoba in the 9th century. Its ruins lie in the Province of Málaga, Spain. There had been a structure at the site since Roman times.