Dhaka (Dacca) is a modern megacity with origins dating from 500 BC to 200 BC. The history of Dhaka region begins with the existence of urbanised settlements that were ruled by the Gupta Empire, Gauda Kingdom, Pala Empire, and Chandra dynasty before passing to the control of the Sena dynasty in the 10th century CE. After the reign of the Sena dynasty, the region was ruled by the Hindu Deva dynasty of Bikrampur.Roy, Niharranjan (1993). Bangalir Itihas: Adiparba Calcutta: Dey's Publishing, , pp.408-9

Dhaka was successively ruled by the Turkic and Afghan governors descending from the Delhi Sultanate, followed by the Bengal Sultanate, before the arrival of the Mughals in 1608. The city became proto-industrialised and was declared the capital of Mughal Bengal and commercial (financial) capital of Mughal India. The Dhaka natural riverine port has a recorded existence since the 16th century CE. Dhaka's strategic riverine location in Bengal made it a hub for Eurasian traders, including Armenians, Portuguese, French, Dutch, and British. The bustling old city was known as the Venice of the East. After the Mughals, the British ruled the region for 200 years until the independence of India in 1947. After the independence of Bangladesh in 1971, Dhaka became the capital of the new state.

Etymology

The earliest written mention of Dhaka occurs in a map in the book Décadas da Ásia (Decades of Asia) by Portuguese historian João de Barros. Dated 1550 CE, during the Sultanate period, it reads "Daca" in the present day region of Dhaka. There is no definitive origin story of the name, but there are various theories: The name came following the establishment of Dhakeshwari temple, built by Raja Ballal Sena in the 12th century, and Dhakeswari is the name of Goddess Durga. Dhakeshwari may also mean Goddess of Dhaka; so the temple might have been named after the region. Dhak (a membranophone instrument) is used as part of the Durga Puja festival in this temple. The plant named Dhak (Butea monosperma), which was widely found in that area. In the 4th century, the poet laureate Harisena mentioned Davaka as an eastern frontier of the Gupta Empire, in the Prayag Prashasti inscription on the Allahabad Pillar, as a eulogy for the Gupta Emperor Samudragupta. Rajatarangini, written by a Kashmiri Brahman, Kalhana, says the region was originally known as Dhakka. The word Dhakka means watchtower. Bikrampur and Sonargaon — the earlier strongholds of Bengal rulers were situated nearby. So Dhaka was likely used as the watchtower for the fortification purpose. A dialect of the Prakrit language is called Dhaka Bhasa.

Early history The Greater Dhaka region was under the kingdom of Vanga and Gangaridai in the early ancient period. Archaeological excavations in 2017–2018 inside the former Old Dhaka Central Jail on Nazimuddin Road in Old Dhaka revealed some glazed and rolled potteries that are similar to what were found in ancient Mahasthangarh and, Wari-Bateshwar ruins in Bangladesh, and other ruins in India, Malaysia, Indonesia, and Cambodia. This suggests Dhaka was inhabited at least from 500 BC to 200 BC.

Kamarupa kingdom

The Kamarupa kingdom, also known as Pragjyotisa, existed between 350 and 1140 CE. According to the 17th-century chronicle of Yogini Tantra, the southern boundary of the kingdom stretched up to the junction of the Brahmaputra River and Shitalakshya River which covered the Dhaka region.

Pala Empire The Pāla Empire (r. 750–1161 CE) was an imperial power during the post-classical period in the Indian subcontinent, which originated in the Varendra subregion of Bengal. After the fall of Shashanka's Gauda kingdom, the Bengal region was in a state of anarchy. There was no central authority, and there was constant struggle between petty chieftains. The contemporary writings describe this situation as matsya nyaya ("fish justice" i.e., a situation where the big fish eat the small fish). Gopala ascended the throne as the first Pala king during these times. The Khalimpur copper plate suggests that the prakriti (people) of the region made him the king. It is named after its ruling dynasty, whose rulers bore names ending with the suffix Pāla ("protector" in Prakrit). The empire was founded with the election of Gopāla as the emperor of Gauda in the late eighth century CE. The Pala Empire ruled the whole Bengal region after the fall of King Shashanka's Gauda Kingdom. During the reign of Pala rulers, from the 8th century until the late 11th century, Bikrampur, a region located in greater Dhaka district, was one of their capitals. The Pala rulers were mostly Shaivite and Buddhists. But the majority of subjects of Buddhist rulers were Hindu.

Chandra kingdom A stone statue of Nateshwar, a depiction of dancing Shiva on the back of his bull-carrier Nandi, was found at Sarangadhar Jeu Akhada, a monastery in the Chowkbazar Thana area of Dhaka, in 2011. The Nateshwar was a prominent symbol in art from the period of the Chandra dynasty in the 10th and 11th centuries. The dynasty ruled from its capital in Mainamati and later in Bikrampur, near Dhaka.

Sena kingdom

The Sena dynasty's founder, Hemanta Sen, was part of the Pala dynasty until their empire began to weaken. He usurped power and styled himself king in 1095 CE. Then a largely Hindu community populated the lower Dhaka region. According to historian Ahmad Hasan Dani, the weavers (tantis) and the shell cutters (sankharis) are the oldest inhabitants of the city. Shankhari Bazaar (shell cutters' market), Tanti Bazaar (weavers' market), Laksmi Bazaar, and Bangla Bazaar were the market centers. The row houses of those two areas had a narrow frontage of 6 to 10 feet, a depth of 30 to 40 feet, and a height of up to 4 stories. Other localities of craftsmen and businessmen include Kumartoli (potters' locality), Patuatuli (jute-silk painters' area), Sutrapur (carpenters' area), Bania Nagar (traders' area), Jalua Nagar (fishermen's area), Bania Nagar, and Goal Nagar. According to a popular belief, Dhakeshwari Temple was built by Ballal Sena, the second Sena ruler. Another tradition says there were fifty-two bazaars and fifty-three streets, and the region acquired the name of "Baunno Bazaar O Teppun Gulli".

Raja Danauja Rai was one of the last Hindu rulers who had reigned over the eastern Bengal region (including Dhaka) from Sonargaon. In 1302, he was defeated by Turkic ruler Shamsuddin Firuz Shah who had started to expand his kingdom from Lakhnauti in western Bengal.

Sultanate period

Upon arrival of Islam in this region, Turkic and Afghan rulers reigned the area until the late 16th century.

At the defeat of the independent Turkic ruler of Bengal Ghiyasuddin Bahadur Shah in 1324 by the Delhi Sultan Ghiyath al-Din Tughluq's army, Dhaka went under the rule of the Delhi Sultanate for the first time. But it largely stayed within independent Bengal Sultanate from 1338 until 1576 under rulers of different dynasties including Fakhruddin Mubarak Shah, Shamsuddin Ilyas Shah, Alauddin Hussain Shah, Sher Shah Suri, and Muhammad Khan Sur.

In 1412, Shah Ali Baghdadi, a saint arrived in Delhi and then came to Dhaka where he became a disciple of Shah Bahar of the Chishti Order. His shrine still exists in present-day Mirpur Thana area.

Binat Bibi Mosque was built in 1454 at Narinda area of Dhaka during the reign of the Sultan of Bengal, Nasiruddin Mahmud Shah (r. 1435–1459). It is the oldest brick structure that still exists in the city.

An Afghan fort (also known as Old Fort of Dhaka; now-defunct Old Dhaka Central Jail) was built during this period. 17th-century historian Mirza Nathan described the fort in his book Baharistan-i-Ghaibi as "surrounded by mud walls and the largest and strongest in pre-Mughal era". According to the inscription found near the fort, the gate of Naswallagali Mosque was renovated in 1459.

An inscription found in a mosque at Saptagram, West Bengal (around 220 km from Dhaka) says "the son of a revenue officer of Dhaka, established the mosque in 1467".

Daud Khan Karrani of Karrani dynasty was the last independent ruler of Bengal Sultanate who had control over Dhaka until 1576.

Mughal rule and rise as the capital of Bengal

The Bengal Sultanate came into the domain of the Mughal Empire during the reign of Emperor Akbar after the Battle of Tukaroi (1575) and the Battle of Rajmahal (1576), defeating the Karrani dynasty. But Dhaka was situated in the Bhati region of Bengal, which hosted several rebel forces led by Isa Khan (1529–1599) of Bara-Bhuiyans from mid to late 16th century. Raja Man Singh, the general of Akbar, stayed in Dhaka during 1602–1604 to fight against the Bara-Bhuiyan rebels. Singh built the four Siva temples at the site of the ruined original Dhakeshwari Temple. After the next leader of Bara-Bhuiyans, Musa Khan, was subdued by Mughal General Islam Khan Chisti in 1608, Dhaka went directly under the control of the Mughals. It was referred to as a thana (a military outpost).

The newly appointed subahdar of Bengal Subah, Islam Khan, transferred the capital from Rajmahal to Dhaka in 1610. He also renamed Dhaka as Jahangirnagar (City of Jahangir) after the Emperor Jahangir. Due to its location right beside some main river routes, Dhaka was an important centre for business. The muslin fabric was produced and traded in this area. He successfully crushed the regional revolts in Jessore, Bakla (present-day Barisal), and Bhulua (present-day Noakhali) and brought almost the entire province under the Mughal domain.

Subahdar Ibrahim Khan Fath-i-Jang (r. 1617–1624) began the construction of a fort (at the premise of Old Dhaka Central Jail). Rebel prince Shah Jahan defeated and killed him in 1624, and when he entered Dhaka, "all the elephants, horses, and 4,000,000 rupees in specie belonging to the Government were delivered to him". After a short stay, he then moved to Patna.

Appointed in 1639 as the next Bengal subahdar, Prince Shuja built Bara Katra between 1644 and 1646 in Dhaka to serve as his official residence. In 1642, Hussaini Dalan, a Shia shrine, was built by Mir Murad. The Idgah was constructed by Mir Abul Qasim, Diwan of Shuja, in 1640, and Churihatta Mosque by Muhammad Beg in 1650. In the late 1640s, for personal and political reasons, he moved the capital back to Rajmahal. Dhaka became a subordinate station.

Due to political turmoil, Emperor Aurangzeb sent Mir Jumla to deal with Prince Shuja. He pursued Shuja up to Dhaka and reached the city on 9 May 1660. But Shuja had already fled to the Arakan region. As Jumla was ordered to become the next subahdar of Bengal Subah, Dhaka was again made the capital of the region. He was engaged in construction activities in Dhaka and its suburbs – two roads, two bridges, and a network of forts. A fort at Tangi-Jamalpur guarded one of the roads connecting Dhaka with the northern districts, which is now known as Mymensingh Road. He built Mir Jumla Gate at the northern border to defend the city from the attacks of Magh pirates. Italian traveller Niccolao Manucci came to Dhaka in 1662–63. According to him, Dhaka had many inhabitants compared to the size of the city. Most of the houses were built of straw. There were only two kuthis – one of the English and the other of the Dutch. Ships were loaded with fine white cotton and silk fabrics. Many Christians and white and black Portuguese resided in Dhaka.

Thomas Bowrey, a British merchant sailor, visited Dhaka in the 1670s. In his book, A Geographical Account of Countries Round the Bay of Bengal, he mentioned:

Construction of Lalbagh Fort was commenced in 1678 by Prince Muhammad Azam during his 15-month-long governorship of Bengal, but before the work could be completed, he was recalled by Emperor Aurangzeb.