It was to stop communism from infecting all of Vietnam. The only wrong thing the US did in the war was pull out in 1975. This let the northern communist rats to invade and conquer the south. You might ask, what about Mỹ Lai and all the other massacres? Well, first of all, as we know, communism is an ontological evil and nothing we do to stop it is unjustified. Second of all, almost all the massacres happened in rural villages in the mountainous central highlands, where the population is mostly made up of barbarian, unassimilated tribes, like the Jarai and Rade, so most of the ones that were killed were not ethnic Việt.