The first ruler of the Kingdom of Ayutthaya, King Uthong (ruled 1351-69), made two important contributions to Thai history: the establishment and promotion of Theravada Buddhism as the official religion to differentiate his kingdom from the neighbouring Hindu kingdom of Angkor and the compilation of the Dharmaśāstra, a legal code based on Hindu sources and traditional Thai custom. The Dharmaśāstra remained a tool of Thai law until late in the 19th century.
In its 417 years of existence, the Ayutthaya Kingdom was frequently plagued by internal fighting but this did not prevent its rise as a major power on mainland Southeast Asia. Ayutthaya's culture and traditions became the model for the next period in Thai history, the Bangkok-based Rattanakosin Kingdom of the Chakri dynasty.