With the Spanish troops approaching Barcelona, on 17 January 1641 the States-General declared the Catalan Republic under the protection of France, but a week later the Catalan institutions, needing more French military aid, accepted King Louis XIII of France as Count of Barcelona. This allowed the French army to cross the Pyrenees into the Iberian peninsula during the long Franco-Spanish War, defeating together the Spanish army at the battle of Montjuïc, close to Barcelona, on 26 January 1641. The French general Philippe de La Mothe-Houdancourt was appointed viceroy of Catalonia, and the Franco-Catalan forces obtained victories in Montmeló and Lleida. However, the French administration increased its control over the Principality, and the same conflicts between peasants and soldiers (but this time French) erupted.