Louis the Bavarian defeats his cousin Frederick I of Austria at the Battle of Gammelsdorf.

The Battle of Gammelsdorf (German: Schlacht von Gammelsdorf) took place in November 1313. The cause of the skirmish was the guardianship of the underage duke of Lower Bavaria. This was sought by both Duke Louis the Bavarian and Duke Frederick I of Austria. It circled around the question of who would execute tutelage over the minor children of the late Lower Bavarian Dukes, thus also commanding the tremendous economic power of that region. Their Upper Bavarian cousin, Duke Louis, the later Emperor Louis IV, the Bavarian, as agreements within the several branches of the Bavarian line of the House of Wittelsbach determined and as the burghers of the Lower Bavarian cities wanted to see it done, or Duke Frederick I of Austria, the Fair, also Louis' cousin, both having been raised and educated together in Vienna.

After Louis had militarily occupied the then two most important towns of Bavaria, Landshut and Straubing, the ducal widows decided to call their children's Austrian cousin for assistance - though in the decade before, Lower Bavaria had bitterly fought Austria over lands, economic resources, and sovereignty.

The Upper Bavarians and troops deputized by the Lower Bavarian towns were led by Duke Louis. While the probably numerically superior nobility or aristocracy and knighthood of Lower Bavaria and the Austrians were led by Duke Frederic.

Finally - though more of a skirmish than a battle - the decisive engagement for control over those fertile, economically attractive lands was fought at Gammelsdorf on 9 November 1313 between Bavaria and Austria.

The weather worked to Louis' advantage. A thick fog covered the battlefield, so that Louis's actual strength was hidden from Frederick. Louis' city militias fought on foot, though others were mounted.At the end of the day, Louis' smaller force was victorious. Nonetheless, he did not pursue and destroy Frederick's defeated fighters, and no names of the fallen nobles were recorded.Frederick was forced to renounce his tutelage over the Lower Bavarian dukes, and maybe even more important for the man from Munich, he had put a halt on Habsburg desires for annexation of parts of Bavaria for a long time.

A monument stands in memory of the battle near the battlefield.

Louis IV (German: Ludwig; 1 April 1282 – 11 October 1347), called the Bavarian, of the house of Wittelsbach, was King of the Romans from 1314, King of Italy from 1327, and Holy Roman Emperor from 1328.

Louis' election as king of Germany in 1314 was controversial, as his Habsburg cousin Frederick the Fair was simultaneously elected king by a separate set of electors. Louis defeated Frederick in the Battle of Mühldorf in 1322, and the two eventually reconciled. Louis was opposed and excommunicated by the French Pope John XXII; Louis in turn attempted to depose the pope and install an anti-pope.

Louis IV was Duke of Upper Bavaria from 1294 to 1301 together with his elder brother Rudolf I, was Margrave of Brandenburg until 1323, and Count Palatine of the Rhine until 1329, and became Duke of Lower Bavaria in 1340. He became Count of Hainaut, Holland, Zeeland, and Friesland in 1345 when his wife Margaret inherited those domains.