With Sultan Haji allied with the VOC, a war broke out between Batavia and Banten in the 1680s. After a year, the old Sultan Ageng Tirtayasa was forced to surrender. He was held as a prisoner first in Banten, later in Batavia when he died there in 1692. In return for their help, the Dutch demanded Sultan Haji to sign some detrimental agreements; the expulsion of all foreigners from Banten, the Dutch monopoly on pepper trade, and the right to establish a Dutch garrison in Banten. Subsequently, the Dutch had the Banten fortification torn down, and they built Fort Speelwijk right on the entrance of the port.