Battle of Ilerda The Battle of Ilerda took place in June 49 BC between the forces of Julius Caesar and the Spanish army of Pompey the Great , led by his legates Lucius Afranius and Marcus Petreius . Unlike many other of the battles of the civil war , this was more a campaign of maneuvre than actual fighting . Introduction . After having driven the optimates from Italy , in March 49 BC , Caesar turned his attention to the Republican army in the Spanish provinces . On his way to Spain , Caesar was delayed when in April the port city of Massilia rebelled under Lucius Domitius Ahenobarbus . Leaving the siege of Massilia to be conducted by Gaius Trebonius and Decimus Junius Brutus Albinus , Caesar moved on to Hispania Citerior to reinforce the three legions he had sent there as an advance guard under his legate Fabius . The Ilerda Campaign . When he arrived on the Spanish border , Caesar was able to seize the Pyrenees passes from the republicans and march into Spain . Near Ilerda , the Pompeians made camp on a hill and Caesar endeavoured to camp about 400 paces from the foot of the hill . While the Pompeians under Afranius threatened to give battle , Caesar decline , but had his first two lines of troops form up for battle anyway , while the third line was ordered to dig a wide ditch behind the lines , unseen . As night came , Caesar withdrew his army behind the ditch and spent the night under arms . The next day was spent creating the rest of the ditch and the rampart which would form the defences of Caesar ' s camp . For this operation Caesar kept a part of his force on guard . In the midst of the plain there was a portion of rising ground which Caesar wanted to occupy . As he tells it : Between the city of Lerida , and the hill where Petreius and Afranius were encamped was a plain of about three hundred paces , in the midst of which was a rising ground , which Caesar wanted to take possession of ; because , by that means , he could cut off the enemy ' s communication with the town and bridge , and render the magazines they had in the town useless . The contest for this hill led to a protracted battle . The Battle . Both armies sent detachments towards the hill and the Pompeians occupied it first . This , combined with their skirmish - like combat technique overwhelmed the Caesarian detachment , and his troops were forced to give ground , eventually retreating to safety . This minor reverse would result in a renewed attack spurned by Caesar , and this in turn led to a longer engagement . As Caesar tells it ( in the third person , as was his style ) : Caesar , contrary to his expectation , finding the consternation like to spread through the whole army , encouraged his men , and led the ninth legion to their assistance . He soon put a stop to the vigorous and insulting pursuit of the enemy , obliged them to turn their backs , and pushed them to the very walls of Lerida . But the soldiers of the ninth legion , elated with success , and eager to repair the loss we had sustained , followed the runaways with so much heat that they were drawn into a place of disadvantage , and found themselves directly under the hill where the town stood , whence when , they endeavoured to retire , the enemy again facing about , charged vigorously from the higher ground . The hill was rough , and steep on each side , extending only so far in breadth as was sufficient for drawing up three cohorts ; but they could neither be reinforced in flank , nor sustained by the cavalry . The descent from the town was indeed something easier for about four hundred paces , which furnished our men with the means of extricating themselves from the danger into which their rashness had brought them . Here they bravely maintained the fight , though with great disadvantage to themselves , as well on account of the narrowness of the place , as because being posted at the foot of the hill , none of the enemy ' s darts fell in vain . Still however they supported themselves by their courage and patience , and were not disheartened by the many wounds they received . The enemy ' s forces increased every moment , fresh cohorts being sent from the camp through the town , who succeeded in the place of those that were fatigued . Caesar was likewise obliged to detach small parties to maintain the battle , and bring off such as were wounded . The fight had now lasted five hours without intermission , when our men , oppressed by the multitude of the enemy , and having spent all their darts , attacked the mountain sword in hand , and overthrowing such as opposed them , obliged the rest to betake themselves to flight . The pursuit was continued to the very walls of Lerida , and some out of fear took shelter in the town , which gave our men an opportunity of making good their retreat . At the same time the cavalry , though posted disadvantageously in a bottom , found means by their valour to gain the summit of the mountain , and riding between both armies , hindered the enemy from harassing our rear . Thus the engagement was attended with various turns of fortune . Caesar lost about seventy men in the first encounter , among whom was Q . Fulginius , first centurion of the Hastati of the fourteenth legion , who had raised himself by his valour to that rank , through all the inferior orders . Upwards of six hundred were wounded . On Afranius ' s side was slain T . Caecilius , first centurion of a legion ; also four centurions of inferior degree , and above two hundred private men . Aftermath . The spring storms and the melting snow from the mountains then caused flooding , which particularly affected the lower situated Caesarians whose camp was flooded . This meant that the Caesarian troops were unable to forage and famine struck the army , accompanied by disease . When the flood of the river Sicoris finally withdrew , the Caesarians built a bridge over it and caused Petreius and Afranius to abandon their camp and the city of Ilerda and a retreat towards a second republican army under Marcus Terentius Varro was started . Caesar ordered a pursuit which overtook the retreating rear guard of the republican army and he was able to block the route on which the republicans were retreating . The two armies again camped close to each other and confraternization between the two armies started . Petreius , wanting to stop this confraternization , had the Caesarian soldiers who had wandered into the republican camp rounded up and killed . After this the republicans again retreated towards Ilerda , only to become besieged by the Caesarians in their new camp . By July 30 , Caesar had completely surrounded Afranius and Petreius ' s army . On August 2 , the Pompeian 5 legions strong army in Ilerda surrendered to Caesar . After the surrender of the republican main army in Spain , Caesar then marched towards Varro in Hispania Ulterior , who at once without a fight submitted to him and surrendered another two legions . After this Caesar left his legate Quintus Cassius Longinus - the brother of Gaius Cassius Longinus - in command of Spain with four of the legions , partly made up of men who had surrendered and gone over to the Caesarian camp , and returned with the rest of his army to Massilia and its siege .