 After Sultan Agung died in 1645, the Priangan region slowly breaking away from Mataram influence.In 1674, Trunajaya rebellion started in Madura and greatly weakened Mataram.Sukabumi which was still a part of Cianjur was declared itself independent from Mataram under the leadership of Wiratanu I in 1677, when Trunajaya forces sacked the Plered Palace in Mataram's capital.