In the latter part of the 18th century, the Ganja khanate was one of the most economically prosperous polities in the Caucasus, benefiting from the strategic location of its capital on the regional crossroads. For this reason, two politically stronger neighbors, the Kingdom of Georgia and the Karabakh khanate, encroached on the independence of Ganja. From 1780 to 1783, the Ganja khanate was a condominium of Heraclius II of Georgia (represented by Prince Kaikhosro Andronikashvili) and Ibrahim-Khalil khan Javanshir of Karabakh (represented by the vizier, Hadrat Quli Beg). In 1783, Ganja rose up against its Georgian and Karabakh overlords. Georgians tried to reconquer Ganja at the end of 1784, but the campaign ended unsuccessfully. So did the Georgian invasions in 1785 and 1786. Under Javad Khan's rule from 1785 to 1804, the Ganja khanate grew in economic and political importance. The khans had their own mint in Ganja. In 1795, Javad Khan of Ganja joined the Iranian expedition against Georgia.
During the first Russo-Persian War (1804-1813) Ganja was considered by Russians, who had earlier supported Georgian claim to the sovereignty over the khanate, as a town of foremost importance. General Pavel Tsitsianov several times approached Javad khan asking him to submit to Russian rule, but each time was refused. On November 20, 1803, the Russian army moved from Tiflis and in December, Tsitsianov started the siege preparations. After heavy artillery bombardment, on January 3, 1804 at 5 o'clock in the morning, Tsitsianov gave the order to attack the fortress. After fierce fighting the Russians were able to capture the fortress. Javad khan was killed, together with his sons. According to a major study of the military events in the Caucasus by John F. Baddeley:
"Thus Gandja, on the pretence that from the time of Tamara it had really belonged to Georgia, though long lost to that country owing to the weakness of her rulers, was invaded, the capital city of the same name stormed after a month's siege (2 January 1804), Djavat Khan killed, and the khanate annexed. "Five hundred Tartars [Azerbaijanis] shut themselves up in a mosque, meaning, perhaps, to surrender, but an Armenian told the soldiers that there were some Daghestanis amongst them, and the name was a death-signal for all, so great is the exasperation of your Majesty's troops against those people for their raids into Georgia and the robber war they carry on", but all the women in the town were spared -- a rare occurrence in Caucasian warfare, and due to Tsitsianoff's strict injunctions."
Ganja was renamed Elisabethpol in honour of Alexander's wife Elisabeth. In 1805 the imperial government officially abolished the khanate and the military district of Elisabethpol was created. Descendants of Ziyad Oglu Qajar dynasty bore the name of Ziyadkhanov in the Russian empire.
^Russia and Her Colonies - Page 240 by Walter Kolarz - 1952 - 334 pageshttp://books.google.com/books?vid=OCLC01287080&id=2h0aAAAAMAAJ&q=tartars+azeri&dq=tartars+azeri
^In and Out of Focus: Images from Central Africa, 1885-1960 - Page 1 by Christraud M. Geary - Photography - 2003 - 128 pageshttp://books.google.com/books?vid=ISBN0856675520&id=uCgz8uSDzF4C&pg=PA1-IA67&lpg=PA1-IA67&ots=orgT_YioTZ&dq=tartars+azeri&sig=e_QggRdWxjAzDQR4jAiA9SHKG-Y
^History on the Move: Views, Interviews and Essays on Armenian Issues - Page 176 by Edmond Y. Azadian - 2000 - 296 pageshttp://books.google.com/books?vid=ISBN0814329160&id=KGciVUhpzXUC&pg=RA4-PA176&lpg=RA4-PA176&ots=e3YEHAjcST&dq=tartars+azeri&sig=6e4dw5vRFY2Biu95vasJf8-2Vj0
^The Russian Review - Page 388 by Hoover Institution on War, Revolution, and Peace, Karpovich, Michael, 1888-1959, Chamberlin, William Henry, 1897-1963 - 1941http://books.google.com/books?vid=0_iZOhirJQkqVAEJW5_PbPD&id=430SAAAAIAAJ&q=tartars+azeri&dq=tartars+azeri
^Tadeusz Swietochowski. Russian Azerbaijan, 1905-1920: The Shaping of National Identity in a Muslim Community. Cambridge, UK, Cambridge University Press, 2004. ISBN 0-521-52245-5
^Akopyan, Alexander V (Autumn 2008). "Ganja Coins of Georgian Types, AH 1200–1205"(PDF). Journal of the Oriental Numismatic Society197 (Supplement: Caucasian Numismatics, Papers on the Coinage of Kartl-Kakheti (Eastern Georgia), 1744-1801): 47–52.
^John F. Baddeley, The Russian Conquest of the Caucasus, London: Longmans, Green and Co., 1908, p. 67, citing "Tsitsianoff's report to the Emperor: Akti, ix (supplement), p. 920".