Valley in 1769. Timeline of Hinduism in Nepal Medieval Era The Gurkha control reached its height when the North Indian territories of the Kumaon and Garhwal Kingdoms in the west to Sikkim in the east came under Nepalese control. A dispute with Tibet over the control of mountain passes and inner Tingri valleys of Tibet forced the Qing Emperor of China to start the Sino-Nepali War, compelling the Nepali to retreat to their own borders in the north. The rivalry between the Kingdom of Nepal and the East India Company over the control of states bordering Nepal eventually led to the Anglo-Nepali War (1815–18116). At first, the British underestimated the Nepali and were soundly defeated until committing more military resources than they had anticipated needing. Thus began the reputation of Gurkhas as fierce and ruthless soldiers. The war ended in the Sugauli Treaty, under which Nepal ceded recently captured lands. Factionalism inside the royal family led to a period of instability. In 1846, a plot was discovered revealing that the reigning queen had planned to overthrow Bir Narsingh Kunwar, a fast-rising military leader. This led to the Kot massacre; armed clashes between military personnel and administrators loyal to the queen led to the execution of several hundred princes and chieftains around the country. Bir Narsingh Kunwar emerged victorious and founded the Rana dynasty, and came to be known as Jung Bahadur Rana. The king was made a titular figure, and the post of Prime Minister was made powerful and hereditary. The Ranas were staunchly pro-British and assisted them during the Indian Rebellion of 1857 (and later in both World Wars). In 1860, some parts of the western Terai region were gifted to Nepal by the British as a friendly gesture because of their military support to sustain British control in India during the rebellion (known as Naya Muluk or "new country"). In 1923, the United Kingdom and Nepal formally signed an agreement of friendship that superseded the Sugauli Treaty of 1816. The Hindu practice of Sati, in which a widow sacrifices herself in the funeral pyre of her husband, was banned in 1919, and slavery was officially abolished in 1924. Rana rule was marked by tyranny, debauchery, economic exploitation, and religious persecution. Early-modern Era In the time of early-modern era in Nepal, Hinduism was at the peak of its prominence. The Shah rulers focused on the Hinduization of Nepal; even