The territory of present day-Indonesia was part of the Dutch East Indies, a colony of the Netherlands, from 1800 until 1942. The Japanese forces invaded in March 1942, expelled the Dutch forces, and occupied the Dutch East Indies. After the defeat and surrender of Japan in August 1945, Sukarno immediately declared the independence of Indonesia from Dutch rule on 17 August 1945. This led the Dutch to declare war on the Indonesian separatists, and attempt to re-establish colonial rule over Indonesia. After four and a half years of fighting the Netherlands formally recognized Indonesian sovereignty in December 1949.