During the Napoleonic Wars in Europe, Central Java as a Dutch colony was handed over to the British. In 1813, the Sultanate of Yogyakarta was also divided with the establishment of the Pakualaman. Following the departure of the British, the Dutch returned as stipulated in the Congress of Vienna. The Java War between 1825 and 1830 ravaged Central Java, which resulted in a consolidation of the Dutch power. The power and the territories of the already divided Mataram were greatly reduced. After the war, the Netherlands enforced the Cultivation System which was linked to famines and epidemics in the 1840s, first in Cirebon and then Central Java, as cash crops such as indigo and sugar had to be grown instead of rice.