The militant group’s ability to mount and inspire small scale attacks show the difficulty of stamping it out.