Quba was mentioned in works of various European geographers, in ancient Arabic and Albanian sources. The castle built by the ruler Anushiravan in the 11th century was called "Bade-Firuz Qubat", and in the Arabic sources of the XII century Quba was mentioned as "Cuba". In the 13th century, in the Dictionary of Geographical names of Arabian scientist Hamabi it was mentioned among the Azerbaijani cities as Kubba, and in the sources of 16th century Quba was referred to as "Dome".
Guba (Quba) city originated from the riverside village of Gudial. In the mid-18th century, after moving his residence from Khudat, Hussain Ali became Quba's Khan (tribal Turkic Muslim ruler) and raised fortress walls around the city. He thereafter attempted to create a state separate from other Azerbaijani khanates.