 Mohammad Said Khan and Agasi Khan occupied Agsu, and then killed Hazhi Mohammad Ali Khan.The capital was moved from Agsu to Shamakhi.In 1767, Fatali Khan (Khan of khanate Guba) and Hussein Khan (Khan of khanate Shaki) joined and encircled together to Shamakhi from two sides.