Nakhon Si Thammarat is one of the oldest cities in Thailand with a rich history. The earliest settlement in the vicinity of the city was Tha Rua, about ten kilometers south of the modern city, where ceramics from the Song dynasty were found dated to the twelfth century. The settlement then moved to Muang Phra Wieng, which was associated with the Tambralinga Kingdom, four kilometers to the south. An inscription was found at Wat Sema Muang that bore: The king of Srivijaya “had established a foothold on the Malay Peninsula at Ligor” by 775, where he “built various edifices, including a sanctuary dedicated to the Buddha and to the BodhisattvasPadmapani and Vajrapani.”: 84–85, 91 Tambralinga, whose name means “Red Linga” (from Sanskrittām(b)ra “copper” and lingam) and may relate to Chinese Tan Ma Ling (單馬令), was one of the polities under Mahayanist Srivijaya thalassocracy.
The Chronicles of Nakorn Si Thammarat, composed in the seventeenth century, attributed the foundation of current city of Nakhon Si Thammarat to King Sri Thammasok in the thirteenth century. An inscription found at Chaiya stated that King Sri Thammasok ruled Tambralinga in 1231. King Sri Thammasok constructed Wat Phra Mahathat and introduced Singhalese Theravada Buddhism. The Nakhon Si Thammarat Kingdom held authorities over “twelve cities” that extended from Chumphon to the north and Pahang to the south. The Ramkamhaeng Stele of Sukhothai first mentioned “Nakhon Si Thammarat” in 1292, which means “The City of King Sri Thammasok” or “The City of the Virtuous king”. The Nakhon Si Thammarat kingdom ended and the city perished in the fourteenth century. The ruler of Phetchaburi known as Phra Phanom Thale sent his son Phra Phanom Wang to re-establish the city and rule. Nakhon Si Thammarat then came under the influence of Central Siamese Kingdom of Ayutthaya under the mandala system.
Nakhon Si Thammarat was further incorporated into Ayutthaya, who appointed governors to the city, through centralization under King Trailokanat in the fifteenth century. Nakhon Si Thammarat served as the main seat of Siamese authority over Southern Thailand and the Malay Peninsula, becoming Muang Ek or first-level city. Nakhon Si Thammarat was known of Western sources as “Ligor”, which was derived from the term “Nakhon”. Yamada Nagamasa, the Japanese adventurer, was appointed as the governor of Ligor in 1629. In the 1680s, during the reign of King Narai, M. de Lamare the French architect renovated the city walls. After the Siamese revolution of 1688, the governor of Ligor rebelled against the new King Phetracha. King Phetracha sent troops to put down rebels in Ligor in 1692. The powers of the governors of Ligor was then curbed and Ligor was put under the authority of Samuha Kalahom the Prime Minister of Southern Siam.
After the Fall of Ayutthaya in 1767, Phra Palat Nu the vice-governor of Ligor established himself as the local warlord and ruler over Southern Thailand. King Taksin of Thonburi marched south to subjugate Phra Palat Nu or Chao Phraya Nakhon Nu in 1769. Chao Phraya Nakhon Nu was taken to Thonburi but King Taksin re-installed Nakhon Nu as a tributary ruler of Ligor in 1776. King Rama I re-established the governorship of Ligor in 1784 and it ceded to be a tributary kingdom. During the Burmese-Siamese War in 1786, the city of Ligor was sacked by the invading Burmese. During the tenure of Chao PhrayaNakhon Noi (1811-1838), known in British sources as the “Raja of Ligor”, Ligor retained a relative autonomy and emerged as the political and cultural center of Southern Siam. Bishop Pallegoix mentioned that the city of Ligor had the population of 150,000 people, perhaps the largest city in southern Siam before being surpassed by Surat Thani and Hatyai in modern times.
After Nakhon Noi, his son and grandson became respective governors of Nakhon Si Thammarat. During the reforms of King Chulalongkorn, the traditional governorship of Ligor was abolished and the city was incorporated into the Monthon Nakhon Si Thammarat 1896. When the monthon system was abolished in 1932, the town became a provincial capital.