In June 1433 Poland allied itself with the Czech Hussites in order to stop the Teutonic Order from sending secret support to Švitrigaila via its Livonian branch. The Teutonic Knights had supported the Pope and Holy Roman Emperor Sigismund against the heretic Hussites during the Hussite Wars. Czech forces under Jan Čapek of Sány were granted safe passage through Poland for their last and largest "beautiful ride." The Polish forces were also supported by Pomeranian Duke Bogusław IX of the Duchy of Stolp. In addition, the Moldavians, whose ruler Iliaş had been replaced by the more pro-Polish Stephen II, had joined the Polish alliance. For four months the Hussite army, including forces led by Feodor Ostrogski, ravaged Teutonic territories in Neumark, Pomerania, and western Prussia. First they unsuccessfully besieged Konitz for six weeks, then moved north to Schwetz and Danzig. They captured several towns and castles, including Dirschau on the Vistula River. Despite their failed siege of Danzig, the Hussites reached the Baltic Sea near Oliwaat the beginning of September and celebrated their "beautiful ride" by symbolically filing their bottles with water from the sea. Returning to the south via Starogard Gdański, the expedition occupied a castle in the frontier settlement of Nowy Jasiniec.
Negotiation and conclusion of the peace
On 13 September 1433 a truce was signed at Jasiniec in force until Christmas. Polish–Teutonic negotiations continued at Brześć Kujawski, and Hussite–Catholic negotiations continued at the Council of Florence and at the Czech Diet in Prague. The Polish-led invasion of Neumark and Pomerania had proven successful, cutting the Teutonic Order off from support from the Holy Roman Empire, and convincing the Order to sign a treaty with the Poles. While the Order's leaders had been willing to fight on, the citizens of Prussia demanded an immediate end to the war. The Poles put forth several conditions: an end to the Knights' appeals to the emperor, the pope or the Council of Florence for dispute resolution; the surrender of Nieszawa; and an end to their alliance with Švitrigaila. The Knights rejected these conditions, and the Poles threatened a new invasion. Finally, on 15 December 1433, twelve-year Truce of Łęczyca was signed between the Poles and the Order at Łęczyca. The Teutonic Knights agreed to other Polish demands, including that the Order cease its support for Švitrigaila; moreover, each side would control the territories that it occupied until a peace was signed, and no party would seek mediation by foreign powers in order to alter this truce. This marked the end of the war on Polish soil; the struggle on Lithuanian lands would continue for two more years, as the truce with Poland did not extend to the Livonian Order. Jogaila's alliance with heretics had damaged his reputation. By 1433, however, Jogaila had regained favor with the Church, particularly since Švitrigaila had allied himself with the Islamic Tatars. Jogaila received tithes from the Church, and his representatives were invited to be heard before the ecumenical council at Florence.
Decisive battle
When Jogaila died in May 1434, the Order resumed its backing for Švitrigaila, who rallied his supporters, including knights from the Livonian Order, the Orthodox dukes, and his nephew Sigismund Korybut, a distinguished military commander of the Hussites. The final Battle of Pabaiskas was fought in September 1435 near Ukmergė, northwest of Vilnius. It is estimated to have involved 30,000 men on both sides. Švitrigaila's army, led by Sigismund Korybut, was split by the attacking Lithuanian–Polish army, led by Michael Žygimantaitis, and soundly defeated. The Livonian Order had suffered a great defeat, sometimes compared to that which had been inflicted on the Teutonic Knights at Grunwald in 1410. On 31 December 1435 the Teutonic Knights signed a peace treaty at Brześć Kujawski. They agreed to cease their support for Švitrigaila, and in the future to support only Grand Dukes who had been properly elected jointly by Poland and Lithuania. The treaty did not change the borders that had been set by the Treaty of Melno in 1422. The Teutonic and Livonian Orders no longer interfered in Polish–Lithuanian affairs; instead, Poland and Lithuania would involve themselves in the Thirteen Years' War, the civil war that would tear Prussia in half.