linguistic:voice_change, stylistic:tone, quality:correction
Phase II: French intervention, 1635 to 1648

Swedish defeat at Nördlingen triggered direct French intervention and thus expanded the conflict rather than ending it. Richelieu provided the Swedes with new subsidies, hired mercenaries led by Bernard of Saxe-Weimar for an offensive in the Rhineland, and in May 1635 declared war on Spain, starting the 1635 to 1659 Franco-Spanish War. A few days later, the German states and Ferdinand agreed to the Peace of Prague; in return for withdrawing the Edict of Restitution, the Heilbronn and Catholic Leagues were dissolved and replaced by a single Imperial army, although Saxony and Bavaria retained control of their own forces. This is generally seen as the point when the war ceased to be a primarily inter-German religious conflict.

In March 1635, French soldiers entered the Valtellina, cutting the link between Spanish controlled Milan and the Empire. In May, their main army of 35,000 invaded the Spanish Netherlands, but withdrew in July after suffering 17,000 casualties. In March 1636, France joined the Thirty Years War as an ally of Sweden, whose loss of most of the territories gained by Gustavus and their taxes made it increasingly reliant on French financing. The Spanish then invaded Northern France, causing panic in Paris before lack of supplies forced them to retreat. A Swedish army under Johan Banér defeated the Imperials at Wittstock on 4 October, and re-established their predominance in North-East Germany, despite the defection of most of their German allies.

Ferdinand II died in February 1637, and was succeeded by his son Ferdinand III, who faced a deteriorating military position. Although Matthias Gallas and the main Imperial army had forced Banér back to the Baltic, in March 1638, Bernard destroyed an Imperial army at Rheinfelden. His capture of Breisach in December secured French control of Alsace and severed the Spanish Road, forcing Gallas to divert resources there. Although von Hatzfeldt defeated a combined Swedish-German force at Vlotho in October, lack of supplies forced Gallas to withdraw from the Baltic.

In April 1639, Banér defeated the Saxons at Chemnitz, then entered Bohemia in May. To retrieve the situation, Ferdinand diverted Piccolomini 's army from Thionville, ending direct military cooperation between Austria and Spain. Pressure grew on Olivares to make peace, especially after French and Swedish gains in Germany cut the Spanish Road, forcing Madrid to resupply their armies in Flanders by sea. However, their attempts to re-assert maritime control ended when the Dutch fleet under Maarten Tromp won a significant victory at the Downs in October 1639.

Spanish inability to adequately supply their troops allowed the French to over-run Artois in 1640. At the same time, continuing Dutch attacks on Portuguese colonies and opposition to heavy taxes led to revolts in both Portugal and Catalonia. Olivares now argued Spain should accept Dutch independence, and focus on preventing further French gains in the Spanish Netherlands. This appeared achievable since most of the Dutch regenten believed the war was won, the only question being the price of peace. They therefore reduced the army budget for 1640, despite objections from Frederick Henry.

After Bernard died in July 1639, his troops joined Banér's Swedish army on an ineffectual campaign along the Weser, the highlight being a surprise attack in January 1641 on the Imperial Diet in Regensburg. Forced to retreat, Banér reached Halberstadt in May where he died, and despite beating off an Imperial force at Wolfenbüttel in June, his largely German troops mutinied due to lack of pay. The situation was saved by the arrival of Lennart Torstensson in November with 7,000 Swedish recruits and enough cash to satisfy the mutineers.

French victory at Kempen in January 1642 was followed by Second Breitenfeld in October 1642, where Torstensson inflicted almost 10,000 casualties on an Imperial army led by Archduke Leopold Wilhelm of Austria. The capture of Leipzig in December gave the Swedes a significant new base in Germany, and despite their failure to take Freiberg, by 1643 the Saxon army had been reduced to a few isolated garrisons. While Ferdinand accepted a military solution was no longer possible, by fighting on he hoped to prevent the Imperial Estates joining his peace negotiations with France and Sweden, thus preserving his authority by allowing him to represent the Empire as a whole.

This seemed more likely when Richelieu died in December 1642, followed by Louis XIII in May 1643, leaving his five-year-old son Louis XIV as king. However, Richelieu's policies were continued by his successor Cardinal Mazarin, while gains in Alsace allowed France to focus on the war against Spain. In 1643, the Army of Flanders invaded Northern France hoping to relieve pressure elsewhere, but were decisively beaten by Condé at Rocroi on 19 May. Defeat ended any prospect of re-opening the Spanish Road, and Madrid finally accepted the war against the Dutch could not be won.

However, Condé was unable to fully exploit his victory due to factors affecting all combatants. The devastation inflicted by 25 years of warfare meant armies spent more time foraging than fighting, forcing them to become smaller and more mobile, with a much greater emphasis on cavalry. Difficulties in gathering provisions meant campaigns started later, and restricted them to areas that could be easily supplied, usually close to rivers. In addition, the French had to rebuild their army in Germany after it was shattered by an Imperial-Bavarian force led by Franz von Mercy at Tuttlingen in November.

Soon after Rocroi, Ferdinand invited Sweden and France to attend peace talks in the Westphalian towns of Münster and Osnabrück, but negotiations were delayed when Christian of Denmark blockaded Hamburg and increased toll payments in the Baltic. This severely impacted the Dutch and Swedish economies, and in December 1643 the Torstensson War began when the Swedes invaded Jutland with Dutch naval support. Ferdinand pulled together an Imperial army under Gallas to attack the Swedes from the rear, which proved a disastrous decision. Leaving Wrangel to finish the war in Denmark, in May 1644 Torstensson marched into the Empire; Gallas was unable to stop him, while the Danes sued for peace after their defeat at Fehmarn in October 1644.

In August 1644, the French and Bavarian armies met in the three day Battle of Freiburg, in which both sides suffered heavy casualties. Convinced the war could no longer be won, Maximilian now put pressure on Ferdinand to end the conflict. Shortly after peace talks restarted in November, Gallas' Imperial army disintegrated and the remnants retreated into Bohemia, where they were scattered by Torstensson at Jankau in March 1645. In May, a Bavarian force under von Mercy destroyed a French detachment at Herbsthausen, before he was defeated and killed at Second Nördlingen in August. Deprived of Imperial support, John George of Saxony signed a six-month truce with Sweden in September, and in the March 1646 Treaty of Eulenberg agreed to remain neutral until the end of the war.

Under Turenne, French commander in the Rhineland, and Wrangel, who had replaced Torstensson, the French and Swedes separately invaded Bavaria in the summer of 1646. Maximilian was soon desperate to end the war he was largely responsible for starting, at which point the Spanish publicised a secret offer by Mazarin to exchange French-occupied Catalonia for the Spanish Netherlands. Angered by this duplicity, the Dutch agreed a truce with Spain in January 1647 and began to negotiate their own peace terms. Having failed to acquire the Netherlands through diplomacy, Mazarin decided to do so by force. To free up resources for the attempt, on 14 March 1647 he signed the Truce of Ulm with Bavaria, Cologne and Sweden.

The planned offensive fell apart when Turenne's mostly German troops mutinied, while Bavarian general Johann von Werth refused to comply with the truce. Although the mutinies were quickly suppressed, Maximilian felt obliged to follow Werth's example and in September ordered Bronckhorst-Gronsfeld to combine the remnants of the Bavarian army with Imperial troops under von Holzappel. Outnumbered by a Franco-Swedish army led by Wrangel and Turenne, they were defeated at Zusmarshausen in May 1648 and von Holzappel was killed. Although the bulk of the Imperial army escaped thanks to an effective rearguard action by Raimondo Montecuccoli, Bavaria was left defenceless once again.

The Swedes sent a second force under von Königsmarck to attack Prague, seizing the castle and Malá Strana district in July. The main objective was to gain as much loot as possible before the war ended; they failed to take the Old Town but captured the Imperial library, along with treasures including the Codex Gigas, now in Stockholm. When a Spanish offensive in Flanders ended with defeat at Lens in August 1648, Ferdinand finally agreed terms and on 24 October, he signed peace treaties with France and Sweden, ending the war.