It's harsh to look at stories of deaths, stories of deaths by kills are harder to sit through, because human ends the life of another. I can only look at this event with remorse.
Question: What caused the terrorist to perform the task he did? What drove him to make the choice?
Answer: Greed, the prime cause of war.
Some unlawful wars were declared by a small number of Republicans running in the oval office, they chose to start wars in countries under the word of liberation, but the idea was basically sending troops as cannon fodder to kill plenty, a large number of military casualties unfairly sent to die, and cause a bigger number of unfair death of civilians. What are these wars really for? Resources to be mined, financial gain.
These terrorists attacking soldiers like the dead marine officers (and some of the soldiers probably had no involvement in the assaults that angered plenty of people like that guy) are angry, not moving under properly guided jihad (to clear a misconception; jihad is a fight to fend off assailants, it's not what media call terrorist attacks, and it's not what ISIS -or folks like this guy flying solo- do).
The angry man's attack was likely misguided and unfair, but it did not come out of nowhere, it was vengeance, and vengeance will lead to more vengeance, and more saddening casualties for both sides.