This city-state emerged in the same period as Sukhothai. Evidently Lanna became closely allied with Sukhothai. After the Ayutthaya kingdom had emerged and expanded its influence from the Chao Phraya valley, Sukhothai was finally subdued. Fierce battles between Lanna and Ayutthaya also constantly took place and Chiang Mai was eventually subjugated, becoming Ayutthaya's 'vassal'.