Confucianism arose as the state ideology of China after Emperor Wudi of the Western Han Dynasty decided that China needed an ethical system of ruling. Confucianism is based on the golden rule: "What you do not wish for yourself, do not do to others."
With traditional Chinese principles failing, the Chinese teacher and scholar Confucius recognized an opportunity for improvement. He believed a leader should remain humble, treat followers with compassion and lead by example. He also believed a leader could motivate people by teaching them how to live with integrity and virtue.
The philosophy of Confucius focused on six arts: archery, calligraphy, computation, music, chariot driving and ritual. Few Chinese accepted his ideas initially, but he continued to teach across China. Some historians argue that Confucius hoped to gain enough political power to spearhead a new dynasty, but that he focused on teaching after his ambition failed. He died before Confucianism became the state ideology of China.
Confucianism didn't gain widespread popularity until the end of the Qin Dynasty in 206 B.C. The Qin Dynasty enforced a state ideology of Legalism, which gave the emperor absolute power and applied inflexible interpretations of the law. The people of China resisted Legalism and slowly adopted Confucianism. Although Emperor Wudi wanted to strengthen his power at first, he adopted Confucianism after discovering its teachings. He required government officials to study the ideas of Confucius and apply them to law.