War of the Spanish Succession
In
1699 Max. Emanuel's first son
Joseph Ferdinand, appointed heir of the Spanish crown, had died. By the outbreak of the
War of the Spanish Succession in
1701, he had developed a plan for the Wittelsbachs to supplant the Habsburgs as Holy Roman Emperors. Allying himself with the
French against the Habsburgs, his plans were frustrated by the disastrous defeat at the
Battle of Blenheim in
1704. In the ensuing evacuation of his court to the Netherlands, Max. Emanuel's family became separated and his sons were held prisoners for several years in
Austria, Klemens August being brought up by
Jesuits. Bavaria was partitioned between Austria and the
elector palatine, leading to bloody uprisings of the people against the Austrian imperial troops. Max. Emanuel was again forced to flee the Netherlands after the
Battle of Ramillies (23 May 1706) and found refuge at the French court in
Versailles. In 1712
Luxemburg and
Namur were ceded to Max. Emaunel by his French allies.
The war was finally ended in
1713 in the
Treaty of Utrecht which restored Max. Emanuel. Only in 1715 was the family re-united in Munich.