To discover the history of Kathmandu is really to discover the history of the Newars, who are the main inhabitants of the Kathmandu Valley. The foundation of the city dates back to the 12th century AD, during the Malla dynasty. The southern half of old town was where the trade route to Tibet existed. This is where the original settlements of Yambu and Yangala are situated around the confluence of the Bagmati and Vishnumati rivers. Hundreds of thousands of traders and pilgrims passed through this area, often staying at resthouses such as the Kathmandap which would lend its name to the eventual city.
During the Malla dynasty, the city grew in economy and stature with most of its temples, buildings and other monuments being built. As it grew in importance, it still retained its independence from other towns in the valley. However, by the 14th century the valley was completely unified by the Malla king of Bhaktapur which would then break into three separate factions by the mid-15th century. The three kingdoms, Kathmandu, Patan and Bhaktapur, maintained a rivalry that led to many wars between each other, thus rendering all three weak against the subsequent 1768 invasion by Prithvi Narayan Shah. Shah’s dynasty would eventually unify Nepal and name Kathmandu the new, official capital.