The 'rajas' of 'mahajanapadas' built forts around their capital cities because probably the people were afraid of attacks from other kings and needed protection. It is also possible that some rajas wanted to show that they were rich and powerful by building large, tall and impressive walls around cities. Moreover, by fortifying, the land and its people could be controlled more easily.