The city briefly dominated the area under King Ram Khamhaeng, who tradition and legend states established the Thai alphabet, but after his death in 1365, Sukothai fell into decline and became subject to another emerging Thai state, the Ayutthaya Kingdom in the lower Chao Phraya area.