At last he succeeded by diverting their attention toward attacking the deputies, in getting control of them, and the danger was avoided.
By redirecting their efforts toward the deputies, he successfully prevented a potential threat.