The geographical situation of the town gave it relevance for centuries
BAENA WAS THE SCENE OF GREAT HISTORICAL EVENTS
The current urban center of Baena and more specifically its historic neighborhood of Almedina, was the seed of the Muslim city that would end up becoming the capital of the Bayyana chora, one of the provinces that made up the Caliphate of Córdoba.
The name of the town appears in important documents of the time
The origin of Baena in its current location seems to be around the muladí uprising of Omar ben Hafsúm that at the end of the 10th century harassed the emirate of Córdoba, being in the year 890 890 when he conquered the old Bayyanaassassinating its defenders in a place nearby that still retains the name of Peñas de Omar.
As a result of this bloody event, the town changed its location to the immediate hill with rapid slopes and better defense, where a large citadel had been built, the germ of the current castle, to house a cavalry garrison and the residence of the governor of the Cora de Qabra, which is why this demarcation was sometimes given the title of Cora Bayyana. It is at this time that a noble neighborhood (the Almedina ) will be configured , with its aljama mosque whose minaret remains are preserved in the first body of the parish bell tower of Santa María la Mayor.
On August 24, 1240 , 1240 he surrendered by peaceful capitulation to Fernando III the Saint who granted it to his brother Alfonso de León and in June 1320 1320 the so-called Peace of Baena was signed in the town between the General Brotherhood of Andalusia and King Ismail. I from Grenada. An eight-year truce to which the infant Felipe, , the kingdom of Murcia, , and King James II of Aragon also adhered.
At the beginning of the 15th century, it was granted as lordship to the Marshal of Castilla Diego Fernández de Córdoba , although the donation would be rendered null and void due to strong opposition from the neighborhood and would have to be ratified later.
The transition between the Middle Ages and the Modern Age would be marked in Baena by the battle of Martín González or Lucena, in 1483. The determined participation of its people, under the command of the Count of Cabra, allowed the defeat of the Nasrid army and the capture of Boabdil el Chico. The beginning of the end of the kingdom of Granada began and Baena once again wrote his name in the most notable pages of History.