In ancient times the city, named Iltrida and Ilerda, was the chief city of the Ilergetes, an Iberian tribe. Indíbil, king of the Ilergetes, and Mandoni, king of the Ausetanes, defended it against the Carthaginian and Roman invasions.
Under the Romans, the city was incorporated into the Roman province of Hispania Tarraconensis, and was a place of considerable importance, historically as well as geographically. It stood upon an eminence, on the right (west) bank of the river Sicoris (the modern Segre), the principal tributary of the Ebre, and some distance above its confluence with the Cinga (modern Cinca); thus commanding the country between those rivers, as well as the great road from Tarraco (modern Tarragona), the provincial capital, to the northwest of Spain, which here crossed the Sicoris.
Its situation induced the legates of Pompey in Spain to make it the key of their defense against Caesar, in the first year of the Civil War (49 BC). Afranius and Marcus Petreius threw themselves into the place with five legions; and their siege by Caesar himself (Battle of Ilerda), as narrated in his own words, forms one of the most interesting passages of military history. The resources exhibited by the great general, in a contest where the formation of the district and the very elements of nature seemed in league with his enemies, have been frequently extolled; but no epitome can do justice to the campaign. It ended by the capitulation of Afranius and Petreius, who were conquered as much by Caesar's generosity as by his strategy. In consequence of the battle, the Latin phrase Ilerdam videas is said to have been used by people who wanted to cast bad luck on someone else.
Under the Roman empire, Ilerda was a very flourishing city, and a municipium. It minted its own coins. It had a fine stone bridge over the Sicoris, (the bridge was so sturdy that its foundations support a bridge to this day). In the time of Ausonius the city had fallen into decay; but it rose again into importance in the Middle Ages.
It was part of Visigothic and Muslim Hispania until it was conquered from the Moors by Count Ramon Berenguer IV of Barcelona in 1149.
It used to be the seat of a major university, the oldest in the Crown of Aragon, until 1717, when it was moved by Philip V to the nearby town of Cervera. The University of Lleida is nowadays active again since 1991.
During the Reapers' War, Lleida was occupied by the French and rebel forces. In 1644 the city was conquered by the Spanish under D. Felipe da Silva.
Lleida served as a key defense point for Barcelona during the Spanish Civil War, and fell to the Insurgents, whose air forces bombed it extensively, in 1937 and 1938. The November 2, 1937 Legion Condor attacks against Lleida became especially infamous since they were aimed to the school known as Liceu Escolar de Lleida. 48 children and several teachers died in it that day, 300 people were killed on the November 2 bombings altogether, and the town would be bombed and sieged again in 1938, when it was conquered by Franco's forces.
After some decades without any kind of population growth, it met a massive migration of Andalusians who helped the town undergo a relative demographic growth. Nowadays it is home to immigrants of 146 different nationalities.
During 2007 Lleida was the year's Capital of Catalan Culture.