The conflict began when the city of Danzig, along with the Polish episcopate and a portion of the Polish szlachta, did not recognize the election of Bathory to the Commonwealth throne and instead supported the candidature of Emperor Maximilian. This led to a short conflict, of which the siege of Danzig was the last part.
After a siege of six months, the Danzig army of 5,000 mercenaries, among them a Scottish regiment, was utterly defeated in a field battle on 16 December 1577. However, since Báthory's armies, Commonwealth plus Hungarian and Wallachian forces, were unable to take the city itself, a compromise was reached: Báthory confirmed the city's special status and her Danzig law privileges granted by the earlier Polish kings. The siege was lifted in return for reparations and recognition of him as sovereign. The city recognised him as ruler of the Commonwealth and paid a large sum of 200,000 złotys.
^The regiment of six companies numbering about 700 men was hired by Danzig in 1577-8 and won great fame in the city's rebellion against Poland. – Richard Brzezinski: Polish Armies 1569–1696 (2), Osprey Publishing