In the 11th century, a powerful empire of Khas people emerged in western Nepal whose territory at its highest peak included much of western Nepal as well as parts of western Tibet and Uttarakhand of India. By the 14th century, the empire had splintered into loosely associated Baise rajyas, literally 22 states as they were counted. The rich culture and language of the Khas people spread throughout Nepal and as far as Indo-China in the intervening centuries; their language, later renamed the Nepali language, became the lingua franca of Nepal as well as much of North-east India.[48]

In south-eastern Nepal, Simraungarh annexed Mithila around 1100 AD, and the unified Tirhut stood as a powerful kingdom for more than 200 years,[54] even ruling over Kathmandu for a time.[55] After another 300 years of Muslim rule, Tirhut came under the control of the Sens of Makawanpur.[54] In the eastern hills, a confederation of Kirat principalities ruled the area between Kathmandu and Bengal.

Patan Durbar Square has many buildings, mostly temples, built in the Pagoda style, and a couple of temples of Shikhara architecture showcasing the pinnacle of Nepali wood-, stone- and metal-craft.
Patan Durbar Square, one of the three palace squares in the Kathmandu Valley, was built by the Mallas in the 17th century. The Durbar Squares are a culmination of over a millennium of development in Nepali art and architecture.
In the Kathmandu valley, the Mallas, who make several appearances in Nepalese history since ancient times, had established themselves in Kathmandu and Patan by the middle of the 14th century. The Mallas ruled the valley first under the suzerainty of Tirhut but established independent reign by late 14th century as Tirhut went into decline. In the late 14th century, Jayasthiti Malla introduced widespread socio-economic reforms, principal of which was the caste system. By dividing the indigenous non-Aryan Buddhist population into castes modelled after the four Varna system of Hinduism, he provided an influential model for the Sanskritization and Hinduization of the indigenous non-Hindu tribal populations in all principalities throughout Nepal. By the middle of the 15th century, Kathmandu had become a powerful empire which, according to Kirkpatrick, extended from Digarchi or Sigatse in Tibet to Tirhut and Gaya in India.[56] In the late 15th century, Malla princes divided their kingdom in four – Kathmandu, Patan and Bhaktapur in the valley and Banepa to the east. The competition for prestige among these brotherly kingdoms saw the flourishing of art and architecture in central Nepal, and the building of famous Kathmandu, Patan and Bhaktapur Durbar Squares; their division and mistrust led to their fall in the late 18th century, and ultimately, the unification of Nepal into a modern state.[48][57]

Apart from one destructive sacking of Kathmandu in the early 13th century, Nepal remains largely untouched by the Muslim invasion of India that began in the 11th century. However, the Mughal period saw an influx of high-caste Hindus from India into Nepal. They soon intermingled with the Khas people and by the 16th century, there were about 50 Rajput-ruled principalities in Nepal, including the 22 (Baisi) states and, to their east in west-central Nepal, 24 Chaubisi states. There emerged a view that Nepal remained the true bastion of unadulterated Hinduism at a time when Indian culture had been influenced by centuries of Mughal, followed by British rule. Gorkha, one of the Baisi states, emerged as an influential and ambitious kingdom with a reputation for justice, after it codified the first Hinduism-based laws in the Nepalese hills.[