[2] As the Dutch East India Company (VOC) became a greater presence in Java in the seventeenth century, they allied themselves with Mataram in exchange for trade and territorial concessions.
[2] Although Mataram continued to control most of central and eastern Java, they ceded the city of Semarang and its surrounding villages to the VOC in January 1678.
[2][1] At first it was only a small enclave, but gradually the VOC demanded expansions until Pakubuwono II was forced to yield all of the northern coast around Semarang to them in the 1740s.
[1][2] When the French under Napoleon took control of the Indies and appointed Herman Willem Daendels as governor, he abolished the former administrative divisions and created prefectures, including Semarang, Japara, and Pakalongan.
[1] At around the time of World War I it was divided into a number of subdivisions[1] (afdeelingen), most of which still exist as Regencies in Indonesia today: In the late 1920s Semarang Residency became considerably smaller because of administrative restructuring.