In the year 1026, three peasant families built the first settlement in the comarca of Segarra, as in those days it was uninhabited. Later on, the Barcelona counts committed ownership of those lands to those people. By this, the counts wanted to establish their power in the area, as the Segarra was at that time the border between Christian and Muslim territories, thereby establishing the first fortress (castrum Cervarie).
When the Western border was established at Lleida at the year 1149, Cervera grew up into terraced houses on the other side of the border. The inhabitants were freed from the feudal lord's abuses and with the royal privileges, the town gradually became established first as a Confraria (1182), then Consolat (municipal organ) (1202), and from 1267 up to the present, as a Paeria.
The most significant episode was the signature, in 1452, of the nuptial agreement between Ferdinand II of Aragon and Isabella I of Castile (the Spanish Catholic Monarchs).
Historically, there was a prosperous Jewish community in Cervera, dating from the 12th century to the expulsion of the Jews in the 15th century.[4]
In 1702, the town got the title of city from the king Philip V, for which the townspeople thanked the king. The king bestowed this title because in a small way during the war, and then more strongly after the war, the local people had demonstrated support for the king's politics.
The university
Charles II, the last Spanish king from the house of Austria, died in 1700, and in his will he designated Philip V as his heir. The new king, with the name of Philip V, was accepted in the kingdom of Castile, as well as in Crown of Aragon.
England, which was at the head of the opposing nations proposed Charles VI as the heir of the Spanish throne and in 1702 a European war started (the War of the Spanish Succession). An appropriate diplomatic intervention could make the Crown of Aragon finally give support to Charles VI. In Cervera, there were people in favour of both sides.
When the war was finished, Cervera, which had been destroyed, decided to give support to the ones who were governing (the Bourbons) and sent two ambassadors to the Courts with the mission to persuade the ministers of Philip V of his absolute support, with the goal to obtain some logical compensation and in one of their 30 requests, they requested one university like the one in the city of Lleida. Philip V, then, built the University of Cervera and closed the rest (the Nueva Planta decrees). The creation of the university gave an economic boost to the town, basically (among other reasons) because students lodged in the town.
Decay and prosperity
In 1842 the University was relocated to Barcelona, which portended an important economic loss.
However, when train service arrived in the town in 1860 along with improvements to some public services (such as the water supply) and as the establishment of some industries and an important wine trade, there was an improvement in the local economy.
When the Phylloxera arrived, this caused a lot of people with vineyards to go bankrupt, due to a major crisis with the Cervera wine trade, which recovered somewhat with the creation of the Sindicat Agrícola (1919).