Battle of Surabaya (1677)

The Battle of Surabaya was fought in May 1677 during the Trunajaya rebellion, in which the Dutch East India Company (known by its Dutch acronym "VOC") defeated the forces of Trunajaya and took Surabaya on behalf of its ally, the Mataram Sultanate.

Background
The Trunajaya rebellion began in 1674 as rebel forces conducted raids against the cities of the Mataram Sultanate. In 1676, a rebel army of 9,000 invaded Java from their base in Madura and shortly after took Surabaya, the principal city of eastern Java. Mataram sent a much larger army to suppress them, but Trunajaya's forces routed this army at the Battle of Gegodog. The rebels continued to win victories and gain territories in the following month, taking most of the northern coast of Java as far west as Cirebon. Facing the imminent collapse of his authority, the Mataram King Amangkurat I sought help from the VOC in Batavia. On 20 January 1677, Admiral Cornelis Speelman, recently named commander of the VOC's forces in Java's north coast, arrived in Jepara to negotiate with Wangsadipara, the Mataram governor of the north coast. They agreed to a contract in February, which was ratified by the king in March.

VOC arrival off Surabaya
Speelman's fleet left Jepara, anchored off Surabaya in early April and tried to start negotiations with Trunajaya. Trunajaya was initially friendly towards the VOC, but he refused to meet Speelman on board a VOC ship. The VOC's impression of Trunajaya declined after he failed to keep an appointment on neutral waters, and after emissaries reported that he was a drunkard. By the end of April, Speelman had decided to attack Surabaya over negotiations.

Forces and terrain
Speelman had around 1,500 men under his command, including about 400 VOC troops from Jepara; the remainder had sailed with him from Batavia. The force from Batavia included 600 sailors, 310 European soldiers, and four "companies" (each about 50 strong) of Ambonese, Malays, Balinese and Mardijkers.

Surabaya was defended by fortifications, artillery and a "substantial" number of men. The defenders had at least 120 cannons. Trunajaya's forces were technologically on par with those of the VOC, since VOC technical innovations had been quickly adopted in Java. Two rivers, the Kali Mas and Kali Pegirian, flowed through the city into the Madura Strait in the north. Trunajaya established his court in an old royal citadel (around the location of today's East Java Governor's office) and diverted the Kali Mas to form a moat around it. However, during the battle, the moat was dry because of the dry season during the east monsoon. Trunajaya established his main line of defence along the river north of the citadel, building elevated fortifications and palisade barriers, and emplacing two artillery batteries. The more easterly Kali Pegirian flowed through Ampel, a district of Surabaya containing the grave of Sunan Ngampel-Denta, one of the Wali Songo. In contrast to the western sector, this sector (Trunajaya's right flank) was lightly defended; only palisade barriers were built across the river. The distance from the coast to Trunajaya's main defenses, around 4.5 km, mostly consisted of marshy ground covered with scrub, and were underwater at high tide.

Main fighting
VOC forces landed on 4–5 May on Trunajaya's right flank. Trunajaya did not expect an attack on this flank, and consequently it was only lightly defended. VOC took Ampel after little resistance. In the following days, the VOC established its battery in Ampel, simultaneously conducting desultory negotiations with Trunajaya. Trunajaya accused Speelman of being unknightly by attacking his right flank instead of his main position. Both Trunajaya and VOC moved their works forward until their artillery batteries faced each other at pistol-shot distance. Trunajaya dammed the river, the VOC's source of fresh water; afterwards, the VOC troops were limited to brackish water, and diseases soon spread.

At this point, time appeared to be on Trunajaya's side, as further delay would allow him to strengthen his fortifications and reinforcements, while disease would weaken the VOC's forces. Therefore, Speelman decided to attack. On 12–13 May, the VOC delivered a heavy artillery bombardment on Trunajaya's main works, followed by an assault. The attack succeeded after hard fighting, and Trunajaya retreated inland to establish his new capital at Kediri, capital city of the ancient Kediri Kingdom. In the retreat, he left behind sixty-nine iron cannons and thirty-four bronze cannons (twenty of them small ships' cannons, bassen) and only saved twenty bronze pieces.

Follow-up
VOC forces proceeded to clear the rebels from the area surrounding Surabaya. Two VOC detachments—Indonesian companies led by Dutch captains—were sent northwest along the coast, clearing the rebels in the areas surrounding Sidayu, Tuban and the Kendeng mountains with no losses. Speelman also sent envoys, including Indian traders, to Kraeng Galesong at Pasuruan. Galesong was a former ally of Trunajaya who had quarreled with him and remained neutral during the battle in Surabaya. This negotiation failed in early May, and Galesong refused to submit even after Trunajaya's defeat in Surabaya. The VOC also tried to gain the loyalties of the lords of Madura, Trunajaya's home island across the strait from Surabaya. Several Madurese lords submitted to the admiral as the representative of the Mataram king in late May, and Speelman tried to install one of them, Raden Martapati, as a proxy. However, Martapati's authority collapsed in the face of Trunajaya loyalists as soon as his VOC escorts left Madura, and he was forced to flee to Surabaya. Subsequently, Speelman himself sailed to Madura, defeated Trunajaya's allies there, and razed his residence, Maduretna. However, in late June the court of Mataram itself fell to Trunajaya's forces, and the king fled. Upon receiving this news, Speelman decided to sail immediately to defend the strategic point of Jepara and link up with the retreating royal forces.

Aftermath
Speelman planned to follow his victory with a further advance towards the interior of Java, but his campaign was cut short by the news of the Mataram capital's fall, after which he immediately sailed to defend Jepara. Furthermore, Speelman's superiors in the VOC hesitated to continue further involvement in the war. At the time, Batavia itself was facing threats from the Banten Sultanate in West Java, and the VOC post at Malacca was threatened by the Johor Sultanate. On 6 July, the VOC ordered a halt to Speelman's operation: "Not one of our people, great or small, is to go to Mataram".

Historian of Indonesia M. C. Ricklefs argued that the VOC victory in Surabaya probably accelerated the fall of Mataram. The defeated rebel forces retreated inland, driving closer to Mataram's capital and triggering an early attack on the court. Secondly, the alliance between the king and the foreign, Christian VOC strengthened the Islamic character of the rebellion. Amangkurat I's successor, Amangkurat II, later told the VOC that the alliance with the VOC pushed his cousin Pangeran Purbaya towards the rebel side, and Purbaya's forces were among those who later overran the capital.

The Trunajaya rebellion continued until 1680, when it was ultimately defeated by the Mataram-VOC alliance.