In the 1100s the Malla rulers came to power, greatly expanding the territory from the Kathmandu valley to surrounding valleys. These kings introduced numerous aspects of Indian culture and changed land ownership laws. However, the kings couldn't maintain their expanding empire divided by mountains and in 1484 the land was again divided into smaller kingdoms. This division of the land led to battles over controlling all the land once again and over time destroyed the progress of the country.
Division ended in 1769 with the beginning of the Gorkha rulers, called the Shah dynasty. The Shah rulers began taking over the lands fairly quickly; however in 1767 the people of Kathmandu sought British India's assistance to intervene. Shockingly, the Shah's army defeated the Brits and took Kathmandu in 1768. These new rulers understood the need to adopt various belief systems and great diversity in their people and generally speaking they accommodated these differences quite well.
This new empire continued their land gains, however eventually pushed too far as they invaded Tibet in the late 1700s and India a couple years later. The Chinese fought this invasion of Tibet and quickly the Nepalese had surrendered. The land gains in India were slower but still significant as in 1814 the British invaded, defeating the Nepalese in 1816, forcing the Nepalese to hand over lands to British India.
These battles began the slow decline of the Shah dynasty as other members of government gained greater and greater powers, eventually making numerous governmental positions, including that of the Prime Minister to be hereditary. Fortunately, over time relations between the United Kingdom and Nepal improved and in 1923 the two signed a friendship treaty.