Teba castle (Castillo de la Estrella), now a ruin, was built during the 10th century and further modified during the 12th and 13th centuries.
It is a double enclosure, with a barbican to the northeast and a total of eighteen towers. There are three entrances, the main one facing the direction of Ronda (west) and two smaller ones facing north and northeast.
In 1330, King Alfonso Xi of Castilla led a crusade against the Moors of Granada and attacked the castle. He was joined in battle by ‘The Black Douglas’ (Sir James Douglas, 1286 – August 25, 1330), a Scottish knight and soldier who had fought in the Scottish Wars of Independence and had been charged with taking the embalmed heart of King Robert (The Bruce) to the Holy Sepulchre in Jerusalem.
Unfortunately, Douglas and many of his companions died during the battle. His body, and the casket containing the heart, were returned to Scotland. The heart is interred under the high altar of Melrose Abbey.
In the middle of the 15th century the castle passed into the hands of Juan Ramirez de Guzmán, whose descendants were afforded the title Count of Teba in 1552. During the War of Independence it was occupied by the French.