Taking advantage of Nadir's fall, he seized the city and killed the
sultan, appointing former naib Selim khan's grand Muhammed Selim bek as the new
sultan in 1747. His first action was to rebuild the navy, as he was also a former admiral of Nadir Shah and chief of shipyard of
Langarud. Situations changed in 1749, when new Afshar shah
Ebrahim Afshar demanded reinforcements from Northern Caucasian khanates. Out of all khans, only
Hajji Muhammad Ali Khan of
Shirvan submitted to new Persian shah. Khanates of
Karabakh,
Shaki,
Baku, Salyan and
Sultanate of Gabala trying to keep their independence, invaded Shamakhi in alliance, forcing Hajji Muhammad to swear that he won't submit to Afsharids. Hajji Muhammad soon was deposed and replaced by a
yuzbashi appointed by
Haji Chalabi. Another player in regional politics was adventurer Ahmed khan Shahsevan, a chief of
Shahsevan tribe. He urged khans to end Haji Chalabi's supremacy. Mirza Mahammad sided with Ahmed khan; however, the battle was a disaster and Mirza Muhammad barely escaped with his life. In order to escape newly crowned
Shahrukh Afshar's invasion, he sent his ambassador Haji Fehim to
Astrakhan, to ask for Russian protection. He later allied to
khan of Quba Huseynali khan in 1758. In 1756, he engaged his son to the daughter of Ahmed Khan of Shahsevan. However, the Salyan khan
Ibrahim khan Rudbar seized her before marriage, taking advantage of the death of Ahmed Khan. Mirza Muhammad Khan decided to fight with the Salyan khan and even made two bridges to cross
Kura. We do not have information about the results of this campaign, apparently it did not take place, since in 1757 the crown prince of Guba,
Fatali and his army attacked the Salyan khanate, expelled Ibrahim Khan and annexed Salyan to Guba. Next year, another threat from Persia -
Muhammad Hasan khan landed in what is today Azerbaijan. Mirza Muhammad unsuccessfully tried to establish with
Shahverdi khan against him at first, but seeing the odds, sent his Haji Abdul Ali with tributes to Muhammad Hasan. As a further precaution, he employed a naval company under the leadership of
John Elton, now having 3 warships and 3 merchant ships at his disposal. He soon acknowledged suzerainty of
Fatali khan of Guba and started to join his military campaigns, such as capturing of Muji castle. He cemented this alliance by marrying his son to Fatali khan's sister, after when he was practically absent from politics. He died on
17 October 1768. His body was taken and buried in
Karbala. == Family ==