As with many other towns in the valley, Bhaktapur grew up to service the old trade route from India to Tibet, but the city became a formal entity under King Ananda Malla in the 12th century. The oldest part of town, around Tachupal Tole, was laid out at this time.
From the 14th to the 16th century, Bhaktapur became the most powerful of the valley’s three Malla kingdoms, and a new civic square was constructed at Durbar Sq in the west of the city.
Many of the city’s most iconic buildings date from the rule of King Yaksha Malla (1428–82), but there was another explosion of temple-building during the reign of King Bhupatindra Malla in the 18th century. At its peak the city boasted 172 temples and monasteries, 77 water tanks, 172 pilgrim shelters and 152 wells.
The 15th-century Royal Palace in Durbar Sq was the principal seat of power in the valley until the city was conquered by Prithvi Narayan Shah in 1768 and relegated to the status of a secondary market town. An earthquake that hit in 1934 caused major damage to the city but locals were able to restore most of the buildings, though you can still see the occasional unoccupied temple plinth.
Bhaktapur’s streets were paved and extensively restored in the 1970s by the German-funded Bhaktapur Development Project, which also established proper sewerage and waste-water management facilities. Reconstruction after the 2015 earthquake is altering the appearance of Bhaktapur significantly as families tear down damaged houses and rebuild ever higher with 'earthquake proof' reinforced concrete.