Terrorist groups have gravitated toward poorer countries whose governments haven't been able to contain them on their own.