The Thais are related linguistically to groups originating in southern China. Migrations from southern China to Southeast Asia may have occurred in the 6th and 7th centuries. Malay, Mon, and Khmer civilizations flourished in the region prior to the arrival of the ethnic Thai.
Thais date the founding of their nation to the 13th century. According to tradition, in 1238, Thai chieftains overthrew their Khmer overlords at Sukhothai and established a Thai kingdom. After its decline, a new Thai kingdom emerged in 1350 on the Chao Phraya River. Even before the Sukhothai kingdom in the north around Chiang Mai the Lannathai kingdom flourished, which after a long history of indepence or changing alliances with Burma or Ayutthaya became part of the Ayutthaya kingdom finally.
The first ruler of the Kingdom of Ayutthaya, King Ramathibodi I, made two important contributions to Thai history: the establishment and promotion of Theravada Buddhism as the official religion - to differentiate his kingdom from the neighboring Hindu kingdom of Angkor - and the compilation of the Dharmashastra, a legal code based on Hindu sources and traditional Thai custom. The Dharmashastra remained a tool of Thai law until late in the 19th century. Beginning with the Portuguese in the 16th century, Ayutthaya had some contact with the West, but until the 1800s, its relations with neighboring nations, as well as with India and China, were of primary importance.
The first Thai recognition of Western power in the region was the Treaty of Amity and Commerce with the United Kingdom in 1826. In 1833, the United States began diplomatic exchanges with Siam, as Thailand was called until 1939 (and again, between 1945 and 1949). However, it was during the later reigns of King Mongkut (Rama IV, 1851-1868), and his son King Chulalongkorn (Rama V, 1868-1910)), that Thailand established firm rapprochement with Western powers. The Thais believe that the diplomatic skills of these monarchs, combined with the modernizing reforms of the Thai Government, made Siam the only country in South and Southeast Asia to avoid European colonization. This is reflected in the country's modern name, Prathet Thai (Thailand), used unofficially between 1939 and 1945 and officially declared on May 11, 1949, in which prathet means "nation" and thai means "free".
As with the rest of Southeast Asia, Thailand was occupied by the Japanese during World War II and even declared war on the United States and United Kingdom on January 25, 1942. Since Japan's defeat in 1945, with the help of a group of Thais known as the Saree Thai who supported the USA and UK, Thailand has had very close relations with the United States. Threatened by communist revolutions in neighboring countries such as Burma, Vietnam, Cambodia, and Laos, Thailand actively sought to contain communist expansion in the region. Recently, Thailand also has been an active member in the regional Association of Southeast Asian Nations (ASEAN).