The War of the Succession of Landshut resulted from an agreement between the duchies of Bavaria-Munich (Bayern-München in German) and Bavaria-Landshut (Bayern-Landshut). The agreement concerned the law of succession when one of the two Dukes should die without a male heir. Both of these duchies were owned by branches of the House of Wittelsbach, and the agreement stated that if one branch should become extinct in the male line then the other would inherit both duchies. This agreement disregarded imperial law, which stipulated that the Holy Roman Emperor should inherit should a line fail.
George, Duke of Bavaria-Landshut and his wife Hedwig Jagiellon failed to produce a male heir, so George named his daughter Elisabeth as his heir. Because of the agreement, Duke Albert of the Munich line did not accept this, leading to war in 1503. Over the course of this two-year war, many villages surrounding Landshut were reduced to ashes, such as Ergolding.
The war ended in 1505 with the death of Elisabeth and her husband Ruprecht, Count Palatine of the Rhine, and a decision through arbitration by Emperor Maximilian I on 30 July 1505 at the Diet of Cologne. The two grandsons of George, Otto Henry (Otto-Heinrich) and Philip, retained Palatinate-Neuburg (Junge Pfalz), a fragmented region from the upper Danube over Franconia to the northern part of the Upper Palatinate. Neuburg an der Donau was chosen as the capital of the new state. Because the two heirs had not yet reached their majority, Frederick II, Count Palatine of the Rhine, served as regent in a caretaker regime. The rest of the territory went to the Munich line of the House of Wittelsbach. The emperor took the territory around Kufstein for himself as reward for his mediation; the Imperial City of Nuremberg gained important territories to the east of the city, including the authorities of Lauf, Hersbruck, and Altdorf. As Count Palatine, Otto-Heinrich spent huge sums of money to build a palace at Neuburg an der Donau. Through inheritance, he later became Elector Palatine, where his additions Ottheinrichsbau to Heidelberg Castle made him one of the most important builders of the German Renaissance.