Under John Casimir, the Cossacks grew in power and at times were able to defeat the Poles; the Swedes occupied much of Poland, including Warsaw, the capital; and the King, abandoned or betrayed by his subjects, had to seek temporary refuge in Silesia. As a result of the wars with the Cossacks and Russia, the Commonwealth lost Kiev, Smolensk, and all the areas east of the Dnieper River by the Treaty of Andrusovo (1667). During John Casimir's reign, East Prussia successfully renounced its formal status as a fief of Poland. Internally, the process of disintegration started. The nobles, making their own alliances with foreign powers, pursued independent policies; the rebellion of Jerzy Lubomirski shook the throne.