Following the conquest of the city of Zaragoza in 1118,
Alfonso the Battler, King of
Aragón and
Pamplona continued his campaign to take control of the
Ebro River valley. Between the city of Zaragoza and the Christian
County of Barcelona on the Mediterranean Sea, the territory stood as an open frontier held by the Almoravids. In that territory, the fortified city of Lleida remained under the control of the Muslims and separated the two Christian principalities. Both Alfonso and Berenguer desired to eventually take control of the city of Lleida and to add it to their respective domains. After the fall of the city of Zaragoza, the Muslim governor of Lleida at that time, Abu Hilal, felt threatened by Alfonso and sought the protection of Berenguer by means of an alliance. In 1120, Abu Hilal and Berenguer entered into a pact whereby Berenguer agreed that he would defend Lleida against attack by Alfonso. In 1123, Alfonso attacked Lleida. The siege ended in failure due to Berenguer 's intervention. Three years later, however, Berenguer was ready to implement his own plan to attack and capture Lleida. The agreement that Berenguer had with the Almoravids was simply a tactic to keep the city from Alfonso and to delay his own invasion of the territory until he was strong enough to capture the city by himself. After 1123, Berenguer’s desire to initiate a campaign of his own against Lleida was boosted by two developments. Relative to military alliances, Berenguer and Ponç II, the Count of Empúries, implemented an agreement stipulating that Ponç II would assist the Catalans in the defense and/or conquest of frontier territories. Relative to resources, Berenguer gained the full support of the Catholic Church by means of Pope Callixtus II’s
Papal bull granting indulgences for those fighting to restore the churches in Iberia. This elevated the conflict with the Muslims from a territorial dispute to a holy war. With these developments, Berenguer began to build an enhanced military force by ordering nobles and landowners with rights to ecclesiastic
tithes to participate in the crusade. In the opinion of the Almoravids, this action was threatening and broke the pact that they had in place with Berenguer. This division between the Almoravids and Berenguer quickly led to direct conflict. ==The battle==