Amangkurat I of Mataram

Amangkurat I (Amangkurat Agung; 1619–1677) was the sultan of Mataram from 1646 to 1677. He was the son of Sultan Agung Hanyokrokusumo. He experienced many rebellions during his reign. He died in exile in 1677, and buried in Tegalwangi (near Tegal), hence his posthumous title, Sunan Tegalwangi or Sunan Tegalarum. He was also nicknamed as Sunan Getek, because he was wounded when suppressing the rebellion of Raden Mas Alit, his own brother.
Genealogy.
Born as Raden Mas Sayidin, he was the son of the powerful Sultan Agung. 
His mother was styled Ratu Wetan, daughter of Tumenggung Upasanta, Regent of Batang (descendant of Ki Juru Martani). When becoming a crown prince, he was styled Pangeran Arya Prabu Adi Mataram.
Like other Mataram monarchs, Amangkurat I had two queen consorts: Ratu Kulon, daughter of Pangeran Pekik of Surabaya, who gave birth to RM. Rahmat (later Amangkurat II); and Ratu Wetan, originating from Kajoran family, who gave birth to RM. Darajat alias Pangeran Puger (later Pakubuwono I).
Early reign.
In 1645, he was appointed as Mataram monarch succeeding his father, styled Susuhunan Ing Alaga. Following his coronation in 1646, he was styled Kanjeng Susuhunan Prabu Amangkurat Agung, abbreviated as Amangkurat. In Javanese, the word "Amangku" means "to administer", and "Rat" means "world", thus Amangkurat means "administering the world". He then became a king who had full power over entire Mataram Sultanate and its vassal states. At his coronation, all royal family members swore allegiance to him.
Amangkurat I got his father's heritage in the form of vast Mataram territory. In this case, he applied centralization. Upon taking the throne, he tried to bring long-term stability to the Sultanate of Mataram's realm, which was considerable in area but marred by continual rebellions. He murdered local leaders that were insufficiently deferential to him, including the still-powerful noble from Surabaya, Pangeran Pekik, his father-in-law. Other victims were Tumenggung Wiraguna and Tumenggung Danupaya, who was ordered to invade Blambangan Kingdom which had been conquered by Kingdom of Bali in 1647, but they were murdered en route to the east. He also closed ports and destroyed ships in coastal cities to prevent them from getting too powerful from their wealth.
To further his glory, the new king abandoned Karta, Sultan Agung's capital, and moved to a grander red-brick palace in Plered (formerly the palace was built of wood). The palace's movement was slanted by rebellion of Raden Mas Alit or Prince Danupoyo, his own brother who opposed to senior figure's purge. This rebellion was supported by ulemas, but ended with RM. Alit's death. Amangkurat I turned to face ulemas. They, including their families (approximately more than 5,000–6,000 people), were gathered in "alun-alun" (city square) to be massacred.
Foreign relation.
Amangkurat I made a close relation with Dutch East India Company previously fought by his father. In 1646, he allowed Dutch East India Company to open trade posts in Mataram territory, while Mataram was allowed to trade in other Dutch-ruled islands. Both of them also liberated prisoners each other. The treaty was viewed by Amangkurat I as the submission sign of Dutch East India company to Mataram rule. But, he was shocked when Dutch East India Company conquered Sultanate of Palembang in 1659.
Hostility between Mataram and Banten also worsened. In 1650, Cirebon was ordered to conquer Banten but failed. 2 years later, Amangkurat I forbade rice and wood exports to the country.
In the meantime, diplomatic relation between Mataram and Gowa which had been established by Sultan Agung was eventually deteriorated. Amangkurat I refused Gowa's messengers and asked Sultan Hasanuddin himself to come to Java. The request was certainly rejected.
Conflict with crown prince.
Amangkurat I was also at odds with the crown prince, RM. Rahmat. The conflict was begun by a news that the position of crown prince would be transferred to Prince Singasari (another Amangkurat I's son).
In 1661, RM. Rahmat rebelled against his father, but failed. Amangkurat I suppressed the entire of his son's supporters. In contrast, Amangkurat I also failed in poisoning RM. Rahmat in 1663.
The crown prince (future Amangkurat II) felt that his life was not safe in the court after he took his father's concubine, Rara Oyi, with the help of his maternal grandfather, Pangeran Pekik of Surabaya, making Amangkurat I suspicious of a conspiracy among Surabayan factions to grab power in the capital by using Pekiks’ grandson's powerful position as the crown prince.
Amangkurat I sentenced his own father-in-law, Pangeran Pekik, to death, who was accused to abduct Rara Oyi for RM. Rahmat. Amangkurat I forgave his son after forcing him to kill Rara Oyi with his own hand.
Trunajaya rebellion.
By the mid-1670s dissatisfaction with the king was turning into open revolt, beginning from the recalcitrant Eastern Java and creeping inward. RM. Rahmat conspired with Panembahan Rama of Kajoran, South Klaten, who proposed a stratagem in which the crown prince financed Rama's son-in-law, Trunajaya, to begin a rebellion in the East Java. Raden Trunajaya, a prince from Madura, lead a revolt supported by itinerant fighters from faraway Makassar, led by Karaeng Galesong (supporter of Sultan Hasanuddin who had been defeated by Dutch East India Company in 1668), that captured the king's court at Mataram in mid-1677.
It is believed that a subsequent conflict occurred between Trunajaya and RM. Rahmat, causing Trunajaya not to cede power to him as planned before and even plundered the palace. RM. Rahmat who couldn't control Trunajaya was eventually in his father's side.
The king escaped to the north coast with his eldest son, the future king, leaving his younger son Pangeran Puger in Mataram. Apparently more interested in profit and revenge than in running a struggling empire, the rebel Trunajaya looted the court and withdrew to his stronghold in Kediri, East Java, leaving Puger in control of a weak court. Seizing this opportunity, Puger assumed the throne in the ruins of Plered with the title Susuhunan ing Alaga.
Death.
Soon after this episode, Amangkurat I fell sick in exile. According to "Babad Tanah Jawi", his death was catalyzed by poisoned coconut water given by RM. Rahmat. Despite of this, he still appointed RM. Rahmat as his successor, but accompanied by a curse that none of his descendants who would become a king but one, who would rule in a short period. Amangkurat I also made a will that RM. Rahmat also asked for help to Dutch East India Company in seize the throne from Trunajaya.
Amangkurat I died in Wanayasa forest and buried near his teacher near Tegal. Because of its fragrant soil, the village where Amangkurat I was buried would be known as Tegalwangi or Tegalarum. 12 Dutch soldiers led by Oufers attended his funeral.
He was succeeded by his eldest son as king in 1677, who reigned as Amangkurat II. He founded Sunanate of Kartasura as the successor of Mataram Sultanate.