Election as German King and conflict with Frederick the Fair
The death of Holy Roman Emperor Henry VII in August 1313 led to a 14-month long election period between the seven prince-Electors. Henry's son John, King of Bohemia since 1310, was initially supported by the Bohemians alongside their allies Archbishop Peter of Aspelt of Mainz and Archbishop Baldwin of Luxembourg of Trier. Philip IV of France, who had already had relatives on the thrones of Hungary and Naples, wanted to ensure the election of his son Philip as Holy Roman Emperor after failing the previous election. With Philip being entirely unsupported by the Imperial princes yet again, John's position was initially strong.
However, believing John of Bohemia to be too young and the Luxembourg dynasty too powerful, the Habsburgs pushed forth with the only realistic resistance to the pro-Luxembourg faction. As the son of Emperor Henry's predecessor, Albert I, Frederick the Fair began gathering support for his cause. This intimidated the pro-Luxembourg faction, causing the Archbishops of Mainz and Trier to convince John to step down and settle on Louis as a compromise candidate for Emperor in order to prevent their Habsburg rivals from attaining the Imperial throne.
On 19 October 1314, Archbishop Henry II of Cologne chaired an assembly of four electors at Sachsenhausen, south of Frankfurt. Participants were Louis' brother, Rudolph I of the Palatinate, who objected to the election of his younger brother, Duke Rudolph I of Saxe-Wittenberg, and Henry of Carinthia, whom the Luxembourgs had deposed as King of Bohemia. These four electors chose Frederick as King.
The Luxembourg party did not accept this election and the next day a second election was held. Upon the instigation of Peter of Aspelt, Archbishop of Mainz, five different electors convened at Frankfurt and elected Louis as King. These electors were Archbishop Peter himself, Archbishop Baldwin of Trier and King John of Bohemia – both of the House of Luxembourg – Margrave Waldemar of Brandenburg and Duke John II of Saxe-Lauenburg, who contested Rudolph of Wittenberg's claim to the electoral vote.
This double election was quickly followed by two coronations on the 25th of November: Louis was crowned at Aachen – the customary site of coronations – by Archbishop Peter of Mainz, while the Archbishop of Cologne, who by custom had the right to crown the new king, crowned Frederick at Bonn. Ludwig did not have the authentic Imperial Regalia, and so needed to have replicas created in an attempt to legitimise his coronation. Chroniclers on both sides attempted to portray their rival's coronation as illegitimate. For example, in the anti-Habsburg Chronica Ludovici, Frederick is depicted as being raised on a barrel on his coronation, before falling inside it. In the following conflict between the kings, Louis recognized in 1316 the independence of Switzerland from the Habsburg dynasty.
The fraught political situation was ripe for papal intervention. Pope Clement V died on the 20th of April 1314, half a year before the kings were elected. The throne of St. Peter would remain empty for two more years. Without a religious authority to adjudicate, both sides instead came to believe that God favoured whichever side won on the battlefield. However, despite this belief, the kings were reluctant to actually take to combat between 1314 and 1322. Frederick the Fair's defeat at the Battle of Morgarten gave him further cause for restraint in the struggle for the throne. Regardless of this apprehension, minor skirmishes took place between the two sides in this period: Speyer and Buchloe in 1315, Esslingen in 1316, Mühldorf in 1319, and Strasbourg in 1320. No major battle had yet taken place, however. The next few years, however, were unfortunate for Louis. Neither side was able to take advantage of the death of Waldemar, Margrave of Brandenburg-Stendal, and after the death of the Archbishop of Mainz, Pope John XXII appointed Matthias von Bucheck, a follower of the Habsburgs, as his successor. Previously, the Papacy had not taken sides in the conflict - but in 1316, Pope John officially expressed his opposition to Louis IV. Supported by both the Pope his brother Leopold, Frederick's victory seemed within grasp.
A few weeks before the deciding battle of the war, Louis's first wife Beatrix died on August 1322. Three of his six children from this marriage had reached adulthood: Matilda, Louis, and Stephen. On the 28th of September 1322, Frederick's army was decisively defeated in the Battle of Mühldorf at Ampfing Heath, where Frederick and 1300 nobles from Austria and Salzburg were captured. Louis's ally Frederick contributed greatly to the victory, and it is also believed that the Fürstenfeld Abbey played a vital role in secretly sending messages to Louis's army. As a result of the abbey's aid, it was granted special privileges by Louis out of gratitude.
Louis held Frederick captive in Trausnitz Castle (Schwandorf) for three years, but his reign was far from secured. After using the title King of the Romans without Papal approval, as well as granting offices and estates in Northern Italy without consulting the Papal States, which angered the Pope. He warned Louis that he had three months to addicate and revoke all his decrees, and upon failing to do son, Pope John XXII decided to excommunicate Louis. Louis reacted by making three appeals: The Nuremberg Appeal in 1323, the Frankfurt Appeal in January 1324, and the Sachsenhausen Appeal in May 1324. He insisted that the Electors had chosen him as Emperor, making his rule righteous. However, these pleas were not paid any heed by the Pope. Instead, he ordered Louis to give up his kingship, and threatened to excommunicate his followers, take away his imperial fiefs, and even his original Duchy of Bavaria if he did not comply. Frederick's brother, Leopold, sought to take advantage of the situation, and began to organise his banner as the honorable resistance to Frederick's rule.
In light of the recent retreat of John of Bohemia from the alliance, as well as the Papal excommunication and resistance from the Habsburgs, Louis attempted to come to a compromise. On the 13th of March 1325, Louis freed the imprisoned Frederick, and in a secret agreement, made Frederick renounce the crown and any Habsburg imperial fiefs. Furthermore, he had to accept that Louis was the legal custodian of the young Wittelsbach brothers. After Frederick accepted these terms, he was freed from captivity. Frederick did not have to pay a ransom, although he was forced to part with all of his Imperial possessions. The Peace of Trausnitz between Louis and Frederick was made with both signature and verbal agreement, and was made formally at Easter. The two heard Mass and received communion together. The value of oaths was very high in the Medieval period, and thus Frederick made a great concerted effort to genuinely reconcile with Louis. Part of this reconciliation involved a promise that he would voluntarily return to prison if he did not convince his brothers to submit to Louis.
He also agreed to oppose the Pope for excommunicating Louis, and arranged a marriage between Louis's son Stephen and Frederick's daughter Elizabeth.