The crown prince expected a performance, not a battle. When the Mataram army met Trunajaya's rebel forces at Gegodog on the north coast of Java in October 1676, Pangeran Adipati Anom believed his former protege would stage a sham fight. The two sides would clash, appearances would be satisfied, and then both armies would turn against the king they both despised. Trunajaya had other plans. What unfolded on that coastal plain east of Tuban was a genuine battle that shattered the royal army, killed an eighty-year-old prince who refused to stop fighting, and cracked open the Mataram Sultanate like a dropped jar.
The roots of Gegodog reach back to 1670, when the Madurese nobleman Trunajaya was living in exile at the Mataram court. His father-in-law, the prominent nobleman Raden Kajoran, introduced him to the crown prince. The two men discovered they had something powerful in common: a personal grievance against King Amangkurat I. The crown prince's maternal grandfather, Pangeran Pekik, had been executed on the king's orders. Trunajaya's own father had met the same fate. From mutual resentment, a friendship grew. By 1671, Trunajaya had returned to his homeland of Madura and used the crown prince's patronage, along with his family name, to gather followers and seize control of the island. When his rebellion erupted in 1674, the raids against Mataram cities were not the work of a stranger to the court. They were the work of a man who knew its weaknesses intimately.
In 1676, Trunajaya's forces crossed from Madura to Java with an army of 9,000 fighters: East Javanese, Madurese, and Makassarese warriors under his command and that of his ally Karaeng Galesong. They took Surabaya, the principal city of East Java, almost immediately. King Amangkurat I responded by assembling a much larger force and placing his son, the crown prince, at its head. Whether the king was ignorant of his son's secret alliance with the rebels or deliberately sending him into a situation designed to expose him remains one of the enduring questions of Javanese history. The royal army was enormous but hollow, packed with conscripted peasants and stiffened by West Javanese auxiliaries. Among the princes who marched with it was Pangeran Purbaya, the king's uncle and Sultan Agung's last surviving brother, nearly eighty years old and still willing to ride to war.
The two armies met at Gegodog, east of Tuban on the north coast of eastern Java. The crown prince still expected the choreographed battle he and Trunajaya had presumably arranged, after which both forces would unite against the king. But the presence of other princes complicated everything. Pangeran Singasari, the crown prince's rival and another of the king's sons, was watching. Faking a battle under such scrutiny may have been impossible. After what sources describe as a long wavering, the crown prince finally ordered an attack on October 13, 1676. Trunajaya answered with a real fight, and the conscript-heavy royal army buckled. In the rout that followed, the aged Pangeran Purbaya rallied what troops he could and led a final charge. Thomas Stamford Raffles, writing over a century later, recorded that the old prince "performed extraordinary feats of valour," had his horse shot from under him, and continued fighting on foot until he was overpowered and killed. His sacrifice changed nothing. The Mataram army disintegrated.
Gegodog broke Mataram's offensive capability in a single afternoon. Defections accelerated as Javanese subjects switched allegiance to the winning side. Trunajaya's forces swept westward along the northern coast, and by January 1677, nearly every coastal town from Surabaya to Cirebon had submitted to him. Only Jepara held out, thanks to its military governor and Dutch East India Company forces who arrived from Batavia. The inland collapse was slower but equally decisive: in June 1677, rebel forces under Raden Kajoran overran and sacked the Mataram capital at Plered. The territories that Sultan Agung had expanded decades earlier fell to ruin, their fortifications dismantled. Mataram was reduced to begging the VOC for military help, paying for it with geopolitical and financial concessions that would shape Java's colonial future for generations.
The crown prince bore the blame. Accused of colluding with the enemy, he was stripped of military command and replaced by his brothers Pangeran Martasana and Pangeran Puger. When the capital fell, he fled eastward with his father, the aging king. Amangkurat I died during the retreat, and the son who had been disgraced at Gegodog took the throne as Amangkurat II. He inherited a kingdom in fragments: its capital sacked, its territories scattered among rebels, and its sovereignty increasingly dependent on Dutch military power. The man who had expected a staged battle at Gegodog spent the rest of his reign trying to reassemble what that real battle had destroyed. The north coast of Java, where it all happened, shows little trace today. But the consequences of that October afternoon rippled outward for centuries, entangling Javanese sovereignty with European colonial ambition in ways that neither the crown prince nor his betrayer could have foreseen.
Located at 6.90S, 112.30E on the north coast of eastern Java, east of Tuban. The flat coastal plain along the Java Sea coast is visible from altitude. Juanda International Airport (WARR) at Surabaya is approximately 100 km to the east-southeast. The coastline runs roughly east-west, with the Java Sea to the north. Tuban lies to the west along the coast road. Best viewed at 3,000-6,000 ft AGL, where the contrast between the narrow coastal plain and the volcanic interior of Java is apparent.