A nonsimplicity criterion for groups