Maximilian refrained from any interference in German politics until 1607, when he was entrusted with the duty of
executing the
imperial ban against the free city of
Donauwörth, a
Protestant stronghold. In December 1607 his troops occupied the city, and vigorous steps were taken to restore the supremacy of
Catholicism. Some Protestant princes, alarmed at this action, formed the
Protestant Union to defend their interests, which was answered in 1609 by the establishment of the
Catholic League, in the formation of which Maximilian took an important part. Under his leadership an army was set on foot, but his policy was strictly defensive and he refused to allow the League to become a tool in the hands of the
House of Habsburg. Dissensions among his colleagues led the duke to resign his office in 1616, but the approach of trouble brought about his return to the League about two years later. Having refused to become a candidate for the
imperial throne in the
1619 imperial election, Maximilian was faced with the complications arising from the
Bohemian Revolt. After some delay he made a treaty with
Ferdinand II, Holy Roman Emperor in October 1619, and in return for large concessions placed the forces of the League at the emperor's service. Anxious to curtail the area of the struggle, he made a treaty of neutrality with the Protestant Union, and occupied
Upper Austria as security for the expenses of the campaign. On 8 November 1620 his troops under
Johann Tserclaes, Count of Tilly defeated the forces of
Frederick, King of Bohemia and
Count Palatine of the Rhine, at the
Battle of White Mountain near
Prague. Subsequently Ferdinand II released Upper Austria as a pawn for Maximilian until 1628. In spite of the arrangement with the Union, Tilly then devastated the
Rhenish Palatinate, and in February 1623 Maximilian was formally invested with the
electoral dignity and the attendant office of Arch-Steward, which had been enjoyed since 1356 by the Counts Palatine of the Rhine. After receiving the
Upper Palatinate and restoring Upper Austria to Ferdinand, Maximilian became leader of the party which sought to bring about
Albrecht von Wallenstein's dismissal from the imperial service. At the
Diet of Regensburg (1630) Ferdinand was compelled to assent to this demand, but the sequel was disastrous both for Bavaria and its ruler. Attempting to remain neutral during the war, Maximilian signed the secret
Treaty of Fontainebleau (1631) with the
Kingdom of France, but this proved worthless. Early in 1632
Gustavus Adolphus of Sweden marched into the electorate and occupied Munich, and Maximilian could only obtain the assistance of the Imperial troops by placing himself under the orders of Wallenstein, now restored to the command of the emperor's forces. The ravages of the Swedes and their French allies induced the elector to enter into negotiations for peace with the Swedes and
Cardinal Richelieu of France. He also wooed the Protestants by proposing modifications to the
Edict of Restitution of 1629, but these efforts were abortive. In September 1638 Baron
Franz von Mercy was made master-general of ordnance in the army of Bavaria, then the second largest army in the Holy Roman Empire. Mercy and
Johann von Werth as lieutenant field-marshal fought with varying success France and Sweden. In March 1647 Maximilian concluded the
Truce of Ulm (1647) with France and Sweden, but the entreaties of
Ferdinand III, Holy Roman Emperor led him to disregard his undertaking. Bavaria was again ravaged, and the elector's forces were defeated in May 1648 at the
Battle of Zusmarshausen. The
Peace of Westphalia soon put an end to the struggle. By this treaty it was agreed that Maximilian would retain the electoral dignity, which was made hereditary in his family along with the Upper Palatinate. Maximilian had to give up the Lower Palatinate, which was restored to
Charles Louis, Frederick V's son and heir. ==Administrative and cultural activities==