<P> The National Security Act of 1947, meeting the need for a military reorganization to complement the U.S. superpower role, combined and replaced the former Department of the Navy and War Department with a single cabinet - level Department of Defense . The act also created the National Security Council, the Central Intelligence Agency, and the Air Force . </P> <P> The Korean War was a conflict between the United States and its United Nations allies and the communist powers under influence of the Soviet Union (also a UN member nation) and the People's Republic of China (which later also gained UN membership). The principal combatants were North and South Korea . Principal allies of South Korea included the United States, Canada, Australia, the United Kingdom, although many other nations sent troops under the aegis of the United Nations . Allies of North Korea included the People's Republic of China, which supplied military forces, and the Soviet Union, which supplied combat advisors and aircraft pilots, as well as arms, for the Chinese and North Korean troops . </P> <P> The war started badly for the US and UN . North Korean forces struck massively in the summer of 1950 and nearly drove the outnumbered US and ROK defenders into the sea . However the United Nations intervened, naming Douglas MacArthur commander of its forces, and UN-US - ROK forces held a perimeter around Pusan, gaining time for reinforcement . MacArthur, in a bold but risky move, ordered an amphibious invasion well behind the front lines at Inchon, cutting off and routing the North Koreans and quickly crossing the 38th Parallel into North Korea . As UN forces continued to advance toward the Yalu River on the border with Communist China, the Chinese crossed the Yalu River in October and launched a series of surprise attacks that sent the UN forces reeling back across the 38th Parallel . Truman originally wanted a Rollback strategy to unify Korea; after the Chinese successes he settled for a Containment policy to split the country . MacArthur argued for rollback but was fired by President Harry Truman after disputes over the conduct of the war . Peace negotiations dragged on for two years until President Dwight D. Eisenhower threatened China with nuclear weapons; an armistice was quickly reached with the two Koreas remaining divided at the 38th parallel . North and South Korea are still today in a state of war, having never signed a peace treaty, and American forces remain stationed in South Korea as part of American foreign policy . </P> <P> In the Lebanon crisis of 1958 that threatened civil war, Operation Blue Bat deployed several hundred Marines to bolster the pro-Western Lebanese government from July 15 to October 25, 1958 . </P>

What was the goal of the united states when it went to war in korea
find me the text answering this question