The local al-Qaeda affiliate has taken advantage of recent political instability that has weakened the government’s hold on its territory.