How an al-Qaeda offshoot became one of Africa’s deadliest militant groups