Qasim Khan fled to
Qajar Iran subsequently, but kept in touch with powerful people in Caucasus. According to a Russian report dated December 1802, while in Iran, he was married to a daughter of Mirza Rabi, vizier of
Heraclius II and was corresponding with
Prince David of Georgia.
Tsitsianov proposed using the restoration of Qasim Khan to the Shirvan in January 1803 as a tactical manoeuvre to distract
Shaykh Ali Khan. In his 8 January 1803 report, Tsitsianov informed that Shaikh Ali Khan, under the guise of seeking Russian support, aims to depose Mustafa Khan of Shirvan and install Qasim Khan, Mustafa's cousin, in his place. The plan includes securing the strategic
Salyan province—once part of Quba Khanate—for Russia, with Qasim promising its cession as gratitude. Once Qasim is installed, Russian troops could occupy Salyan and later Derbent with minimal resistance. The report also mentioned that Qasim Khan himself wrote directly to
Alexander I of Russia in support of this plan. He informed Shaikh Ali that, allegedly with imperial approval, he was ready to support Qasim Khan’s reinstatement, fulfilling a prior mutual agreement. A secret order was also given to General
Irinarch Zavalishin to reinforce this narrative. Tsitsianov admitted this could be a diversion but left open the possibility of actually restoring Qasim Khan if it proved strategically beneficial. He regarded Qasim as a useful political instrument, not a priority, unless circumstances aligned in Russia’s favour. In this detailed report from 31 March 1803, Tsitsianov informed Alexander I of Russia that Shaikh Ali Khan was attempting to depose Shirvan's Mustafa Khan and replace him with Qasim Khan, Mustafa's cousin. Tsitsianov highlighted that Sheikh Ali has already begun destabilising the Shirvan province and was protecting Qasim Khan, who had taken refuge with him. The report framed this manoeuvre as part of a broader regional struggle in which local rulers seek Russian support to defend against rivals. Tsitsianov used the situation to justify a decisive Russian move to annex
Baku Khanate, viewing it as essential to forestalling Shaikh Ali's ambitions, including installing Qasim Khan, and securing Russian interests in the Caspian region.
Alexander I in his reply, however warned that occupying Derbent and not supporting Shaikh Ali Khan’s plan to install Qasim Khan in Shirvan might expose Russian intentions prematurely and damage trust with other regional rulers. He instructed Tsitsianov to consider this risk carefully and possibly use
Sultan Ahmed Khan of Avar, not Shaikh Ali, to enthrone Qasim Khan if deemed necessary. In his letter of 28 April 1803, Tsitsianov informed Shaikh Ali Khan that Alexander I had granted permission to support the installation of Qasim Khan as the new khan of Shirvan. Tsitsianov confirmed his readiness to act accordingly, in line with their mutual agreement, and requested Shaikh Ali Khan’s opinion on the best measures to execute the plan. He also emphasised the need to keep the operation strictly confidential until it was set in motion. Tsitsianov kept entertaining the idea for a few years. In letter dated 16 January 1805, Tsitsianov warned Salim Khan that Mustafa Khan’s alliances, particularly with Shaikh Ali Khan of Derbent, are dangerous. He explicitly stated that Shaikh Ali’s apparent friendship with Mustafa conceals ambitions to deceive him and transfer control of Shirvan to Qasim Khan. However, Tsistianov's plans foiled once Shaikh Ali Khan switched his allegiance to
Fath Ali Shah. Qasim Khan soon appeared again in the court of
Surkhay II. The latter attacked
Jafar Qoli Khan Donboli in 1808, who was the new khan of
Shaki installed by Russians 2 years ago. Camping near
Jalayir village, he brought 12,000
Gazikumukh soldiers, 1,500
Dzhengutai Kumyks under Ali Sultan, 1,000 soldiers from
Akusha-Dargo Union, 3,000
Avars, 2,000 soldiers from
Jar-Balakan and 500
Kaitags. His army included the blind
Muhammad Hasan, as well as Qasim Khan of Shirvan and Surkhay's sons Nuh, Khalid, Zakariyya and Murtuzali. However, he was defeated after 2 hours of battle. However, Surkhay expelled Qasim Khan later who on 22 June 1811 the
Samur River into the
Quba region with his family, entourage of about 100 people and livestock, without prior notice. This was seen as a threat from new Russian authorities. Major-general
Semyon Guryev who was appointed to the region interpreted this as a deliberate attempt by Surkhay Khan to influence the Quba population, potentially implying that Qasim Khan intended to assume power in Quba. Citing rumours of infectious disease in Surkhay Khan’s territory, Guryev dispatched a Quba noble and interpreter to tell Qasim Khan that, without higher authorisation, he could not be accepted in Quba, especially given the health risk. Qasim Khan refused to return, claiming he was unable to go back to
Gazikumukh, while the carts that had brought him were already sent back across the river on Surkhay Khan’s orders. In response, Guryev deployed an officer with 25
cossacks to block Qasim Khan’s group from entering Quba villages and to insist on his return across the Samur River. Commandant of Baku,
Ivan Repin supported Guryev’s measures and ordered strict border controls to prevent the spread of disease and stated that any decision on Qasim Khan’s case should await viceroy
Alexander Tormasov’s directive. == Return to Caucasus ==