The Safavids temporarily lost power in Iran in 1722; Emperor Peter the Great of Russia took advantage of the situation and invaded; and as a result the Safavids were forced to cede Baku to Russia. By 1730 the situation had deteriorated for the Russians; the successes of Nader Shah () led them to sign the Treaty of Ganja near Ganja on 10 March 1735, ceding the city and all other conquered territories in the Caucasus back to Iran.