In the 18th Century Nepal flourished thanks to Kathmandu's location on the main trade route between China to the North and India to the South. These two giant nations were, and still are, enormous influences on Nepal.
However in 1791, Nepal, under the rule of Rana Bahadur Shah, attempted to invade Tibet and raided the Tashilhunpo Monastery in Shigatse. Alarmed by Nepal's expansionism on the edges of its empire, the Chinese Emperor Qianlong ordered his army to oppose the Gorkhali invaders. The Chinese not only defeated the Nepalis but also decided to invade Tibet themselves. Nepal was forced to sign the Sino-Nepalese Treaty of 1792 which stipulated that every 5 years Nepal would send tributes to the Chinese Emperor.