Kingdom of Rattanatingsa or Kingdom of Chiang Mai (; ) () was the vassal state of the Siamese Rattanakosin Kingdom in the 18th and 19th century before being annexed according to the centralization policies of Chulalongkorn in 1899. The kingdom was a successor of the medieval Lanna kingdom, which had been under Burmese rule for two centuries until it was captured by Siamese forces under Taksin of Thonburi in 1774. It was ruled by the Thipchak Dynasty and came under Thonburi tributary.
History
Transfer from Burma to Siam
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.