Most Azerbaijani sources claim that the settlement was built in late 18th century, as a place of rest for the heads of the Karabakh Khanate. In the first years, it was known as "Khan's village" () because only the khan's family and his relatives lived there. By the 19th century, the settlement was renamed Khankendi ("village of the khan" in Azerbaijani).