Amangkurat II under their tight control. Amangkurat II was apparently unhappy with the situation, especially the increasing Dutch control of the coast, but he was helpless in the face of a crippling financial debt and the threat of Dutch military power. The king engaged in a series of intrigues to try to weaken the Dutch position without confronting them head on; for example, by trying to co-operate with other kingdoms such as Cirebon and Johor and the court sheltered people wanted by the Dutch for attacking colonial offices or disrupting shipping such as Untung Surapati. In 1685, Batavia sent Captain Tack, the officer who captured Trunojoyo, to capture Surapati and negotiate further details into the agreement between the VOC and Amangkurat II but the king arranged a ruse in which he pretended to help Tack. Tack was killed when pursuing Surapati in Kartasura, then capital of Mataram (present day Kartasura near Solo), but Batavia decided to do nothing since the situation in Batavia itself was far from stable, such as the insurrection of Captain Jonker, native commander of Ambonese settlement in Batavia, in 1689. Mainly due to this incident, by the end of his reign, Amangkurat II was deeply distrusted by the Dutch, but Batavia were similarly uninterested in provoking another costly war on Java. Wars of succession Amangkurat II died in 1703 and was briefly succeeded by his son, Amangkurat III. However, this time the Dutch believed they had found a more reliable client, and hence supported his uncle Pangeran Puger, formerly Susuhunan ing Alaga, who had previously been defeated by the VOC and Amangkurat II. Before the Dutch, he accused Amangkurat III of planning an uprising in East Java. Unlike Pangeran Puger, Amangkurat III inherited a blood connection with Surabayan ruler, Jangrana II, from Amangkurat II and this lent credibility to the allegation that he cooperated with the now powerful Untung Surapati in Pasuruan. Panembahan Cakraningrat II of Madura, the VOC's most trusted ally, persuaded the Dutch to support Pangeran Puger. Though Cakraningrat II harboured personal hatred towards Puger, this move is understandable since alliance between Amangkurat III and his Surabaya relatives and Surapati in Bangil would be a great threat to Madura's position, even though Jangrana II's father was Cakraningrat II's son-in-law. Pangeran Puger took the title of Pakubuwana I upon his accession in June 1704. The conflict between Amangkurat III and Pakubuwana I, the latter allied