Poland and a year later Heinrich Reffle von Richtenberg, the grand master of the order, refused to provide military support to Casimir, his sovereign. Casimir responded by courting the support of the Prussian Estates and cities. He granted Chełmno Law to several cities, affirmed existing privileges and withdrew the candidature of Oporowski. As a result, the Prussians re-swore their fealty to the king of Poland and refused to support the order. Likewise, Gdańsk, the largest city in Polish Royal Prussia declined to support to the Order and Corvinus. Military action In 1477 Martin von Wetzhausen, the new grand master of the order refused to make his oath of fealty to the Polish king and invaded Warmia, taking Chełm and Starogard Chełminski. In response, in 1478, Polish forces of King Casimir IV intervened militarily, besieging Braniewo. Under the command of Jan Biały and Piotr Dunin, the Polish forces occupied several cities in Warmia and Pomesania. The Teutonic Knights' military operations were hampered by the refusal of the Prussian Estates to support them. Tüngen was forced to flee to Königsberg (Królewiec). At the same time, in April 1479, the Polish and Hungarian kings came to an agreement and Corvinus withdrew from the anti-Polish alliance. As a consequence by July 1479, both Tüngen and the grand master were forced to pay homage to the Polish king. Settlement The first Treaty of Piotrków (in Piotrków Trybunalski) ended the feud in 1479. The Polish king accepted Nicolaus von Tüngen, who had been elected in 1467, as bishop, and granted or confirmed several prerogatives of the bishopric. The bishop acknowledged the sovereignty of the Polish king over Warmia, obliged the chapter to elect only candidates "liked by the Polish king" and the Warmians had to pledge allegiance to him. Politically Warmia remained under lordship of the Polish crown. References 15th-century conflicts Priests Wars involving the Teutonic Order 15th century in Poland Warfare of the Middle Ages Diocesan feuds