In 1467, the chapter chose as bishop Nicolaus von Tüngen, while the Polish king promoted Wincenty Kiełbasa for the position. It was Tüngen who was approved by the pope, but he was unable to take the seat de facto and instead resided in Riga. Unable to get the pope's approval for Kiełbasa, Casimir changed tack and nominated Andrzej Oporowski, his chancellor, as bishop. Oporowski however, unlike Kiełbasa, did not have the support of the Prussian estates as he was not from the region. This resulted in a dispute in which Tüngen was supported by the Teutonic Order and Matthias Corvinus, the king of Hungary. With help from the Order Tüngen was able to come to Warmia in 1472. In 1476 Corvinus invaded southern 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. 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 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.