The people of Ganja experienced a temporary cultural decline after an earthquake in 1139, when the city was taken by king Demetrius I of Georgia and its gates taken as trophies which is still kept in Georgia, and again after the Mongol invasion in 1231. The city was revived after the Safavids came to power in 1501, and incorporated all of Azerbaijan and beyond into their territories. The city came under brief occupation by the Ottomans between 1578–1606 and 1723–1735 during the prolonged Ottoman-Persian Wars, but nevertheless stayed under intermittent Iranian suzerainty from the earliest 16th century up to the course of the 19th century, when it was forcefully ceded to neighbouring Imperial Russia.