as Grand Duke of Lithuania. With Lithuania secure, the other major region refusing to recognize his election was Prussia. Maximilian's sudden death improved Báthory's situation, but the city of Danzig (Gdańsk) still refused to recognize his election without significant concessions. The Hanseatic League city, bolstered by its immense wealth, fortifications, and the secret support of Maximilian, had supported the Emperor's election and decided not to recognize Báthory as legitimate ruler. The resulting conflict was known as the Danzig rebellion. Most armed opposition collapsed when the prolonged Siege of Danzig by Báthory's forces was lifted as an agreement was reached. The Danzig army was utterly defeated in a field battle on 17 April 1577. However, since Báthory's armies were unable to take the city by force, a compromise was reached. In exchange for some of Danzig's demands being favorably reviewed, the city recognised Báthory as ruler of Poland and paid the sum of 200,000 zlotys in gold as compensation. Tying up the administration of the Commonwealth's northern provinces, in February 1578 he acknowledged George Frederick as the ruler of Duchy of Prussia, receiving his feudal tribute. Policies After securing control over the Commonwealth, Báthory had a chance to devote himself to strengthening his authority, in which he was supported by his chancellor Jan Zamoyski, who would soon become one of the king's most trusted advisers. Báthory reorganised the judiciary by formation of legal tribunals (the Crown Tribunal in 1578 and the Lithuanian Tribunal in 1581). While this somewhat weakened the royal position, it was of little concern to Báthory, as the loss of power was not significant in the short term, and he was more concerned with the hereditary Hungarian throne. In exchange, the Sejm allowed him to raise taxes and push a number of reforms strengthening the military, including the establishment of the piechota wybraniecka, an infantry formation composed of peasants. Many of his projects aimed to modernize the Commonwealth army, reforming it in a model of Hungarian troops of Transylvania. He also founded the Academy of Vilnius, the third university in the Commonwealth, transforming what had been a Jesuit college into a major university. He founded several other Jesuit colleges, and was active in propagating Catholicism, while at the same time being respectful of the Commonwealth policy of religious tolerance, issuing a number of decrees offering protection to Polish Jews, and denouncing any religious violence. In external relations, Báthory