The attempted power grab has exposed deep grievances within the army and tested Niger’s ties with its Sahelian allies.