Kongzi claimed to be inspired by the Duke of Zhou, a heroic figure from his home state of Lu who was regarded as the founder of that state. He also was inspired by the rituals and institutions of the Western Zhou dynasty (1045-771 B.C.E.), founded nearly five hundred years before his birth, the classic literature of that dynasty, and by the religious practices of the earliest Chinese civilizations.
During Kongzi's lifetime, what now is north China enjoyed no political unity and suffered from constant warfare between feudal states that were the remnants of the once-great Western Zhou dynasty that collapsed after "barbarian" invasions in 771 B.C.E. The kings of the various "Warring States" hoped to reunify the former Western Zhou territory by patterning their court rituals and other institutions after those of the fallen dynasty. Foremost among the religious institutions of the Western Zhou were the belief in Tian ("Heaven") as a moral force guiding the universe, the importance of virtuous rulership, and the practice of ancestor worship, all of which in turn deeply influenced Confucian traditions.
While traditional Chinese histories use the term "dynasty" to refer to early regimes, they probably are better understood as tribal kingships associated with the development of bronze metalworking technology and the military superiority and social stratification that came with that technology. They performed elaborate rites of divination and sacrifice related to their ancestors, spent enormous amounts on costly grave goods and monuments, combined political and religious authority in the person of the king, used a logographic (expressing meaning through signs) language, and relied upon a bureaucratic organization to sustain court life and society's needs. Each of these elements of early Chinese civilization exerted a profound influence on the development of Confucian thought, not to mention Chinese culture in general.
The Western Zhou began as a small, weak ally of the more powerful Shang dynasty (ca. 1570-1045 B.C.E.). Once the Western Zhou had successfully overthrown the Shang and established themselves as the new rulers of the north central Chinese plain, they developed a religious ideology to explain their rise to power. According to Western Zhou thought, the Shang god Shang Di ("The Lord on High") once affirmed the Shang kings' high moral stature by allowing them to rule. By proving themselves unworthy of the god's mandate (ming), however, the Shang lost their heavenly legitimacy and were forced to surrender to the virtuous founders of the Western Zhou. Moreover, the Western Zhou equated Shang Di with their own god, Tian, and thus claimed that the same god worshipped by both the Shang and the Western Zhou had revoked its support from the former and granted it to the latter.
Apart from manifesting its approval or disapproval of earthly regimes through signs and portents, however, Tian was thought to be somewhat remote from human affairs and to depend upon worthy human agents to carry out its will. Nearer to human beings than Tian were the recently deceased relatives of the living, so Western Zhou kings and their Shang forerunners regularly consulted their ancestors for guidance. Using "oracle bones" (jiagu) -- cattle scapulas and turtle plastrons heated over a fire -- they posed questions to the royal dead, to whom they also erected temples and offered sacrifices. Ancient Chinese veneration of Tian, ancestor worship, and divination practices shared a common purpose: to maintain harmonious relations between this world and the next for the benefit of the human community. Lunyu 1:11 records several sayings of Kongzi on the importance of reverence (jing) for one's ancestors: "Observe what a person has in mind to do when his father is alive, and then observe what he does when his father is dead. If, for three years, he makes no changes to his father's ways, he can be said to be a good son." Similarly, Kongzi credited Tian as the source of his moral merit (Lunyu 7:23). Kongzi studied and taught Western Zhou texts such as the Shijing (Classic of Poetry) and the Yijing (Classic of Changes) because he believed that they reinforced these basic views and values.
Other Western Zhou texts, such as the Shujing (Classic of Documents), tell the story of the dynasty's rise and fall. The early years of the dynasty were plagued by civil war. At the heart of this conflict was the matter of royal succession. The brother and chief minister of the dynastic founder, the Duke of Zhou, argued that Tian had bestowed its mandate on all of the Western Zhou people, especially the king's ministers, rather than on the royal lineage alone. Other factions at court, however, countered that the king alone was the recipient of divine authority. Unsurprisingly, this argument prevailed with Zhou kings. Yet the Duke of Zhou's view that Tian's mandate (Tianming) is gained and maintained by merit rather than blood eventually became very influential on Kongzi and his followers much later.