When the Muslims captured the area in 714, they soon realized the value of this strategic location and they built a fortress (called Kunka) between two gorges dug between the Júcar and Huécar rivers, surrounded by a 1 km-long wall.