We show that a locally graded group with a finite number m of non-(nilpotent of class at most n) subgroups is (soluble of class at most [log₂n] + m + 3)-by-(finite of order ≤ m!). We also show that the derived length of a soluble group with a finite number m of non-(nilpotent of class at most n) subgroups is at most [log₂ n] + m + 1.