In 802 AD a Khmer (ethnic Cambodian) prince known as Jayavarman II consolidated several autonomous principalities in the Angkor region, founding the Khmer Empire and initiating the Angkor period. He moved his capital several times before settling at Hariharalaya (present-day Phumi Roluos), 12 km (7.5 mi) southeast of Siemreab. At the end of the 9th century, Yasovarman I moved the capital to Angkor and named it Yasodharapura, after himself. Angkor remained the center of the Khmer Empire for most of the next 500 years.
The successors of Jayavarman II created a tradition of large-scale construction that united political power, territorial expansion, and religious belief. Khmer culture assimilated several religious traditions: Hinduism and Buddhism, which arrived from India beginning around the 2nd century AD, and animism, a belief in spiritual forces that was practiced universally in Southeast Asia before the Indian religions appeared. Although all three forms of worship were sometimes practiced simultaneously during the Angkor period, the preferred religion of the ruling king predominated. Each of the Cambodian monarchs identified or associated himself with a particular god. Early kings favored the worship of the Hindu gods Shiva and Vishnu, whereas in the late 12th century the kings' religious preferences shifted to Mahayana Buddhism. Each king built a state temple dedicated to his patron divinity to solidify his symbolic relationship with that god. Each also constructed at least one temple dedicated to his ancestors to ensure the continuation of the royal line.