His boasts and pledges of allegiance went to differing factions in the Middle East that betrayed a facile understanding of anything going on there.
The allegations that he was seen at the club and was suspected to be gay by people who met him, leading to a gay panic scenario, may make more sense than any sort of jihadi motive. Maybe he tried too hard to conform (maybe because of his religion). Beating his wives didn’t get him off enough, and the guys at the club didn’t care for his vibe, so shooting things with his semi-automatic penis substitute became his fetish.
I’m still leading with basic insanity as the main cause of the carnage (abetted by the NRA, to be sure), but the gay panic disguised as religious fervor might be closer to true, for what ever that’s worth.