In ancient times the Jaipur region came under the Matsya Kingdom. Modern Jaipur was founded in 1727 by Maharaja Sawai Jai Singh II who ruled from 1699–1744 and initially his capital was Amber, which lies at a distance of 11 km from Jaipur. He felt the need of shifting his capital city with the increase in population and the growing scarcity of water. The King consulted several books on architecture and architects before making the layout of Jaipur. Finally, under the architectural guidance of Vidyadhar Bhattacharya, (initially an accounts-clerk in the Amber treasury and later promoted to the office of Chief Architect by the King), Jaipur came into existence on the classical basis of principles of Vastu Shastra and similar classical treatise.
After waging several battles with the Marathas, Maharaja Sawai Jai Singh II was keen on the security aspect of the city. Being a lover of astronomy, mathematics, and astrophysics, Jai Singh sought advice from Vidyadhar Bhattacharya, a Brahmin scholar of Bengal, to aid him to design many other buildings including the Royal Palace in the center of the city.
The construction of the city started in 1727. It took around 4 years to complete the major palaces, roads and square. The city was built following the principles of Shilpa Shastra, the science of Indian Architecture. The city was divided into nine blocks, of which two consist the state buildings and palaces, with the remaining seven allotted to the public. Huge fortification walls were built along with seven strong gates.