The municipality of Bailén (18,798 inhabitants in 2008; 11,760 ha; municipal website) is located 40 km north of Jaén.

The oldest known name of Bailén is Baritto, a name of Turdetani (Iberian) origin seemingly reused by the Phoenicians. Known by the Greeks as Balkol or Besur, the town got the Roman names of Baecula Caecilia / Baecula Betica. These early colonists were mostly interested in the local resources in lead, gold, silver and copper. In 237 BC, the Carthaginian general Hamilcar Barca invaded the south of Spain; in 209, during the Second Punic war, Scipio Africanus defeated Hasdrubal Barca, Hannibal's brother, in the Battle of Baecula. This event confirmed the strategic skills of Scipio, as reported by Polybius and Livy; it was the start of the Carthaginian decline and of the Roman colonization of Hispania, with the set up of the colony of Italica. Baecula was subsequently involved in the Roman Civil Wars. In 80 BC, Consul Metelius, Governor of Hispania Baetica, defeated there the Herculeius brothers, who supported Sertorius. Julius Caesar spent in the town the night preceding the Battle of Munda (45 BC), during which he defeated Pompey's sons.
Little is known for sure of Bailén, then a small village, during the Middle Ages. There is a reference to a mosque built in 860-880 by Abd al-Rahman I on the remains of a Visigothic monastery, itself founded in 691 by Abbot Locuber. The only available written reference states that King Alfonso VII granted in 1155 the castles of Baños, Segral and Bailén to his vassal Abdelaziz. Owned since 1227 by the Kings of Castile, the villa of Bailén was ruled by the parishes of Baeza, until purchased from King Alfonso XI in 1349, together with its castle, by Pedro Ponce de León, lord of Marchena. His descendants progressively increased their power until eventually created Counts of Arcos by King Juan II in 1440.

The Battle of Bailén opposed on 19 July 1808 Napoléon's troops commanded by General Dupont to the Spanish troops commanded by General Castaños. The French defeat was the first experienced by Napoléon's army on a battlefield. The myth of the invincible Grande Armée broke down and the winners proclaimed themsleves "winners of the Austerlitz winners". Castaños (1758-1851) was subsequently made Duke of BBailén and Grandee of Spain. The Argentine General José de San Martin (1778-1850) fought in the battle as a captain of the Bourbon Regiment (but was, later, one of the libertadores of the South American countries from Spanish colonial rule). On 30 June 1809, the title of "Muy noble y leal" (Very Noble and Loyal) was awarded to the town, whose rank was upgraded to ciudad by Royal Decree on 11 December 1850.

The flag and arms of Bailén, adopted on 14 June 2004 by the Municipal Council and submitted on 18 June 2004 to the Directorate General of the Local Administration, are prescribed by a Decree adopted on 28 September 2004 by the Directorate General of the Local Administration and published on 25 October 2004 in the official gazette of Andalusia, No. 208, p. 24,150 (text).
The symbols, "of traditional design following the use and customs", are described as follows:

Flag: Rectangular flag, with usual proportions of the length 3/2 the hoist, with seven vertical stripes: four gold and three silver, of equal size, in turn gold and argent, with golden stripes at hoist and fly; charged with the crowned coat of arms of the town, the geometric axis of the shield matching the center of the flag, with a height of 2/5 the flag's hoist, the shield represented on both sides of the flag.Coat of arms: Per pale, 1. Gules a jug proper placed per pale, with a window showing water kept inside and the mouth looking to the chief of the shield, 2. Or two swords proper crossed, tied by a ribbon gules forming a scroll from which hangs an eagle sable tied by the claws, the whole surmounted by a laurel wreath vert and surrounded by a scroll wavy argent inscribed with "Bailén, 19 de julio de 1808" [Bailén, 18 July 1808]. Shield in French shape and surmounted by a mural crown proper to the town.

The memoir supporting the proposed flag of Bailén was redacted by the town's official chronicler, Juan Soriano Izquierdo. Since nothing could be found on an historical flag of Bailén, a working group presided by the Mayor proposed the modern flag. The selection of the colours is explained as follows:

Or represents the sun, fire, the month of July and the lion. Its proper heraldic characteristics are nobleness, constancy, magnanimity, wealth, power, light and wisdom. Per the laws of heraldry, those bearing or on their arms and flags should give their goods to the poor and defend their principles up to their last drop of blood. Argent represents the moon, water, the months of January and February, and the hermine. Its proper heraldic characteristics are purity, integrity, obedience, firmness, vigilance, eloquence and victory. Per the laws of heraldry, those bearing or on their arms and flags should defend the virgins and protect the orphans.

Or, therefore, recalls the Battle of Bailén, which took place in July under the fiercy Andalusian sun, showed the victory of the Spanish lion on the French eagle and examplified the nobleness, magnanimity and constancy of the inhabitants of the town. Argent, therefore, recalls the contribution of the women, children and elders of Bailén, who brought water to the battlefield. The first quarter of the coat of arms also recalls this event. The flag was hoisted for the first time on 17 July 1985 for the celebration of the battle.

The coat of arms recalls the Battle of Bailén. The eagle hanging upside down is a straightforward allegory of Napoléon's defeat. The jug represents the local heroin, María Bellido; the legend says that the women of Bailén brought water jugs on the battlefield, where the temperature reached 45 °C. The jug offerred by María to General Reding was hit by a bullet; not scared, María picked up the broken piece of the jug, which still contained a few water, and quenched Reding's thurst.