Why was the United States involved in the Korean War?

The Korean War was a United Nations Police Action and the United States was part (most) of the UN force.