Such mass murders have happened quite a bit of course, and are likely to happen again, unfortunately. These things happen in every society, where people just "snap." In the US they snap with guns, and in other countries with knives or swords or poison, you name it.
You think of this murderer: apparently hopped up on some very dark cup of Islam; horrified at what he sees as a war against Muslims; hating his fellow soldiers and other so-called "infidels"; expecting to become part of that war machine on "his people" soon, and; being the psychiatriast to whom others came to for help. Where do the psych docs go for treatment?
He was a nutty sumbitch. He was drinking a poisonous interpretation of a religion. Add to that the enormous stresses of being part of a war machine which he was admantly against (and why didn't the fucker just leave the service rather than kill?), which he felt was a personal war against everything he holds dear and believes in. The bastard just snapped.
I've seen people saying this is "terrorism." Well, sure it is, as much as any car bombing in a Kabul market, or as much as a Timoty McVeigh was. It certainly fit the definition of terrorism in the sense of violence for political purposes or against the government. I don't know if it is any more a terrorist act, however, than the sick sumbitch who killed so many people in Virginia Tech.
My point is that we can't really make sense of this and probably never will be able to do so. He had no greater mission apparently than simply unloading his toxic rage onto others, and clearly expected to be killed in the attack. It will be good that he will ultimately be court martialed and executed by the infidel army, rather than on his own evil terms.