Argarica and Phonetician remains have been found in this town, that was Salambina for the Carthaginians, Segalvina for the Romans and Salawbiniya for the Arabs.
Under the Romans, it was part of the road that connected Castulo and Malaka. In the Middle Ages it was also an important fortress. The expedition of King Alphonse I of Spain 'El Batallador' got here, in Andalusi territory.
The Catholic Monarchs conquered it in 1489 and years later it was defended by Francisco Ramírez against an Arab attack. In the 18th and 19th centuries, it was severely attacked by Turkish pirates, and the inhabitants had to move to safer places in the nearby mountains. In the 20th century, the town underwent a prosperous period thanks to sugar cane and tropical species farming, as well as tourism.