King Stephen V died on 6 August 1272, and after this the alliance between Bolesław the Chaste and the Kingdom of Hungary was completely broken. In 1277 Bolesław finally made a peace treaty with Bohemia at Opava. With the new king of Hungary, Ladislaus IV, a minor, Bolesław became an ally of the Kingdom of Bohemia; however, during the conflict between Ottokar and King Rudolph I of Germany, he opted for the Hungarian side. On 26 August 1278 Bolesław was present in the decisive Battle on the Marchfeld, where Ottokar was defeated and killed.