Later he was an ally of the khan of the Golden Horde, Tokhtamysh, in his war with Timur (also known as Tamerlane). In late autumn 1386, a huge army of Timur attacked Georgia. Tbilisi was besieged and taken on 21 November 1386, after a fierce fight. The city was pillaged and Bagrat V and his family were imprisoned. Taking advantage of this disaster, the royal vassal Duke Alexander I of Imereti proclaimed himself an independent ruler and was crowned king of Imereti at the Gelati Monastery in 1387.