Lamphun was the northernmost city of the Mon kingdom of the Dvaravati period, and also the last to fall to the Thai. In the late-12th century it came under siege from the Khmer, but did not fall. However, in 1281 King Mengrai of Lanna finally seized the city, and made it part of his kingdom. After Burmese expansion in the 16th century, Lamphun was under Burmese rule for two centuries. In the 18th century, with the rise of Thonburi and Bangkok against Burmese rule, local leaders from Lampang agreed to be their allies. Lamphun was finally freed from the Burmese and ruled by relatives of Lampang's leader, gaining vassal status from Bangkok. Eventually, after the administrative reform of Bangkok government in the late-19th century, Lamphun became part, as a province, of Siam