Who had control of Korea before it was split?

After Korea became independent after Japan in 1945, Korea didn't have unified government. US military controlled South and USSR controlled North.