I think at the very least you would have to be a sociopath to be a terrorist or gangster, you couldn't feel empathy for others and do what these people do. All mental disorders aren't easily recognized but can be the cause for bad behavior. I think you can have a mental problem and still know right from wrong unless you are a raving lunatic.On the other hand, I don't think having a mental disorder is a prerequisite to being a terrorist or a gangster. There's a huge difference between committing crimes for pleasure and committing them for ideological purposes or doing it for a living or for survival.
Kids from poor urban areas, for example, might learn to fend for themselves by joining a street gang and dealing drugs and defending their turf from rival gangs and running from the cops. That's survival for them, a basic human instinct. The mafia and white collar criminals are all financially motivated, driven by greed, another human instinct. Domestic violence might be fueled by anger or vengeance. Again, those are human instincts. So can instinct be considered a mental disorder? Personally, I don't believe so.
I would agree you don't have to have a metal disorder to get caught up in a gang, many do that out of fear if they don't join they will come after them but I bet some of these people do of varying degrees.
White collar criminals probably don't have a mental disorder. Most non violent criminals don't but I bet some do. People that beat their spouse I would argue probably do have some sort of mental disorder. Once again they most likely know right from wrong but have problems with controlling anger.