Maximilian's army is soundly defeated on January 24, 1588, at the Battle of Byczyna by the supporters of Sigismund III (who had since been formally crowned), under the command of Jan Zamojski, Grand Hetman of the Crown since 1581, after a failed attempt to storm Kraków with his magnate supporters in late 1587.
Maximilian is taken captive at the battle and is only released after the intervention of Pope Sixtus V.
The fourth son of the emperor Maximilian II and Maria of Spain, he is a grandson of Anna of Bohemia and Hungary, daughter and heiress of Ladislaus II of Bohemia and Hungary, who himself was the eldest son of Casimir IV of Poland.
He thus descends from the ancient Piast kings of Poland, and from Jogaila and his forefathers, Grand Dukes of Lithuania.
The late Sigismund I the Old, himself a younger son, was Maximilian's great-great-uncle, and Maximilian descends from Sigismund's eldest brother.
Having become the Grand Master of the Teutonic Order in 1585, he will be known by the epithet 'der Deutschmeister' for much of his later life.
Maximilian had stood as a candidate for the throne of Polish-Lithuanian Commonwealth in 1587, following the death of the previous king, Stefan Batory.
A portion of the Polish nobility had elected Maximilian king, but, as a result of the rather chaotic nature of the election process, another candidate, Sigismund III Vasa, prince of Sweden, grandson of Sigismund I the Old, had also been elected.
Maximilian had attempted to resolve the dispute by bringing a military force to Poland—thereby starting the war of the Polish Succession.
His cause has considerable support in Poland, but fewer Poles have flocked to his army than to that of his rival.