In 1908 it was the center of a revolt against Mohammad Ali Shah, which was only put down with the brutal intervention of the Russians. In the second Irano-Russian War the city was occupied by the Czar troops. However, it was returned to Iran following the signing of Turkmanchai Treaty, a peace and trade settlement that ended the Irano-Russian War of 1826-1828.