From 1501 to 1736, during the existence of the Safavid Empire, the province of Karabakh was governed by Ziyadoglu Gajar's dynasty. Ziyadoglu Gajar's dynasty ruled the province of Karabakh until Nader Shah took over Karabakh from their rule. The Armenian meliks maintained full control over the region until the mid-18th century. In the early 18th century, Iran's Nader Shah took Karabakh out of control of the Ganja khans in punishment for their support of the Safavids, and placed it under his own control In the mid-18th century, as internal conflicts between the meliks led to their weakening, the Karabakh Khanate was formed. The Karabakh khanate, one of the largest khanates under Iranian suzerainty, was headed by Panah-Ali khan Javanshir. For the reinforcement of the power of Karabakh khanate, Khan of Karabakh, Panah-Ali khan Javanshir, built up “the fortress of Panahabad (today Shusha)” in 1751. During that time, Otuziki, Javanshir, Kebirli, and other Turkic tribes constituted the majority of the overall population.