The Franco-Spanish War (1635–1659) was a military conflict that was the result of French involvement in the Thirty Years' War. After the German allies of Sweden were forced to seek terms with the Holy Roman Empire, the first French minister, Cardinal Richelieu, declared war on Spain because French territory was surrounded by Habsburg territories. The conflict was a continuation of the aims of the War of the Mantuan Succession (1628–31) in which France invaded northern Italy to take possession of territory claimed by the Spanish Habsburgs. The Franco-Spanish War ended in 1659 with the Treaty of the Pyrenees.
For years, the Kingdom of France, under the Valois and Bourbon dynasties, had been the rival of the House of Habsburg, whose two branches ruled the Holy Roman Empire and Spain, respectively. For much of the 16th and 17th centuries, France faced Habsburg territory on three sides; the Spanish Netherlands to the north, the Franche-Comté on its eastern border, and Spain to the south. The Habsburgs thus stood in the way of French territorial expansion, and France faced the possibility of invasion from multiple sides. France therefore sought to weaken Habsburg control over its possessions.
During the Thirty Years' War, in which various Protestant forces battled Imperial armies, France provided subsidies to the enemies of the Habsburg Empire. France generously supported a Swedish invasion of the Empire after 1630. After a period of extraordinary success, the Swedish-led forces were decisively defeated in 1634 by a combined Imperial-Spanish army in the Battle of Nördlingen, leading many of Sweden's allies to defect to the Imperial side. Although Sweden itself continued to fight, it was seriously weakened.