After the Dos de Mayo Uprising and the subsequent disaster at the Battle of Bailén, the French occupying armies in Spain were forced to pull back behind the Ebro River in the northeast. Shocked and enraged at the turn of events, Napoleon ordered 130,000 veteran soldiers to march into Spain. The French emperor planned to unite the reinforcements with the troops already there and lead them to conquer Spain and Portugal once and for all. Meanwhile, the Spanish people had been deceived by their relatively easy successes and believed that the struggle was almost over. The Spanish generals and politicians began to squabble among themselves. By 10 October 1808, Napoleon had 244,125 soldiers massed in eight army corps, the cavalry reserve, the Imperial Guard, and other formations for the purpose of conquering Spain. In November 1808, the Napoleonic armies struck with crushing force and the Spanish defenses unraveled in battles at Burgos, Espinosa, Tudela, and Somosierra. On 1 December, Madrid meekly capitulated to Napoleon. The French emperor reinstalled his brother Joseph Bonaparte as king and began rewriting the laws. He intended to send armies to seize Seville in the south and reconquer Portugal at the first opportunity. However, a new enemy appeared on the scene to upset Napoleon's plans.