Legalism, school of Chinese philosophy that attained prominence during the turbulent Warring States era (475–221 bce) and, through the influence of the philosophers Shang Yang, Li Si, and Hanfeizi, formed the ideological basis of China's first imperial dynasty, the Qin (221–207 bce).