The early human occupation of the region dates back to prehistory, particularly the Neolithic period, according to the abundant archaeological testimony. Some scholars point to date of 310 BC for the founding of a settlement on the current location, fortified at the time of Romanization of the Iberian peninsula in 106, by a Praetor of Lusitania, named Áulio Cornelius (or Áulio Cornelius Palma). Modern archaeological research proves, however, that the subsequent occupation of this site was uninterrupted, initially by the Visigoths and later the Muslims, the latter responsible for the primitive fortification between the eighth century and the ninth, greatly expanded between the tenth century and the 12th.
