In 1722, Peter the Great's Russo-Persian War (1722–23) began. At the very beginning the Russian forces succeeded in occupying Derbent and Baku. Armenians encouraged by the Russians, concluded the union with Georgians and collected an army in the Karabakh. However their hopes were deceived. Instead of the promised help, Peter the Great advised the Armenians of Karabakh to leave their native places of residence and move to Derbent, Baku, Gilan, Mazandaran where the Russian power had recently been established in the war intending to consolidate its hold on the occupied. Khanates, attached to Caspia, Russia signed the treaty with Turkey, on July 12, 1724, giving the latter a free hand in the whole Transcaucasus (as far as Shamakha).