What happened initially when the UN forces went to support South Korea

When the United Nations forces initially went to support South Korea in response to the North Korean invasion in 1950, they faced heavy resistance from North Korean forces and suffered significant losses. The North Koreans had initially pushed the South Korean and UN forces back to the Pusan Perimeter, a small area in the southeastern corner of South Korea. The situation was dire for the UN forces, but they were eventually able to mount a successful counterattack at the Battle of Inchon, which led to the liberation of Seoul and the eventual push north towards the Chinese border. However, the Chinese entered the war on the side of North Korea, leading to a stalemate that lasted until the armistice in 1953.