After defeating the Hariphunchai kingdom, king Mangrai decided to relocate his capital and 1294, Wiang kum kam was founded on the eastern bank of the Ping River. The site was plagued with floods, and a new site was found several kilometres to the northwest at the foot of Doi Suthep on the location of and older fortified town of the Lua people.