On September 18, 1322, at the Battle of Mühldorf, Louis decisively defeated Frederick and took him captive to be imprisoned at Trausnitz Castle. This did not end the resistance of Frederick's brother Leopold I, Duke of Austria, who ruled Austria and Styria in his absence, or earn the support of the pope, Pope John XXII, for his claim. In fact, John excommunicated Louis in 1324.