Caesar arrived in Hispania June 49 BCE, where he was able to seize the Pyrenees passes defended by the Pompeian Lucius Afranius and Marcus Petreius. At Ilerda he defeated a Pompeian army under legates Lucius Afranius and Marcus Petreius. Unlike many of the other battles of the civil war, this was more a campaign of manoeuvre than actual fighting.
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 leading to another two legions surrendering.
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.