Vietnam: On the Futility of US Invasions

Why on earth did the US invade Vietnam half a century ago? Have the lessons finally been learned?