In January 1745, the Holy Roman Emperor Charles VII of Bavaria died, taking Bavaria out of the war and allowing Maria Theresa's husband Francis of Lorraine to eventually be elected Emperor of the Holy Roman Empire. Now able to focus solely on Frederick's army, the Austrians, who were reinforced by the Saxons, crossed the mountains to invade Silesia. After allowing them across,Frederick pinned them down and decisively defeated them at the Battle of Hohenfriedberg on 4 June 1745. Frederick subsequently advanced into Bohemia and defeated a counterattack by the Austrians at the Battle of Soor. Frederick then turned towards Dresden when he learned the Saxons were preparing to march on Berlin. However, on 15 December 1745, Prussian forces under the command of Leopold of Anhalt-Dessau soundly defeated the Saxons at the Battle of Kesselsdorf. After linking up his army with Leopold's, Frederick occupied the Saxon capitol of Dresden, forcing the Saxon elector, Augustus III, to capitulate.