In 916, when Yelü Abaoji declared himself emperor of a new Khitan-led empire, known posthumously as Emperor Taizu, he created Yelü Bei his crown prince. When Emperor Taizu inquired of his attendants which god he should first offer sacrifice to as part of his becoming emperor, his attendants largely advocated offering sacrifices to the Buddha. When Emperor Taizu pointed out that the Buddha was not a Chinese god, Yelü Bei advocated offering first to Confucius. Emperor Taizu was pleased by the suggestion and built a temple for Confucius, having Yelü Bei offer sacrifices to him twice a year.