Before World War II , Korea was part of Japan . After World War II , Japan left and the Soviet Union and United States occupied Korea . In the aftermath of the Japanese occupation of Korea which ended with Japan 's defeat in World War II in 1945 , Korea was divided at the 38th parallel in accordance with a United Nations arrangement , to be administered by the Soviet Union in the north and the United States in the south .