Today's provincial capital was a favourite city of the Moors and in 1224 they even made it the capital of a small taifa, or break-away kingdom.
The capital existed as far back as Moorish times.