Paleolithic human settlements have been discovered at excavations in several cave sites in the Western Plains region and the South-western face of the Central Hills region. Anthropologists believe that some discovered burial rites and certain decorative artifacts exhibit similarities between the first inhabitants of the island and the early inhabitants of Southern India. Recent bioanthropological studies have however dismissed these links, and have placed the origin of the people to the northern parts of India. One of the first written references to the island is found in the Indian epic Ramayana, which described the emperor Ravana as monarch of the powerful kingdom of Lanka, which was created by the divine sculptor Vishwakarma for Kubera, the treasurer of the Gods. English historian James Emerson Tennent also theorized Galle, a southern city in Sri Lanka, was the ancient seaport of Tarshish from which King Solomon is said to have drawn ivory, peacocks and other valuables. The main written accounts of the country's history are the Buddhist chronicles of Mahavansa and Dipavamsa.
The earliest-known inhabitants of the island now known as Sri Lanka were probably the ancestors of the Wanniyala-Aetto people, also known as Veddahs and numbering roughly 3,000. Linguistic analysis has found a correlation of the Sinhalese language with the languages of the Sindh and Gujarat, although most historians believe that the Sinhala community emerged well after the assimilation of various ethnic groups. From the ancient period date some remarkable archaeological sites including the ruins of Sigiriya, the so-called "Fortress in the Sky", and huge public works. Among the latter are large "tanks" or reservoirs, important for conserving water in a climate that alternates rainy seasons with dry times, and elaborate aqueducts, some with a slope as finely calibrated as one inch to the mile. Ancient Sri Lanka was also the first in the world to have established a dedicated hospital in Mihintale in the 4th century BCE. Ancient Sri Lanka was also the world's leading exporter of cinnamon, which was exported to Egypt as early as 1400 BCE. Sri Lanka was also the first Asian nation to have a female ruler in Queen Anula (47–42 BC)
Since ancient times Sri Lanka was ruled by monarchs, most notably of the Sinha royal dynasty that lasted over 2000 years. The island was also infrequently invaded by South Indian kingdoms and parts of the island were ruled intermittently by the Chola dynasty, the Pandya dynasty, the Chera dynasty and the Pallava dynasty. The island was also invaded by the kingdoms of Kalinga (modern Orissa) and those from the Malay Peninsula. Buddhism arrived from India in the 3rd century BCE, brought by Bhikkhu Mahinda, who is believed to have been the son of Mauryan emperor Ashoka. Mahinda's mission won over the Sinhalese monarch Devanampiyatissa of Mihintale, who embraced the faith and propagated it throughout the Sinhalese population. The Buddhist kingdoms of Sri Lanka would maintain a large number of Buddhist schools and monasteries, and support the propagation of Buddhism into Southeast Asia.
Sri Lanka had always been an important port and trading post in the ancient world, and was increasingly frequented by merchant ships from the Middle East, Persia, Burma, Thailand, Malaysia, Indonesia and other parts of Southeast Asia. The islands were known to the first European explorers of South Asia and settled by many groups of Arab and Malay merchants. A Portuguese colonial mission arrived on the island in 1505 headed by the Lourenço de Almeida the son of Francisco de Almeida. At that point the island consisted of three kingdoms, namely Kandy in the central hills, Kotte at the Western coast, and Yarlpanam (Anglicised Jaffna) in the north. The Dutch arrived in the 17th century. Although much of the island came under the domain of European powers, the interior, hilly region of the island remained independent, with its capital in Kandy. The British East India Company established control of the island in 1796, declaring it a crown colony in 1802, although the island would not be officially connected with British India. The fall of the kingdom of Kandy in 1815 unified the island under British rule.
European colonists established a series of tea, cinnamon, rubber, sugar, coffee and indigo plantations. The British also brought a large number of indentured workers from Tamil Nadu to work in the plantation economy. The city of Colombo was established as the administrative centre, and the British established modern schools, colleges, roads and churches that brought Western-style education and culture to the native people. Increasing grievances over the denial of civil rights, mistreatment and abuse of natives by colonial authorities gave rise to a struggle for independence in the 1930s, when the Youth Leagues opposed the "Ministers' Memorandum," which asked the colonial authority to increase the powers of the board of ministers without granting popular representation or civil freedoms. During World War II, the island served as an important Allied military base. A large segment of the British and American fleet were deployed on the island, as were tens of thousands of soldiers committed to the war against Japan in Southeast Asia.
Following the war, popular pressure for independence intensified. On February 4, 1948 the country won its independence as the Commonwealth of Ceylon. Don Stephen Senanayake became the first Prime Minister of Sri Lanka. On July 21, 1960 Sirimavo Bandaranaike took office as prime minister, and became the first female head of government in post-colonial Asia and the first female prime minister in the world. In 1972, the country became a republic within the Commonwealth, and the name was changed to Sri Lanka. The island enjoyed good relations with the United Kingdom and had the British Royal Navy stationed at Trincomalee.
Since 1983, there has been on-and-off civil war, predominantly between the government and the Liberation Tigers of Tamil Eelam (LTTE, also known as the Tamil Tigers), a separatist militant organization who fight to create an independent state named Tamil Eelam in the North and East of the island.