The documented history of Sikkim begins in 1642 AD when three Tibetan lamas consecrated Phuntsong Namgyal as the first Chogyal (King) - a temporal and religious head of the state. Prior to this, the Lepchas – original inhabitants of Sikkim primarily lived a village life with local chieftains and did not maintain any written record. Phuntsong Namgyal relocated his capital to Yuksam, in West Sikkim, and established a centralized government. He divided his Kingdom into 12 dzongs (districts), placed each under a Lepcha dongpon (governor) and had a council of 12 ministers. He was succeeded by his son Tensung Namgyal in 1670 A.D. who moved his capital to Rabdentse. The monarchy of the Namgyal dynasty continued for the next 333 years until it became part of the Indian union in 1975 as its 22nd state.
During early 18th century, Sikkim had engaged in series of territorial wars with both Nepal and Bhutan resulting in occupation of parts of western Sikkim and the Terai region in the south by Nepalese. It was during this period when the largest migration of Nepalese to Sikkim happened. In 1816 these territories were restored to Sikkim by the British in return for its support during the Anglo-Nepalese War (1814–16) and by 1817 Sikkim had become a de facto protectorate of British India. The British East India Company obtained the city of Darjeeling from Sikkim in 1835. Incidents between the British and Sikkim led to the annexation in 1849 of the submontane regions and the subsequent military defeat of Sikkim, culminating in the Anglo-Sikkimese Treaty of 1861. The treaty established Sikkim as a princely state under British paramountcy and the British were given rights of free trade and of road making through Sikkim to Tibet. In 1890 an agreement signed between the British and the Tibetans that defined the border between Sikkim and Tibet.
After India attained independence in 1947, political parties began to be formed in Sikkim for the first time, demanding abolition of feudalism, the establishment of popularly elected government, and accession of Sikkim to India but all demands resisted by the Chogyal and his supporters however Chogyal was unable to hold his ground effectively. In 1950 the Indo-Sikkimese Treaty made Sikkim an Indian protectorate, with India assuming responsibility for the external relations, defense, and strategic communications of Sikkim. The terms of the treaty also included increased popular participation in government, and five general elections based on adult suffrage were held between 1952 and 1974. In the last of these elections, two rival parties merged to form the Sikkim Congress, which swept the polls. The party subsequently launched a campaign to obtain greater political liberties and rights, but the Chogyal attempted to suppress the movement. When the situation got out of control, the Chogyal asked the government of India to take over the administration. India prepared a constitution for Sikkim that was approved by its national assembly in 1974. In a special referendum held in 1975, more than 97 percent of the electorate voted for the merger of Sikkim with India thus Sikkim became the 22nd state of India on May 16, 1975.