The first documents of Baena Castle date at the beginning of the 9th century (890), during the reign of Emir Ahdullah, whose Governor in Regio since 889 had been Omar Ben Hafsum who rebelled and took Baena in 891.
In 1228, the governor of Fernando III in Baeza attacked the castle, belonging then to Seville. Subsequently the castle was attacked by Mohamed, the king of Granada, 1297. In July 1320 a peace treaty was signed in this castle between the Alonso XI and Ismail, King of Granada, which guaranteed this peace for eight years. In 1332, this same Alfonso XI garrisoned the castle in the face of danger from Granada, and in 1341 he left Baena to attack the Nasrid kingdom, not before providing the fortress with men and materials. In 1362 Abu Said, King of Granada, the Bermejo, took refuge in Baena and was accompanied to Seville by people from Cordoba.
In 1401 the castle was ceded by Henry III to the Marshal, Don Diego Fernández de Córdoba, with the opposition of the inhabitants of the city, taking possession of it in 1438.
Since the 16th century it has been used as the Palacio de los Duques. Diego Fernández de Córdoba, III Conde de Cabra, established his residence in the castle at the beginning of the 16th century and gave it a more palatial character. In 1520 the Baena and Condado de Cabra estate became related by marriage to the Duchy of Sessa. En 1566, by a Royal Decree of Philip II, Baena became the Duchy of Baena whereupon the lords of Baena came to be the Dukes of Sessa and Baena. It is from that time when there began to be a succession of structural changes in the fortified enclosure aimed at making the place suitable as a residence, and the military character of the complex faded into the background.
Baena Castle is square and still has part of its original walls and three of the four towers located in those of: El Secreto, Los Cascabeles and the last one of the Cinco Esquinas or Las Arqueras.
References:Tyniec Benedictine abbey was founded by King Casimir the Restorer probably around 1044. Casimir decided to rebuild the newly established Kingdom of Poland, after a Pagan rebellion and a disastrous Czech raid of Duke Bretislaus I (1039). The Benedictines, invited to Tyniec by the King, were tasked with restoring order as well as cementing the position of the State and the Church. First Tyniec Abbot was Aaron, who became the Bishop of Kraków. Since there is no conclusive evidence to support the foundation date as 1040, some historians claim that the abbey was founded by Casimir the Restorer’ son, King Boleslaw II the Generous.
In the second half of the 11th century, a complex of Romanesque buildings was completed, consisting of a basilica and the abbey. In the 14th century, it was destroyed in Tatar and Czech raids, and in the 15th century it was rebuilt in Gothic style. Further remodelings took place in the 17th and 18th centuries, first in Baroque, then in Rococo style. The abbey was partly destroyed in the Swedish invasion of Poland, and soon afterwards was rebuilt, with a new library. Further destruction took place during the Bar Confederation, when Polish rebels turned the abbey into their fortress.
In 1816, Austrian authorities liquidated the abbey, and in 1821-1826, it was the seat of the Bishop of Tyniec, Grzegorz Tomasz Ziegler. The monks, however, did not return to the abbey until 1939, and in 1947, remodelling of the neglected complex was initiated. In 1968, the Church of St. Peter and Paul was once again named the seat of the abbot. The church itself consists of a Gothic presbytery and a Baroque main nave. Several altars were created by an 18th-century Italian sculptor Francesco Placidi. The church also has a late Baroque pulpit by Franciszek Jozef Mangoldt.