The strategic location in Tarifa, the southernmost point of the peninsula, gives access to the Strait of Gibraltar, and for centuries has exercised a strong defensive character to the city.
It was built in 960 by the caliph Abd al-Rahman III and passed through the hands of the Almoravids, Umayyad, Benimerines until it was finally conquered by the Christians.
The castle is named after the heroic deeds of Alonso Perez de Guzman, who in 1294 was accompanied by his troops when the castle was completely surrounded and besieged by the Muslim army. Holding the son of Guzman hostage, Muslims urged him to surrender the castle in exchange for the life of his first born. What Guzman did, is written in the history books as a great act of courage and loyalty to his king. This man not only decided to continue fighting to defend the castle, but he himself lent a dagger to the Muslims so they can kill him.
It was during the 16th and 17th centuries when the castle was rebuilt, this time to defend off the attacks by Barbary pirates who at that time were terrorizing the coast of the peninsula. Later in the 18th century, the castle was adapted to install artillery on it and during the War of Independence, it served as a defense against the attack by the French.