The Korean War was rooted in the country's complex recent history.
China, Japan and the Soviet Union had all jostled for influence over the Korean peninsula for years, before Japan's victory in the 1904-5 Russo-Japanese war made it the dominant power. Japan went on to formally colonise Korea in 1910 and ruled it until the end of World War II.
Just seven days before Japan's surrender at the end of that war, the Soviet Union took advantage of the changing fortunes and entered Korea. The USSR and the US later agreed to divide Korea at the 38th parallel, with the USSR in charge north of this line, and the US given jurisdiction over the south.
The Soviet Union established a communist dictatorship in the North under the leadership of Kim Il-sung, a former guerrilla leader who went on to surround himself in a cult of personality.
The US meanwhile held elections in the South and a President, Syngman Rhee, was chosen. Both occupying forces withdrew from Korea by 1949.
The USSR left behind a well-equipped and -trained North Korean army. It had at its disposal 135,000 men, supported by tanks and artillery.
The South's forces, by comparison, numbered only 98,000 and were effectively a constabulary force. This was partly because the US was anxious to deprive the South of the means to invade the North.
Both sides wanted a reunification of the peninsula - the North dreamed of a wholly communist peninsula, and the South of a unified democracy.
The North was encouraged by its superior military balance, and an ill-advised statement in January 1950 by US Secretary of State Dean Acheson, which appeared to leave South Korea out of the US' military defence commitments.
In the early hours of 25 June 1950, when half of the South's troops were on leave for the weekend, North Korea launched a surprise, but well co-ordinated, attack across the 38th parallel.