This appears to have been the act of a single person, a military officer, oddly enough, who had been protesting and appealing his upcoming deployment overseas.
My feeling is, the gunman cannot have been right in the head. If you're in the military, deployment is pretty much a given during wartime. You go where they send you. To argue against that is irrational; you obey lawful orders. Apparently, he was quite vocal about his objections to the war and to being sent into it, and this understandably did not endear him to his fellow soldiers. It's alleged that harassment occurred, though I don't know to what extent. That's conduct unbecoming, and it ought not to occur, but as part of human nature, it does. It's basically a group's way of defending itself against someone it perceives as an outsider.
I don't think this man should have been deployed, simply because he doesn't seem to have been emotionally stable enough to have handled it effectively. On the other hand, he was a military psychiatrist and would not have even been stationed on the front lines. And if the military permitted every war protester in its ranks to avoid deployment, it could not function. That would cause a complete breakdown of military discipline.
This is a tragedy, all the way around.