Treaty of Ófalu

The Treaty of Ófalu was a peace treaty signed by the Kingdom of Poland and the Kingdom of Hungary in 1474.

Background
In 1423–24 the Hungarian-Polish relations were characterized relatively good. Though in 1429–30 Sigismund made efforts to alienate Władysław II Jagiełło king of Poland and Lithuanian Grand Duke Vytautas, but after the death of Vytautas, the ground of collision vanished. In May 1438 the situation changed when the Czech estates elected Albert (Hungarian and German King) King of Bohemia, while the Utraquists voted for the subsequent Polish King Casimir IV of Poland. In July a war broke out between King Albert and Polish King Władysław III of Poland that lasted until 4 January 1439, when a truce put an end to it in Breslau.

After the death of Albert I Władysław III was crowned Hungarian King under the name of Vladislas I and controlled both countries in a personal union. After his death, the nobility of both countries had different issues to deal with thus the Hungarian-Polish relationship can be characterized as neutral. After the death of King Ladislas IV, Casimir, King of Poland also claimed the Hungarian throne, which brought him to turn against King Matthias. This time Casimir took no steps and waited for a better opportunity, like the one that came in 1471.

Premise
In 1453 during the Hungarian-Czech War the situation radically changed. Matthias wanted to create a Polish-Austrian-Hungarian coalition, and was up to pledge it with marital relationships. His emissary to Kraków, the Bishop of Olomouc, however, did not succeed in putting this idea to reality. The Polish envoys in Olomouc, in turn, who tried to mediate between the Czechs and the Hungarians were ordered to the Pope or the Emperor.

In 1469 the Czech Catholic estates elected Matthias the King of Bohemia and he proposed to the daughter of Casimir but the Polish King refused it. He did so because George of Poděbrady promised the Bohemian crown to his son Władysław in exchange for a Polish military aid against Matthias. So Casimir approached Emperor Frederick to create an alliance against the Hungarian king. The negotiations were discontinued from October, because Frederick was not willing to give up the title "King of Hungary", which he was granted in the Peace Treaty of Wiener Neustadt in 1463, and denied to ultimately cede it to Ladislaus.

In 1471 there was an unexpected turn: George of Poděbrady died on 22 March 1471, and in the diet of Kuttenberg the Utraquist majority elected Wladislas King of Bohemia. Matthias, of course, declared this election illegitimate. Meanwhile, Casimir IV of Poland was invited to Hungary and was supported by the rebelling Hungarian nobles and religious leaders headed by Janus Pannonius, John Vitéz and Emeric Zápolya. Casimir IV stepped in and sent his son Casimir as a pretender to the Hungarian throne. They declared war on 20 September. Polish troops entered the country on 2 October and occupied the forts at Humenné and Michalovce (though they were retaken by Matthias in 1473). Prince Casimir was promised a Hungarian reinforcement as the nobles were to join him after crossing the border. He led his army of 12.000 men towards Kassa where he was about to take the city without resistance. Meanwhile, Matthias was able to settle his dispute with the rebelling factions and convinced them to take his side. The parties agreed and so did Zápolya along with Nicolaus Chiupor de Monoszló who stopped the approaching Polish invasion from attempting to besiege Kassa by taking the city before him and fortifying themselves in. The prince turned to Nitra instead and occupied it. Matthias arrived there to liberate the city with his army of 16,000 mercenaries and banderias (banners). From this point on, the events are unclear; what is sure is that Casimir retreated with an escort cavalry and the rest of the Polish main forces were released shortly after. Contemporary historians' presentations differ on the causes of the outcome. Italian historian Antonio Bonfini commissioned by Matthias refers to it as being a siege, which resulted in heavy loss for the besieged due to famine for the first wave. He states that the second wave of Poles was slaughtered by peasants and citizens while marching home, while the prince fled days before, after meeting Matthias and had been spared by him. Hungarian Johannes de Thurocz agrees while adding that a counterattack followed the events where Hungarians attacked the counties of Zemplén and Sáros still under Polish possession and drove them out and intruded into Poland as well for prowling (it is worth noting that these events show remarkable similarities to those that took place two years later). While Polish historian Jan Długosz argues that the incursion happened upon invitation and that no state of war came into existence. He recalls the nobility's actions as betrayal and Casimir's steps as aid or some sort of help for the counts of Hungary. He also questions the circumstances of the retreat claiming it was a peaceful return after Casimir IV met with the Pope Sixtus IV's emissary in Kraków who intervened and urged the maintenance of peace.

Pope Sixtus IV continued to support Matthias instead of Władysław: On 1 March 1472 he acknowledged his Czech kingdom and sent Cardinal Marco Barbo to negotiate between Matthias and the House of Jagiellon and authorized him to excommunicate the Jagellos in case they'd resisted. Ongoing from 31 March the negotiations ended in a truce on 8 May and restarted on 20 October in Neisse. This meeting ended without success, similarly to the 15 August 1473 Troppau meeting, because Matthias was not willing to give up the occupied territories in Bohemia.

The treaty
The negotiations are now crowned with success. Matthias denounced his conquests in Galicia, and concluded a three-year peace regarding the feud over the Kingdom of Bohemia. The parties confirmed the Treaty of Lubowla as well, which was as follows: The towns of Szepesbéla, Durand, Felka, Igló (Neudorf), Leibic, Mateóc, Ménhárd, Poprád, Ruskin, Szepesolaszi (Wallendorf), Szepesszombat, Szepesváralja, Sztrázsa and the forts of Gnézda, Podolin and Lubowla remained pawned to Poland though their integrity within Hungary was maintained thus freeing themselves of many Polish taxes.

Aftermath
After a month the war resumed in March 1474, when Frederick III and Vladislaus, the Czech king, formed an alliance against Matthias. This alliance was also joined by the Poles, although it was only a month after the peace treaty signed in Ófalu. The conflict rolled into military events taking place in Silesia in autumn 1474. Matthias transported the Black Army led by Melchior Löbel to the strengthened fortresses and towns away from the Czech-Polish troops, and his mercenaries harassed the enemy. The Hungarian king joined by Duke Jan II the Mad went to Boroszló, and declared his engagement to Beatrice during the siege of the town. The Czech-Polish forces took a lot of captives but because their siege was unprepared, they were in lack of food and asked for a truce from the defenders. It is a very unlikely event in military history.

The mortgaged towns were regained on 5 November 1772 during the First partition of Poland.