Founded by King Mengrai in 1296 (the name Chiang Mai means "new city"), it took the place of Chiang Rai as the capital of the Lanna kingdom. King Mengrai built a canal and high walls around the city to protect it from frequent Burmese incursions. Today, the old town is still enclosed in this quadrilateral. With the decline of the Lanna kingdom, the city lost importance and was often occupied by the Burmese or Thai people of the Ayutthaya kingdom.Growing both culturally and economically, the city took on the role of the capital of northern Thailand. The city has more than 300 temples, almost as many as Bangkok, outside of the city center stands the 1676 meters of the Doi Suthep Mountain, home of the Doi Suthep, a magnificent temple that watches over the city and offers a unique landscape especially at sunrise and sunset.