The village dates back to Moslem times. It was colonised by settlers of Berber origin, who, under the protection of a defensive castle, established a farmstead; its present-day name also has its origins in this period.
Border territory during the 14th century and part of the 15th, it frequently changed hands between Christians and Moslems before finally being conquered for the Catholic Monarchs by the Marquis of Cadiz in 1485. It then became part of the Dukedom of Alcala de los Gazules, later belonging to the House of Medinaceli.
It played a key role in the struggle against French troops during the War of Independence, its inhabitants joining the various bands of guerrillas which sprang up in the Cadiz and Ronda sierras