His good work, however, was largely undone by his son Maximilian II Emanuel (1679–1726), whose far-reaching ambition set him warring against the Ottoman Empire and, on the side of France, in the great struggle of the Spanish succession. He shared in the defeat at the Battle of Blenheim, near Höchstädt, on 13 August 1704; his dominions were temporarily partitioned between Austria and the elector palatine by the Treaty of Ilbersheim, and only restored to him, harried and exhausted, at the Treaty of Baden in 1714; the first Bavarian peasant insurrection, known as the "Bloody Christmas of Sendling", having been crushed by the Austrian occupiers in 1706.