A sufficient condition for dichotomy based on a suitable invariance property