One of the antecedents that led to the Battle of Bailen was that during the war for Spanish independence in 1808 against the Napoleonic occupation the Government Juntas of Sevilla and Granada began recruiting two armies whose mission would be to cut the paths to the French in Sierra Morena. The recruitment was massive and received a large number of voluntaries, who formed half the Army of Andalusia (some 17,000 men).
On their way to Andalusia general Pierre Dupont's army had a terrible time given the hostile towns that rose up in arms and the bandits that continuously accosted them. They sacked Cordoba on June 8. He then heard that the French fleet in Cadiz had surrendered and that the Spanish were organizing an army to cut the paths he left the city and took refuge in Andujar, were he established his headquarters.
In the meanwhile the Spanish commander Francisco Javier Castaños met the highest Spanish class of commanders in Andalusia to decide what strategy to follow. In the end the decision was that two divisions would attack Andujar and a third one would cross to Guadalquivir and the army of Granada would cross Mengibar, led by commander Teodoro Reding
On the July 13, Reding begins to cross Guadalquivir in Mengibar. The town was defended by 2,000 by the French general Ligier-Belair. On the morning of July 14, the first Spanish squadrons, commanded by general Francisco Xavier Venegas force the French cavalry to flee to the other side of the river. Ligier-Belair decided to evacuate the town at the possibility of further attacks and asks the general of one of the French divisions, Dominique Honoré Antoine Marie Vedel for help.
Reding began the attack on July 15, early in the morning. However Vedel interrupted the operation at midmorning, but later abandoned his position when Pierre Dupont requested reinforcements and left for Andujar.
In the meantime the Spanish course of action was to cross Sierra Morena from the headquarters in Utrera. In many bold manoeuvres general Castaño led his army night and day, ever changing his positions so the French wouldn't be able to guess their intentions, whilst being informed of the French movement thanks to the civilians.
Pierre Dupont, a little uncertain, sent part of his forces to La Carolina, meaning to protect the path to Madrid. He was afraid that if Castaños meant to cut the road they would be confined From Andujar he didn't dare begin a battle and sought to retreat instead, trying to find and join other French troops commanded by Vedel and Dufour that were coming to his aid
We this intention he made for Bailen on June 18, but just as they were reaching the city they met Castaño face to face and the Battle of Bailen began.
The fact that the battle took place at the gates of the city may be a decisive fact in Spain's victory, as the locals did all it could to help the Spanish troops. The most important help came in the way of fresh water supply for the soldiers, welcome relief in the searing heat. However the French forces were badly affected, as their cannons overheated and malfunctioned.
After several episodes of grim and bloody combat in suffocating climatic conditions, general Piere Dupont was defeated before Vedel's forces were able to come to their rescue. Over 17,000 French soldiers laid down their weapons.
The Battle of Bailen was the first great defeat the Napoleonic army sustained, teaching him a Spanish lesson.