Agreement of Łęgonice
The Agreement of Łęgonice, which was signed on 31 July 1666 in the village of Legonice, ended the so-called Lubomirski Rokosz, a rebellion against Polish King Jan II Kazimierz Vasa, initiated by a magnate and hetman, Jerzy Sebastian Lubomirski. The rokosz was started in defence of the so-called Golden Liberty, as Lubomirski feared royal plans for strengthening the position of the king and introduction of the so-called vivente rege election.
The Battle of Matwy, which was the last battle of the rebellion, took place on 13 July 1666. After this bloodbath, which ended in the defeat of royal forces, both sides signed the agreement, according to which Lubomirski was returned all his titles, and the king was forced to abandon his election plans and reforms of the state. Furthermore, royal amnesty for rebels was declared.
The rebellion weakened the prestige of Jan Kazimierz and his bold plans. From then on, Polish-Lithuanian nobility disrespected the king, which contributed to his decision to abandon the throne in 1668. Lubomirski, after apologizing to Jan Kazimierz, had to leave the Polish–Lithuanian Commonwealth, settling in Silesia, where he died.