The kingdom of Sikkim was established in 1642, and the Dalai Lama recognized Phuntsog Namgyal, as the first chogyal (temporal and spiritual king). The Namgyal dynasty was to rule Sikkim till 1975.
Beginning in the mid-18th century, Sikkim fought a series of territorial wars with Bhutan, as its king opposed the accession of a minor king in Sikkim. Nepal too, came to occupy parts of western Sikkim and part of the Terai region. This period also saw the largest migration of Nepalese to Sikkim.
The British interest in Sikkim manifested itself in the early 19th century as they wished to gain an access to Tibet. In return for its support to the British in the Anglo-Nepalese war of 1814-16, Sikkim regained the Nepalese-occupied territories. By 1817, Sikkim had become a de facto protectorate of Britain, though there was resentment by the Sikkimese to British interference in their affairs and to the construction of highways through their territory.
The British East India Company obtained Darjeeling from Sikkim in 1835. Incidents between the British and Sikkimese led to the final annexation in 1849 of the Terai region. The subsequent military defeat of Sikkim, ended in the Anglo-Sikkimese Treaty of 1861, which established Sikkim as a princely state under British paramountcy. The British were given rights of free trade and to build roads through Sikkim to Tibet.