East of Batavia, Sultan Agung (king of the Mataram Sultanate) gained control of most of Java by defeating Surabaya in 1625. On 27 August 1628, Agung began the Siege of Batavia. After heavy losses in his first attempt, he retreated and launched a second offensive the following year. This also failed; the Dutch fleet destroyed his supplies and ships in the harbors of Cirebon and Tegal. Mataram troops, starving and decimated by illness, retreated again. Agung then moved east, attacking Blitar, Panarukan and the Blambangan Kingdom in eastern Java (a vassal state of the Balinese kingdom of Gelgel).