Abbas I's Shirvan campaign took place in 1606–1607, during the Ottoman–Safavid War of 1603–1618. The Safavids had lost control over the province by the Treaty of Constantinople of 1590. In the winter of 1606, Safavid king (shah) Abbas I (r. 1588–1629), invaded Shirvan. Derbent and Baku soon fell as a result of pro-Safavid uprisings and in the spring of 1607 Abbas I and his men successfully besieged Shamakhi, the provincial capital of Shirvan. With the reconquest of Shirvan, the Safavids had recovered all territories lost to the Ottomans in 1590. (see Treaty of Nasuh Pasha)