Around 1240, Pho Khun Bang Klang Hao, a local Tai ruler, rallied the people to rebel against the Khmer. He later crowned himself the first king of Sukhothai Kingdom in 1238. Mainstream Thai historians count Sukhothai as the first kingdom of Thai people. Sukhothai expanded furthest during the reign of Ram Khamhaeng (r. 1279–1298). However, it was mostly a network of local lords who swore fealty to Sukhothai, not directly controlled by it. He is believed have invented Thai script and Thai ceramics were an important export in his era. Sukhothai embraced Theravada Buddhism in the reign of Maha Thammaracha I (1347–1368).