In the mid-18th century, Sikkim was invaded by Nepal (then the Gorkha Kingdom) and was under the Gorkha rule for more than 40 years. Between 1775 and 1815, almost 180,000 ethnic Nepalis [citation needed] from Eastern and Central Nepal migrated to Sikkim.[citation needed] After the British colonisation of India, however, Sikkim allied itself with British India as they had a common enemy – Nepal.[citation needed] The infuriated Nepalese attacked Sikkim with vengeance, overrunning most of the region including the Terai. This prompted the British East India Company to attack Nepal in 1814, resulting in the Anglo-Nepalese War.[citation needed] The Sugauli Treaty between Britain and Nepal and the Treaty of Titalia between Sikkim and British India resulted in territorial concessions by Nepal, which ceded Sikkim to British India.[3]