I think there's a lot of overlap. In my opinion, terrorist groups have a lot of mentally ill people. The leadership exploits mentally ill youth to accomplish their goals.
Take, for example, Saddam Hussein or Adolf Hitler. They were most likely mentally ill. Saddam Hussein was severely abused and exposed to horrors growing up. Hitler was a mad man. Even so, their ideological motives were evil.
This Hasan was influenced by violent underpinnings of a sizable minority faction of Islam. Of that I'm certain.