Although the first towns in the world were founded in the fertile river valleys (Mesopotamia, Egypt, India, etc.) around the 4th-3rd millennium BC, their intensive development and acquisition of self-governing status coincide with the early medieval ages. It was during this period that cities began to be surrounded by defensive fortresses, acquired a three-part (inner fortress, shehristan, and rabat (fortified castle)) planning structure, acquired an all-Muslim appearance with their characteristic features and new types of monumental buildings, and eventually transformed from small fortified towns into large administrative, cultural, craft, and trade centers. Some researchers even highlight the craft factor, which inevitably led to the emergence of trade and the markets organically connected with it, among the reasons for the emergence of towns.
Markets, which have also played an important role in the structure of historical Azerbaijani towns, have from time to time performed a coordinating function between towns, villages and individual regions, have given impetus to the creation and expansion of money circulation, stimulated production, and have become an important place where socio-cultural relations and communication (communication, conversation and exchange of ideas) are developed. By eliminating the local, closed nature of the economy, they have offered a convenient platform for international trade and, as a result, have become the most important element of the complex urban organism, one of the most important components of the architectural and planning composition of cities.