Founded in the late 12th century by Jayavarman VII, the city of Angkor Thom, one of the largest Khmer cities, was the capital for some 500 years. The ruins of a multitude of temples, some predating the city's establishment, are found within its borders, which stretched for roughly a mile along each of its four sides. The Bayon was the royal temple of Jayavarman VII and his immediate successors. Its construction dates from the late 12th to the late 13th centuries. Initially a kind of pantheon of the gods, at different periods it served as either a Hindu or a Buddhist place of worship.