Confucianism is an ethical and philosophical system, on occasion described as a religion, developed from the teachings of the Chinese philosopher Confucius. Following the official abandonment of Legalism in China after the Qin Dynasty, Confucianism became the official state ideology of the Han. Nonetheless, from the Han period onwards, most Chinese emperors have used a mix of Legalism and Confucianism as their ruling doctrine.