The Alcázar (castle) of Cordoba, with its thick defensive walls, served both as a fortress and a palace, and is a perfect illustration of the development of Cordoban architecture through the ages. Roman and Visigoth ruins lie side by side with Arabic remains in this magnificent building, which was once the favourite residence of the different rulers of the city. However, when Cordoba was taken by Fernando III «the Saint» in 1236, the former Caliphal Palace was in a pitiful, ruinous state. Alfonso X «the Wise» began the restoration work, which was finished off during the reign of Alfonso XI. It has fulfilled many different functions over the years, such as Headquarters of the Inquisition, or a prison (first half of the 20th century).At first sight, one of the most surprising features of the fortress is its almost rectangular shape with its long walls made of solid blocks of stone (ashlars) and four corner towers (the tower of the Lions, the main keep, the tower of the Inquisition and the tower of the Doves). Inside, the different halls are distributed around courtyards with an exotic array of flowers, aromatic herbs and mature trees. Both rooms and corridors are covered by stone cupolas in Gothic style.