The sharpest religious turn came with Jayavarman VII, who took the throne about 1181 after driving out a Cham invasion and ruled as a Mahayana Buddhist. He rebuilt the capital as Angkor Thom around the Bayon, whose towers carry more than two hundred serene faces usually identified with the bodhisattva Avalokiteshvara, and founded Ta Prohm and Preah Khan as monasteries whose inscriptions list their staffs in thousands. The same inscriptions record more than a hundred rest houses along the roads and a network of hospitals dedicated in the name of the healing Buddha, and describe the king's compassion for his subjects as the motive.
The reaction after his death was violent. Under his successors images of the Buddha across the empire were chiselled out, recut as lingas or hidden, and Angkor Wat's Vishnu cult was restored, a campaign of iconoclasm still visible on the walls.
Neither party won. From the thirteenth century Theravada Buddhism spread up from the Mon and Sinhalese world and took hold at the popular level, and the Chinese envoy Zhou Daguan, who spent a year at Angkor in 1296 and 1297, describes yellow-robed monks, shaven heads and a single image of the Buddha as ordinary sights. The court moved south to Phnom Penh after Angkor was sacked around 1431, and Theravada Buddhism has been Cambodia's religion since.