In May 1710, Phillip and the Spanish-Bourbon army under Villadarias crossed the Segre river into Catalonia hoping to capture Balaguer. The first attempt failed due to torrential rain but French reinforcements increased the Spanish army to 20,000 infantry and 6,000 cavalry and in June they tried again. The illness of the Allied commander Starhemberg enabled Philip to capture a number of small towns but after several weeks of marching and counter-marching, on 27 July Stanhope's division crossed the Segres at Alfarràs and combined with Starhemberg's forces on the heights of Almenar.