Confucianism originated with the teachings of Kong Qiu, or Confucius, a philosopher and statesman who tried to implement his teachings in government during his service within the Lu State during the Autumn and Spring period of Chinese history. The records commonly attributed to Confucius are second-hand accounts by his disciples written years after his death. Confucius' teachings gained widespread popularity due to subsequent philosophers such as Mencius and Xunzi.
Early in his adult life, Confucius spread his teachings while working as a teacher for the sons of noble families. Confucius firmly advocated the study of classic texts, asserting that an understanding of the moral and political problems of the past would help men in the present live virtuously. With the help of his disciples, Confucius complied and edited the Five Confucian Classics, collections of ancient texts that communicate the underlying doctrines of Confucianism, reverence for deceased ancestors, individual and civic virtue and altruism.
Confucius believed that there is only one legitimate system of government and that it is based on the principles of righteousness, compassion and justice. The philosopher began his political career as governor of a small town and went on to serve as Minister of Crime. This gave him ample opportunity to advise the ruling dynasty according to his political philosophy. However, he never saw reforms implemented to his satisfaction.
Following Confucius' death, Mencius and Xunzi became the greatest transmitters of his teachings. Confucianism spread during the Han Dynasty, when it became the official state ideology.