Pai (Thai: ปาย, Burmese: ပါယ်) is a small town in northern Thailand's Mae Hong Son Province, near the Myanmar border, about 146 km (91 mi) northwest of Chiang Mai on the northern route to Mae Hong Son. It lies on the Pai River. The town has thesaban tambon status and covers parts of the tambon Wiang Tai of Pai District. As of 2006, it had a population of 2,284.
The area of modern-day Pai has been inhabited for more than 5,000 years. About 2,000 years ago, the Lua (or Lawa) Tribe was the dominant ethnic group over all of the area of today's northern Thailand, and a few of their descendants still live in villages only about 20 km away from Pai.
The recorded history of the area starts about 800 years ago with the establishment of a settlement (today known as Ban Wiang Nuea) about 3 km north of modern-day Pai. Ban Wiang Nuea was founded in 1251 AD by Shan immigrants from the region of modern-day northern Myanmar. Due to the area's remoteness and seclusion, people in those times were mainly cut off from news of the outside world and therefore not much concerned with the politics of Lanna and the rest of Thailand. That changed drastically in the course of the 14th and 15th centuries, when the first settlers arrived from Chiang Mai. It was part of Lanna policy of the time to send citizens loyal to the Lanna throne to the outposts of the empire, in order to consolidate and affirm Lanna's territorial authority. The result was a conflict that eventually led to a series of wars over territorial dominance in the Pai area. The Lanna troops finally defeated the Shan soldiers in 1481, forcing them to retire to Myanmar territory. The Shan families who had lived in the area for a long time, establishing households, farming their land and raising their families, were granted permission to stay by the Lanna prince, along with a certain degree of cultural and social autonomy under the law and authority of the Lanna kingdom. Ban Wiang Nuea as a result became a village sharply divided into two parts by a wall into a "Shan" part and a "Lanna" part.
In the second half of the 19th century, colonial powers France and England, who had already established their influence in Vietnam, Cambodia, Laos, and Burma, were viewing the area of modern-day Thailand with increasing interest. To consolidate Siam's influence and authority in the northern border region, the royal house encouraged Northern Thais from provinces like Payao, Lamphun, and Nan to migrate to those areas. The result again was conflict: the last fight between Lanna Thai and Shan in Ban Wiang Nuea took place in 1869, when Lanna soldiers finally defeated their Shan opponents in a battle that ended with the total destruction of the village. The entire village was burnt to the ground. All structures standing in Ban Vieng Nuea today are the result of the subsequent rebuilding efforts of the villagers.
There was already a "road" (that took up to a week to traverse) leading from Chiang Mai to Pai in the late-19th century. This settlement was known as Ban Wiang Tai, and it developed into the modern town we know as Pai. Many of the new immigrants chose to settle in the area along the connecting network of trails to Mae Hong Son.
In 1943, the Japanese began several projects to create efficient troop and equipment transport routes between Thailand and Myanmar in support of their planned attacks on Imphal and Kohima. In addition to the well-known Death Railway through Kanchanaburi, one of these projects was the improvement of the existing road from Chiang Mai to Pai and the patchwork of trails on to Mae Hong Son. The method of crossing the Pai River about 10 km south-east of the City of Pai is not, at present, verifiable. A bridge at that site was erected after the war and erroneously named the "World War II Memorial Bridge". It was apparently erected (and subsequently twice extended) in the course of road improvement projects by the Thai government. The Japanese attempt to develop a road connection between Chiang Mai to Pai and on to Mae Hong Son was abandoned in early 1944 when it became evident that the improvements could not be completed in time for the scheduled attack on Imphal. The uncompleted road did serve as an avenue of retreat for the Japanese after their disastrous defeat at Imphal and Kohima.
In 1967, the Thai government started developing the road leading from Chiang Mai via Pai to Mae Hong Son, known today as Route 1095, but didn't finish paving the route until the early- to mid-1990s.
Pai's recent history is one of waves of migration: in addition to the waves of old Shan and Lanna immigrants, Karen immigrants arrived in the 18th century, Lisu and Lahu people from areas of southern China arrived in the early 20th century, Muslim families from Chiang Mai began arriving to establish trading businesses starting around 1950, a group of Kuomintang fleeing Mao Zedong established a community in Pai in the early 1960s, and, finally, a new wave of refugees from the Shan State of Burma arrived in the past few decades, fleeing the turmoil caused by the Burmese junta to work as laborers in Thailand.