Sunan Amangkurat I was the son of Sultan Agung Hanyakrakusuma. His mother was titled Ratu Wetan, the daughter of Tumenggung Upasanta, the regent of Batang (a descendant of Ki Juru Martani). Amangkurat I had two consorts, namely Princess Prince Pekik from Surabaya who became Ratu Kulon who gave birth to Raden Mas Rahmat, who later became Amangkurat II; while the daughter of the Kajoran family became Ratu Wetan who gave birth to Raden Mas Drajat, who later became Paku Buwana I (Interview with Agus Soleh and Masruri, Caretaker of the Tomb of Sunan Amangkurat I, June 16, 2019).

As the successor to his father, Sultan Agung, Sunan Amangkurat I was an ambitious ruler. Ricklefs in Modern Indonesian History: 1200-2008 (2010: 160-166), explains that Sunan Amangkurat I's character was very different from that of his father, Sultan Agung. When he was young, he had been involved in a scandal with the wife of a senior courtier, Tumenggung Wiraguna, which ended in the death of the Tumenggung. When he was in power, Sunan Amangkurat I, also mentioned by Rickelfs, as the person responsible for the massacre of the ulama due to a heated political conflict. In 1647, he moved his power from Kerta to a new palace in Plered. His bloodthirsty nature also caused many senior figures in the kingdom to be killed. Those who were proven or feared to oppose him would also be killed. This certainly caused fear and gave rise to divisions in the areas of Mataram's power, such as Banten and Cirebon. Not only that, political problems also hit the kingdom internally. The crown prince, who would later be titled Amangkurat II, was also involved in this scandal and turmoil.

The crisis that occurred in Mataram, had given rise to protests and rebellions. One of the most decisive rebellions in the history of Mataram was the Trunajaya rebellion. Raden Trunajaya was a nobleman from Madura who was also the son-in-law of Raden Kajoran, a man who was believed to be holy and had supernatural powers. Trunajaya's father was murdered in the palace in 1656, a reason enough to launch a rebellion. Finally, a coalition between Amangkurat II, Raden Kajoran, and Raden Trunajaya was formed. It was agreed that, when Raden Trunajaya succeeded in launching a rebellion, the crown prince, Amangkurat II, would ascend the throne.

In 1675, the rebellion really flared up in Mataram. Trunajaya's target was not only Mataram, but also the VOC. For him, as long as the VOC was entrenched in Mataram, Mataram would never prosper. The rebels attacked the port of Surabaya, and continued to control the eastern part of the north coast. Trunajaya's victory after victory had raised the awareness of the Javanese nobles and they began to disregard the power of Amangkurat I. This gave rise to Trunajaya's self-confidence. He, who had originally changed his title to Panembahan, now claimed to be a descendant of Majapahit and had the right to the throne of Mataram. The peak of the rebellion was the fall of the Plered palace in June 1677. The king handed over the palace to his other son, Prince Puger. Meanwhile, Amangkurat I with the crown prince, fled from the palace, and moved west towards the northern coastal area. The palace, which was deserted because Prince Puger had also fled, was completely robbed by Trunajaya. All the agreements that had been made with the VOC, only increased the tension of the rebellion. 

The involvement of the crown prince had actually been suspected by the palace. However, no matter what happened, Sunan Amangkurat I actually ordered the crown prince to crush the Trunajaya rebellion. Sunan Amangkurat I was also the one who handed over the reins of power of Mataram to Amangkurat II. In the midst of his escape, the increasingly elderly Sunan Amangkurat I could not bear the suffering. He died on July 13, 1677. The crown prince, Sunan Amangkurat II, buried him in Tegalarum (Tegal Wangi), according to his father's will. During his escape, Sunan Amangkurat I did not bring many royal items. However, the royal heirlooms that marked the power of a dynasty had been started by Sunan Amangkurat II. To crush the rebellion, there was no other way for him, but to re-establish cooperation with the VOC.