Nakhon Chiang Mai (; ) was a tributary city-state under the Siamese rule covering the modern-day areas of Chiang Mai, Chiang Rai, and Mae Hongson. It was established in 1775 after the Siamese conquest of Lanna and lasted until 1899 when it became an integral part of Siam under a newly created administrative unit called Monthon Phayap (; meaning The Northwestern Territory), which covered the Northwestern region of Siam at the time. The ruler of Nakhon Chiang Mai was considered a king by the Lanna people and retained a very high autonomy within the territory,หอจดหมายเหตุแห่งชาติ. ร.๕ รล. – กต. เล่ม ๗ เอกสารเย็บเล่ม กรมราชเลขาธิการ รัชกาลที่ ๕ กระทรวงการต่างประเทศ (จ.ศ.๑๒๓๐ – ๑๒๓๔). หน้า ๘๘–๙๑U.K., Hilderbrand's Report. F.O. 625/10/157. 15 February. 1875. but was generally seen as a governor by the Siamese government. However, some rulers were honored to the rank of a tributary king and considered as a foreign royalty.

Nakhon Chiang Mai was considered a successor of the Lanna kingdom, which had been under the Burmese rule for two centuries until it was captured by Siamese forces under Taksin of Thonburi in 1775. It was ruled by the Chet Ton dynasty and came under Thonburi tributary.

Name Nakhon Chiang Mai has a ceremonial full name as Rattanatingsa Aphinawa Puri Si Khuru Rattha Phra Nakhon Chiang Mai (; ).

History Siamese conquest

Since the Burmese conquest of Lanna in 1558, Lanna or modern Northern Thailand had been mostly under Burmese rule. With the Burmese Toungoo dynasty weakened, Chiang Mai was able to exert independence from Burma in 1727 and the rest of Lanna followed but Lanna became fragmented into city-states, descending into anarchy. A local man named Thipchang was declared ruler of Lampang in 1732. The new Burmese Konbaung dynasty reconquered Chiang Mai in 1763 and installed Chaikaew, son of Thipchang, as ruler of Lampang in 1764. Lanna then again came under Burmese domination.

In 1769, Thado Mindin became the Myowun or Burmese governor of Chiang Mai. His rule was marked by oppression and cultural assimilation policies. Thado Mindin also held Chaikaew in political hostage in Chiang Mai, leaving Lampang under the rule of Chaikaew's son Kawila. In December 1774, the Siamese King Taksin of Thonburi marched his army north to attack Burmese-held Chiang Mai. Phaya Chaban Boonma, a native Lanna nobleman in Chiang Mai, joined with Kawila of Lampang to cooperate with the invading Siamese to overthrow Burmese rule, initiating the Fuen Man (, 'to liberate from Burma') movement. King Taksin sent his generals Chaophraya Chakri and Chaophraya Surasi to successfully take Chiang Mai in January 1775. After two centuries of Burmese rule, most parts of Lanna were transferred to Siam. However, the Burmese regrouped and reestablished their headquarters at Chiang Saen, retaining northern parts of Lanna. Kawila's sister, Sri Anocha, was married to Chaophraya Surasi. King Taksin appointed Phaya Chaban as governor of Chiang Mai and Kawila as governor of Lampang in 1775 as vassal rulers.

Burmese invasions

The Burmese were keen on reclaiming Lanna. In 1777, Burmese forces invaded Chiang Mai. Phaya Chaban had to abandon his city in the face of the Burmese invasion due to numerical inferiority of his defense forces. Chiang Mai was, therefore, abandoned, ceased to exist as a functional city with its population dispersed and left to be claimed by jungles. Phaya Chaban was called to Thonburi where he was imprisoned for his failures and died. With Chiang Mai and Nan abandoned, Lampang under Kawila stood as main frontline defense against Burmese incursions.

In 1782, the new King Rama I of Rattanakosin Kingdom appointed Kawila as Phraya Wachiraprakarn () as nominal governor of Chiang Mai in efforts to restore Chiang Mai as a population center and forefront citadel against Burmese invasions. After decades of warfare, however, Lanna as a whole suffered from manpower shortage. Kawila was unable to take position at Chiang Mai right away due to inadequate population so he instead established himself temporarily at Pasang to the south of Chiang Mai. In 1785, during the Nine Armies' War, King Bodawpaya of Burma sent Burmese forces of 30,000 men from Burmese-held Chiang Saen to lay siege on Lampang. Kawila held out Burmese besiegers for four months until Bangkokian forces arrived to relieve the siege. Again, in 1788, the Burmese forces of 45,000 men attacked Lampang and Pasang. Prince Sura Singhanat, Kawila's brother-in-law, brought relief forces from Bangkok to repel the Burmese.

After twenty years of abandonment, Chiang Mai was finally restored as political and cultural center of Lanna in 1797. Kawila entered Chiang Mai in March 1797 in a ceremony that involved chasing a Lawa man around four corners of the city and staying at Wat Chiangman.

As soon as Chiang Mai was restored, however, King Bodawpaya of Burma sent forces of 55,000 men to attack Chiang Mai in 1797. Kawila again held the city out until Prince Sura Singhanat, Prince Thepharirak and Prince Anouvong of Vientiane brought the allied forces to repel the Burmese. In 1800, Kawila named his new Chiang Mai city as Rattana Tingsa Aphinawaburi (, 'Great New city as jeweled abode of Indra'). In 1802, Bodawpaya installed a Chinese man named Chom Hong to be the ruler of all Lanna at Mong Hsat in direct challenge to Kawila. Kawila sent his younger brother Thammalangka to capture Mong Hsat and Chom Hong. Thammalangka then proceeded to capture Kengtung or Chiang Tung, which had been under Burmese suzerainty, in 1802. These advances provoked Bodawpaya to send invading forces to Chiang Mai again in 1802. Siamese relief forces from the south managed to repel the Burmese from Chiang Mai for second time.

In December 1802, in recognition of Kawila's contribution in defense of the north against Burma, King Rama I appointed Kawila as the tributary 'King of Chiang Mai' with regnal name Phra Boromma Rachathibodi (), establishing the Chetton dynasty or Dynasty of Seven Princes who were sons of Chaikaew including Kawila himself and his siblings. In 1804, combined allied forces from Bangkok, Chiang Mai, Lampang, Nan and Vientiane attacked Chiang Saen, the last Burmese stronghold in Lanna, to eliminate all Burmese influence on Lanna. Chiang Mai forces under Thammalangka managed to capture Chiang Saen in 1804 with its inhabitants deported and distributed among the victors. With the conquest and destruction of Chiang Saen in 1804, the Burmese were finally driven out from Lanna and Burmese incursions virtually ended.

Northern expansions

After decades of Burmese-Siamese Wars, Lanna, as the frontline battlegrounds, was ravaged by warfare and faced manpower shortage. After reestablishment of Chiang Mai in 1797, Kawila and other Lanna lords pursued the policy of "putting vegetables into baskets, putting people into towns" to wage wars to acquire manpower. Elimination of Burmese influence in Lanna in 1804 allowed Lanna lords to expand their dominions and military campaigns to the northernmost Tai princely states including Kengtung and Chiang Hung Sipsongpanna, which were known collectively as Lue-Khuen () in Thai sources. Trans-Salween states to the east of Salween River had political and cultural affinity towards Lanna and centers other than Burma. These states were the main victims of Lanna's subjugations and subsequent forced resettlements into Lanna towns previously damaged and depopulated. In 1805, Thammalangka captured Mong Yawng. In the same year, around 10,000 people, including Tai Khuen people from Kengtung along with its saopha Sao Kawng Tai and Tai Lue people from Mong Yawng, were deported to settle in Chiang Mai and Lamphun, respectively, leading to foundation of Lamphun as the third princely seat in 1806. These major events were accompanied by minor rounds of deportation that gradually transferred population from northernmost Tai states into Lanna.

After the capture of Kengtung (Chiang Tung) by Chiang Mai forces in 1802, Kengtung was left abandoned and depopulated with its saopha Sao Kawng Tai deported to Chiang Mai. However, Maha Hkanan, younger brother of Sao Kawng Tai, established himself at Mong Yang, posing to be an independent ruler. Maha Hkanan faced intensive attacks from the Burmese who were eager to reconquer Kengtung. Thammalangka led Lanna forces to support Maha Hkanan in 1808 but was defeated by the Burmese. Maha Hkanan eventually decided to accept Burmese suzerainty in 1813 and Kengtung was restored as a Burmese vassal. After the death of Kawila in 1816, Lanna's northern campaigns largely ceased. It is estimated that, during this period, about 50,000 to 70,000 people were deported from northern Tai principalities into Lanna towns. These resettled people were viewed by Lanna as belonging to 'Lanna cultural zone' because they spoke mutually intelligible languages and used similar writing system.

Vassalage to Bangkok

King Kawila died in 1816 and was succeeded by his younger brother Thammalangka as the next ruler of Chiang Mai. After Kawila, rulers of Chiang Mai were not appointed as kings but were given a noble rank of Phraya from Bangkok court. There were three vassal rulers, each of them in Chiang Mai, Lampang and Lamphun, who were from the Chetton dynasty. Chiang Mai ruler presided over Lanna lords and, in turn, owed tributary obligations to Chakri kings of Bangkok in alignment with the mandala system. Succession of these Lanna princedoms was exclusively determined by Bangkok. There was no succession pattern as whoever held the princely position of Uparaj or heir presumptive would be entitled to succeed. Lanna rulers were permitted to retain great autonomy and to appoint their own officials as they had proven themselves to be loyal allies in mutual Lanna-Siam cooperation against Burma.

Khamfan succeeded his elder brother Thammalangka as ruler of Chiang Mai in 1822 and there began political conflicts between branches of Chetton dynasty that would plague the Chiang Mai polity for several decades. Khamfan faced political opposition from his cousin Khammoon and his brother Duangthip the ruler of Lampang marched to Chiang Mai in attempts to capitalize the conflicts. When Khamfan died in 1825, Duangthip of Lampang marched to seize Chiang Mai, prompting Khamfan's son Phimphisan to flee and take refuge in Bangkok. Eventually, rulership of Chiang Mai went to Phutthawong, another cousin of the Seven Princes. Phutthawong was an outlier as he was not among the Seven Princes, who had previously been influential. Phutthawong refused to reside in the same Hawkham or palace as his predecessors and constructed his own palace. Political reconciliation took place as Phimphisan eventually returned to Chiang Mai. Tenure of Phutthawong was largely peaceful, earning him the epithet 'Lord of the Peaceful Reign'. Only military mobilization in his time was in 1827 when Lanna lords were asked by Bangkok to contribute forces to quell Anouvong's Lao Rebellion.