Emperor Louis had assured his position in the ongoing struggle between the rival Habsburg, Wittelsbach and Luxembourg dynasties by defeating his Habsburg rival Frederick the Fair at the 1322 Battle of Mühldorf—a fact that had prompted his former Luxembourg ally King John of Bohemia to explore possibilities to increase his own power base.
He had approached Duke Henry of Carinthia, whom he had driven from the Prague throne in 1310, and in 1327 arranged the engagement of his younger son John Henry, brother of the future Emperor Charles IV, with Henry's heiress Margaret.
Margaret is the only surviving daughter of Duke Henry, also Count of Tyrol and former King of Bohemia, with his second wife Adelaide, a daughter of the Welf duke Henry I of Brunswick.
As her father's three marriages had produced no male heirs, he had reached an agreement with Louis IV in 1330 that had enabled Margaret to succeed him in his Carinthian and Tyrolean estates.
John Henry had been sent to Tyrol and in 1330, upon approval by Emperor Louis, he and Margaret had celebrated their wedding in Innsbruck at the age of eight and twelve.
According to contemporary sources, the children disliked each other from the beginning.
By the marriage, King John had secured access to the Alpine mountain passes to Italy, which in turn had driven the emperor to break the arrangements with Margaret's father.
When Henry of Carinthia died in 1335, Louis had given Carinthia to the Habsburg duke Albert II of Austria, who had raised inheritance claims as the eldest son of King Albert I of Germany and Elisabeth of Gorizia-Tyrol, Margaret's paternal aunt.
Nevertheless, when the Tyrolean lands were claimed by the Wittelsbach dynasty, she cleverly played on her affiliation with the rival Luxembourgs.
They had sent John Henry's capable brother Charles in her support, who, backed by local nobles, at least enforced Margaret's succession as Countess of Tyrol.
The situation had again worsened, when young John Henry turned out to be a haughty, incompetent co-ruler and philanderer disrespected by the Tyrolean aristocracy.
His brother Charles had temporarily acted as a regent; however, his mediation efforts had been rejected and in 1336/37 he left Tyrol to join his father on a Prussian Crusade.
When on the evening of November 1, 1341, John Henry came home from hunting, Margaret had refused her husband admittance to their Tirol Castle residence.
Furious, John Henry had moved around the country, but found no shelter in any noble residence.
He had finally been forced to leave the Tyrolean lands and had been received as a refugee by the Aquileia patriarch Bertram of St. Genesius.
Margaret again plays the dynasties off against each other and escapes the revenge of the deprived Luxembourgs by turning to the House of Wittelsbach: in the presence of Emperor Louis IV, she marries his eldest son, Margrave Louis I of Brandenburg, on February 10, 1342, in Meran.
The fact that she has entered the marriage without being granted a divorce from John Henry, thus contravening canon law, causes a veritable scandal on the European stage and earns the couple excommunication by the new Pope Clement VI.
Margrave Louis succeeds in gaining the support of the Tyrolean nobles and takes it upon himself to declare Margaret's marriage to John Henry null and void.
The scholars William of Ockham and Marsilius of Padua defend this "first civil marriage" of the Middle Ages, claiming that John Henry had never consummated his matrimony.