The Safavid Empire started to become weak at the end of the 17th century. The authority of the government became weak, and some Kurdish tribes were able to take power for themselves. Attacks from Afghans started in 1709. At the time of these attacks, Kurdish tribes were able to take control of some lands from the Safavid government. In 1719, Kurds took control of Hamadan and the tribes were able to move almost to Isfahan. The Russian Empire and the Ottoman Empire both took control of lands in the north and west of Iran. The Russian Empire's armies took control of Derbent and Baku in the years 1722 and 1723. They were also able to move to Rasht. The Safavid dynasty's downfall was in 1735. Nader Shah, the first "shah" of the Afsharid dynasty, went to try to stop a rebellion among the Kurds in 1747. (He was assassinated on his way.)