Following the collapse of the Ur-III dynasty at the hands of the Elamites (2002 BC traditional, 1940 BC short), the Amorites gained control over most of Mesopotamia, where they formed a series of small kingdoms.