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.. Which event happened first, the Battle of Pabaiskas or the signing of the peace treaty?