While Islamic State and al-Qaeda have lost ground in the region, they are still capable of recruiting and inspiring local groups to join extremist causes.