At the end of the 19th century, The Empire of Japan took control of Korea and it remained a Japanese colony from 1910 to 1945. When it became clear that Japan was going to be on the losing end of World War II, Russia declared war on Japan, invaded the northern coastline of Korea, and Russian troops occupied the northern part of the country.
American troops occupied the southern portion of the country and to avoid Russia from overtaking the whole country, it was agreed to divide Korea roughly in half along the 38th parallel of latitude, leaving the capital city of Seoul in South Korea.